Skip to content

Commit d430b10

Browse files
authored
Merge pull request #178152 from StefArroyo/patch-16
Update diagnostic-queries-mongodb.md
2 parents 2705f38 + 098c05b commit d430b10

File tree

1 file changed

+18
-48
lines changed

1 file changed

+18
-48
lines changed

articles/cosmos-db/mongodb/diagnostic-queries-mongodb.md

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,20 @@ Common queries are shown in the resource-specific and Azure Diagnostics tables.
3838

3939
# [Resource-specific](#tab/resource-specific)
4040
```Kusto
41-
let topRequestsByRUcharge = CDBDataPlaneRequests
42-
| where TimeGenerated > ago(24h)
43-
| project RequestCharge , TimeGenerated, ActivityId;
41+
//Enable full-text query to view entire query text
4442
CDBMongoRequests
45-
| project PIICommandText, ActivityId, DatabaseName , CollectionName
46-
| join kind=inner topRequestsByRUcharge on ActivityId
47-
| project DatabaseName , CollectionName , PIICommandText , RequestCharge, TimeGenerated
43+
| where TimeGenerated > ago(24h)
44+
| project PIICommandText, ActivityId, DatabaseName , CollectionName, RequestCharge
4845
| order by RequestCharge desc
4946
| take 10
5047
```
5148

5249
# [Azure Diagnostics](#tab/azure-diagnostics)
5350
```Kusto
54-
let topRequestsByRUcharge = AzureDiagnostics
55-
| where Category == "DataPlaneRequests" and TimeGenerated > ago(1h)
56-
| project requestCharge_s , TimeGenerated, activityId_g;
5751
AzureDiagnostics
5852
| where Category == "MongoRequests"
59-
| project piiCommandText_s, activityId_g, databaseName_s , collectionName_s
60-
| join kind=inner topRequestsByRUcharge on activityId_g
61-
| project databaseName_s , collectionName_s , piiCommandText_s , requestCharge_s, TimeGenerated
53+
| where TimeGenerated > ago(24h)
54+
| project piiCommandText_s, activityId_g, databaseName_s , collectionName_s, requestCharge_s
6255
| order by requestCharge_s desc
6356
| take 10
6457
```
@@ -68,25 +61,17 @@ Common queries are shown in the resource-specific and Azure Diagnostics tables.
6861

6962
# [Resource-specific](#tab/resource-specific)
7063
```Kusto
71-
let throttledRequests = CDBDataPlaneRequests
72-
| where StatusCode == "429" or StatusCode == "16500"
73-
| project OperationName , TimeGenerated, ActivityId;
7464
CDBMongoRequests
75-
| project PIICommandText, ActivityId, DatabaseName , CollectionName
76-
| join kind=inner throttledRequests on ActivityId
77-
| project DatabaseName , CollectionName , PIICommandText , OperationName, TimeGenerated
65+
| where TimeGenerated > ago(24h)
66+
| where ErrorCode == "429" or ErrorCode == "16500"
67+
| project DatabaseName, CollectionName, PIICommandText, OperationName, TimeGenerated
7868
```
7969

8070
# [Azure Diagnostics](#tab/azure-diagnostics)
8171
```Kusto
82-
let throttledRequests = AzureDiagnostics
83-
| where Category == "DataPlaneRequests"
84-
| where statusCode_s == "429" or statusCode_s == "16500"
85-
| project OperationName , TimeGenerated, activityId_g;
8672
AzureDiagnostics
87-
| where Category == "MongoRequests"
88-
| project piiCommandText_s, activityId_g, databaseName_s , collectionName_s
89-
| join kind=inner throttledRequests on activityId_g
73+
| where Category == "MongoRequests" and TimeGenerated > ago(24h)
74+
| where ErrorCode == "429" or ErrorCode == "16500"
9075
| project databaseName_s , collectionName_s , piiCommandText_s , OperationName, TimeGenerated
9176
```
9277
---
@@ -95,24 +80,16 @@ Common queries are shown in the resource-specific and Azure Diagnostics tables.
9580

9681
# [Resource-specific](#tab/resource-specific)
9782
```Kusto
98-
let throttledRequests = CDBDataPlaneRequests
99-
| where StatusCode == "50"
100-
| project OperationName , TimeGenerated, ActivityId;
10183
CDBMongoRequests
102-
| project PIICommandText, ActivityId, DatabaseName , CollectionName
103-
| join kind=inner throttledRequests on ActivityId
104-
| project DatabaseName , CollectionName , PIICommandText , OperationName, TimeGenerated
84+
| where TimeGenerated > ago(24h)
85+
| where ErrorCode == "50"
86+
| project DatabaseName, CollectionName, PIICommandText, OperationName, TimeGenerated
10587
```
10688
# [Azure Diagnostics](#tab/azure-diagnostics)
10789
```Kusto
108-
let throttledRequests = AzureDiagnostics
109-
| where Category == "DataPlaneRequests"
110-
| where statusCode_s == "50"
111-
| project OperationName , TimeGenerated, activityId_g;
11290
AzureDiagnostics
113-
| where Category == "MongoRequests"
114-
| project piiCommandText_s, activityId_g, databaseName_s , collectionName_s
115-
| join kind=inner throttledRequests on activityId_g
91+
| where Category == "MongoRequests" and TimeGenerated > ago(24h)
92+
| where ErrorCode == "50"
11693
| project databaseName_s , collectionName_s , piiCommandText_s , OperationName, TimeGenerated
11794
```
11895
---
@@ -121,27 +98,20 @@ Common queries are shown in the resource-specific and Azure Diagnostics tables.
12198

12299
# [Resource-specific](#tab/resource-specific)
123100
```Kusto
124-
let operationsbyUserAgent = CDBDataPlaneRequests
125-
| project OperationName, DurationMs, RequestCharge, ResponseLength, ActivityId;
126101
CDBMongoRequests
127102
//specify collection and database
128103
//| where DatabaseName == "DBNAME" and CollectionName == "COLLECTIONNAME"
129-
| join kind=inner operationsbyUserAgent on ActivityId
130-
| summarize max(ResponseLength) by PIICommandText
104+
| summarize max(ResponseLength) by PIICommandText, RequestCharge, DurationMs, OperationName, TimeGenerated
131105
| order by max_ResponseLength desc
132106
```
133107
# [Azure Diagnostics](#tab/azure-diagnostics)
134108
```Kusto
135-
let operationsbyUserAgent = AzureDiagnostics
136-
| where Category=="DataPlaneRequests"
137-
| project OperationName, duration_s, requestCharge_s, responseLength_s, activityId_g;
138109
AzureDiagnostics
139110
| where Category == "MongoRequests"
140111
//specify collection and database
141112
//| where databaseName_s == "DBNAME" and collectionName_s == "COLLECTIONNAME"
142-
| join kind=inner operationsbyUserAgent on activityId_g
143-
| summarize max(responseLength_s1) by piiCommandText_s
144-
| order by max_responseLength_s1 desc
113+
| summarize max(responseLength_s) by piiCommandText_s, OperationName, duration_s, requestCharge_s
114+
| order by max_responseLength_s desc
145115
```
146116
---
147117

0 commit comments

Comments
 (0)