"mongocli atlas performanceAdvisor namespaces" requires "processName", but parm not in docs
SteveH-US opened this issue · 5 comments
Describe the bug
A clear and concise description of the bug.
The "mongocli atlas performanceAdvisor namespaces" and related commands require process name
$ mongocli atlas performanceAdvisor namespaces list
Error: required flag(s) "processName" not set
But processName parameter is not mentioned in the docs
To Reproduce
Steps to reproduce the behavior:
- Run '$ mongocli atlas performanceAdvisor namespaces list'
- See error 'Error: required flag(s) "processName" not set'
Expected behavior
Please explain what you expected to happen.
The "processName" parameter is defined.
Even if the "processName" parameter were defined, there is no "processName" property returned by "mongocli atlas processes list"
This is what I see as the structure of the documents returned from this command
"created": "2021-07-08T20:47:28Z",
"groupId": "5fb434276f8323671cc1648c",
"hostname": "atlas-rfujlm-shard-00-00.qurxw.mongodb.net",
"id": "atlas-rfujlm-shard-00-00.qurxw.mongodb.net:27017",
"lastPing": "2022-01-24T16:37:44Z",
"links": [
{
"rel": "self",
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/5fb434276f8323671cc1648c/processes/atlas-rfujlm-shard-00-00.qurxw.mongodb.net:27017"
}
],
"port": 27017,
"shardName": "",
"replicaSetName": "atlas-rfujlm-shard-0",
"typeName": "REPLICA_SECONDARY",
"version": "4.2.18",
"userAlias": "perfdev-dev-mi3np-shard-00-00.qurxw.mongodb.net"
}
Which one of these properties should be used as the "processName".
Screenshots
If possible, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Mac OS 11.6.2
- MongoCLI version; 1.20.4
- Ops Manager Version: N/A, using Atlas
Additional context
Add any other context about the problem here.
Another problem is that you'd also want to use the "projectId" to filter for particular projects, but doing so causes an error
$ mongocli atlas performanceAdvisor namespaces --projectId 5fb434276f8323671cc1648c
Error: unknown flag: --projectId
Additionally, the 'process list' command does not return all the processes unless one specified a limit
$ mongocli atlas processes list --projectId 5fb434276f8323671cc1648c | wc -l
1902
add limit and get more
$ mongocli atlas processes list --projectId 5fb434276f8323671cc1648c --limit 2000 | wc -l
2795
being to get all of them is important because one cannot limit the results by cluster. I end up having to filter the process list like this
$ mongocli atlas processes list --projectId 5fb434276f8323671cc1648c | jq '.[] | select(.userAlias | contains("lava"))'
First, do the "performanceAdvisor" commands also need to have a "limit" so that we, conversely, can be assured we get all the results and thereby be able to filter them? It appears not, but it does seem odd that some CLI commands need the limit and others do not in order to get all results.
Second, it seems like a bug to me to not get all results if not passing the "limit" parameter.
It appears that the "processName" is the combination of "userAlias" + ":" + "port" from the process list documents.
Hi @SteveH-US,
But processName parameter is not mentioned in the docs
What do you mean here? I see --projectName
in the doc page
You can also run:
mongocli atlas performanceAdvisor namespaces ls --help
Namespaces appear in the following format: {database}.{collection}.
Usage:
mongocli atlas performanceAdvisor namespaces list [flags]
Aliases:
list, ls
Flags:
--duration int Length of time from the since parameter, in milliseconds, for which you want to receive results.
-h, --help help for list
--hostId string Unique identifier for the host of a MongoDB process.
-o, --output string Output format. Valid values are json, json-path, go-template, or go-template-file.
--processName string Unique identifier for the host of a MongoDB process in the following format: {hostname}:{port}.
--projectId string Project ID to use. Overrides the settings in the configuration file or environment variable.
--since int Point in time, specified as milliseconds since the Unix Epoch, from which you want to receive results.
Another problem is that you'd also want to use the "projectId" to filter for particular projects, but doing so causes an error
Here you are using --projectId
with namespaces
but you forgot to add list
to your command. This should be
mongocli atlas performanceAdvisor namespaces ls --processName hostname:port --projectId 5fb434276f8323671cc1648c
Additionally, the 'process list' command does not return all the processes unless one specified a limit
yes, you are right. Mongocli is using the following atlas endpoint which set the limit
(itemPerPage
) to 100
as default, up to a maximum of 500
. I am going to update the flag description and doc page to highlight this information.
First, do the "performanceAdvisor" commands also need to have a "limit" so that we, conversely, can be assured we get all the results and thereby be able to filter them? It appears not, but it does seem odd that some CLI commands need the limit and others do not in order to get all results.
-
$ mongocli atlas performanceAdvisor namespaces list
: This is the atlas endpoint that we are using with this command. As you can see the endpoint's description saysRetrieve up to 20 namespaces for collections experiencing slow queries for a specified host. Namespaces appear in the following format: {database}.{collection}.
and it doesn’t implement pagination. I agree with you that this is a bug and I am going to open an internal ticket to see if we can update the endpoint to support pagination but there is nothing we can do within mongocli at this time. -
$ mongocli atlas performanceAdvisor slowQueryLogs ls
: this command provides the--nLog
flag which represents the maximum number of log lines to return (default 20000). Here we are using this atlas endpoint. -
$ mongocli atlas performanceAdvisor suggestedIndexes list
: this command provides--nExamples
(Maximum number of examples queries to provide that will be improved by a suggested index. Default is 5) and--NIndexes
(Maximum number of indexes to suggest. Default unlimited). Here we are using this atlas enpoint.
As you can see, the main reason why some CLI commands have the limit flag and others do not is the underline endpoint.
Okay, I didn't drill down enough.