Querying Sessions of an Instance Node
API Description
This API is used to query sessions of instance nodes.
Restrictions
DB instances of Community Edition 3.4, 4.0, 4.2, 4.4, and 5.0 are supported.
URI
Request Parameters
Parameter description
Parameter |
Type |
IN |
Mandatory |
Description |
---|---|---|---|---|
X-Auth-Token |
string |
header |
Yes |
User token obtained from IAM. For details, see Authentication. |
project_id |
string |
path |
Yes |
Project ID of a tenant in a region. Obtain the project ID by following the instructions in Obtaining a Project ID. |
node_id |
string |
path |
Yes |
Node ID.
|
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
offset |
Integer |
No |
The index position. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number. |
limit |
Integer |
No |
The number of records to be queried. The value ranges from 1 to 100. The default value is 10, indicating that 10 records are returned by default. |
plan_summary |
String |
No |
The description of an execution plan. If this parameter is left empty, sessions in which plan_summary is empty are queried. You can also specify an execution plan, for example, COLLSCAN IXSCAN FETCH SORT LIMIT SKIP COUNT COUNT_SCAN TEXT PROJECTION |
type |
String |
No |
The operation type. If this parameter is left empty, sessions in which type is empty are queried. You can also specify an operation type, for example, none update insert query command getmore remove killcursors. |
namespace |
String |
No |
The namespace. If this parameter is left blank, the sessions in which namespace is empty are queried. You can also specify the value based on the service requirements. |
cost_time |
Integer |
No |
The duration. The unit is us. If this parameter is left empty, the sessions in which cost_time is empty are queried. You can also set this parameter based on the service requirements, indicating that the sessions in which the value of cost_time exceeds the specified value are queried. |
Response Parameters
- Parameter description
Table 3 Response body parameters Parameter
Type
Mandatory
Description
total_count
Integer
Yes
The total number of records.
sessions
Array of objects
Yes
The detailed information. For details, see the QuerySessionResponse table.
Table 4 Data structure description of the session field Parameter
Type
Description
id
String
The session ID.
active
Boolean
Whether the current session is active. If the value is "true", the session is active. If the value is "false", the session is inactive.
operation
String
Operation.
type
String
Operation type.
cost_time
String
Duration. The unit is us.
plan_summary
String
The description of an execution plan.
host
String
Host.
client
String
Client address.
description
String
Indicates the connection description.
namespace
String
Namespace.
Response example
{ "total_count" : 1, "sessions" : [ { "id" : "shard_1:7201646", "active" : true, "operation" : "{\"getMore\":4.9473050217983027E18,\"collection\":\"$cmd.aggregate\",\"batchSize\":101.0,\"lsid\":{\"id\":{\"$binary\":{\"base64\":\"9FhcBFVeTzafCH8BUZrLjQ\\=\\=\",\"subType\":\"03\"}},\"uid\":{\"$binary\":{\"base64\":\"O0CMtIVItQN4IsEOsJdrPL8s7jv5xwh5a/A5Qfvs2A8\\=\",\"subType\":\"00\"}}},\"$clusterTime\":{\"clusterTime\":{\"$timestamp\":{\"t\":1.614047961E9,\"i\":1.0}},\"signature\":{\"hash\":{\"$binary\":{\"base64\":\"HxUWu68VyfvQFivWjHQDdJj/3YQ\\=\",\"subType\":\"00\"}},\"keyId\":6.9312672235666801E18}},\"$client\":{\"driver\":{\"name\":\"PyMongo\",\"version\":\"3.6.1\"},\"os\":{\"type\":\"Linux\",\"name\":\"Linux\",\"architecture\":\"x86_64\",\"version\":\"4.18.0-147.5.1.0.h269.eulerosv2r9.x86_64\"},\"platform\":\"CPython 3.7.4.final.0\",\"mongos\":{\"host\":\"host-172-16-61-110:8635\",\"client\":\"127.0.0.1:33420\",\"version\":\"4.0.3\"}},\"$configServerState\":{\"opTime\":{\"ts\":{\"$timestamp\":{\"t\":1.614047961E9,\"i\":1.0}},\"t\":2.0}},\"$db\":\"admin\"}", "type" : "getmore", "cost_time" : "25", "plan_summary" : "COLLSCAN", "host" : "host-172-16-27-182:8635", "client" : "172.16.41.233:50700", "description" : "conn20", "namespace" : "admin.$cmd.aggregate" } ] }
SDK
Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.
Status Code
For more information, see Status Code.
Error Code
For more information, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot