You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/monitor-cosmos-db.md
+3-65Lines changed: 3 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@ ms.custom: subject-monitoring
11
11
---
12
12
13
13
# Monitoring Azure Cosmos DB
14
+
14
15
When you have critical applications and business processes relying on Azure resources, you want to monitor those resources for their availability, performance, and operation. This article describes the monitoring data generated by Azure Cosmos databases and how you can use the features of Azure Monitor to analyze and alert on this data.
15
16
16
17
## What is Azure Monitor?
@@ -81,7 +82,6 @@ You can analyze metrics for Azure Cosmos DB with metrics from other Azure servic
81
82
- Region
82
83
- StatusCode
83
84
84
-
85
85
## Analyzing log data
86
86
Data in Azure Monitor Logs is stored in tables which each table having its own set of unique properties. Azure Cosmos DB stores data in the following tables.
87
87
@@ -108,22 +108,6 @@ Following are queries that you can use to help you monitor your Azure Cosmos dat
108
108
109
109
```
110
110
111
-
* To query for the 10 most recently logged events:
112
-
113
-
```Kusto
114
-
AzureDiagnostics
115
-
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
116
-
| limit 10
117
-
```
118
-
119
-
* To query for all operations, grouped by operation type:
120
-
121
-
```Kusto
122
-
AzureDiagnostics
123
-
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
124
-
| summarize count() by OperationName
125
-
```
126
-
127
111
* To query for all operations, grouped by resource:
128
112
129
113
```Kusto
@@ -140,59 +124,13 @@ Following are queries that you can use to help you monitor your Azure Cosmos dat
140
124
| where Caller == "[email protected]" and ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
141
125
| summarize count() by Resource
142
126
```
143
-
* To get all queries greater than 100 RUs joined with data from **DataPlaneRequests** and **QueryRunTimeStatistics**.
144
-
145
-
```Kusto
146
-
AzureDiagnostics
147
-
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests" and todouble(requestCharge_s) > 100.0
148
-
| project activityId_g, requestCharge_s
149
-
| join kind= inner (
150
-
AzureDiagnostics
151
-
| where ResourceProvider =="MICROSOFT.DOCUMENTDB" and Category == "QueryRuntimeStatistics"
152
-
| project activityId_g, querytext_s
153
-
) on $left.activityId_g == $right.activityId_g
154
-
| order by requestCharge_s desc
155
-
| limit 100
156
-
```
157
-
158
-
* To query for which operations take longer than 3 milliseconds:
159
-
160
-
```Kusto
161
-
AzureDiagnostics
162
-
| where toint(duration_s) > 3 and ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
163
-
| summarize count() by clientIpAddress_s, TimeGenerated
164
-
```
165
-
166
-
* To query for which agent is running the operations:
167
-
168
-
```Kusto
169
-
AzureDiagnostics
170
-
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
171
-
| summarize count() by OperationName, userAgent_s
172
-
```
173
-
174
-
* To query for when the long running operations were performed:
175
-
176
-
```Kusto
177
-
AzureDiagnostics
178
-
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="DataPlaneRequests"
179
-
| project TimeGenerated , duration_s
180
-
| summarize count() by bin(TimeGenerated, 5s)
181
-
| render timechart
182
-
```
183
-
184
-
* To get Partition Key statistics to evaluate skew across top 3 partitions for database account:
185
-
186
-
```Kusto
187
-
AzureDiagnostics
188
-
| where ResourceProvider=="MICROSOFT.DOCUMENTDB" and Category=="PartitionKeyStatistics"
The account level metrics available in the portal, such as account storage usage and total requests, are not available via the SQL APIs. However, you can retrieve usage data at the collection level by using the SQL APIs. To retrieve collection level data, do the following:
194
131
195
132
* To use the REST API, [perform a GET on the collection](https://msdn.microsoft.com/library/mt489073.aspx). The quota and usage information for the collection is returned in the x-ms-resource-quota and x-ms-resource-usage headers in the response.
133
+
196
134
* To use the .NET SDK, use the [DocumentClient.ReadDocumentCollectionAsync](https://msdn.microsoft.com/library/microsoft.azure.documents.client.documentclient.readdocumentcollectionasync.aspx) method, which returns a [ResourceResponse](https://msdn.microsoft.com/library/dn799209.aspx) that contains a number of usage properties such as **CollectionSizeUsage**, **DatabaseUsage**, **DocumentUsage**, and more.
197
135
198
136
To access additional metrics, use the [Azure Monitor SDK](https://www.nuget.org/packages/Microsoft.Azure.Insights). Available metric definitions can be retrieved by calling:
0 commit comments