|
| 1 | +--- |
| 2 | +title: How to monitor the server-side latency for operations in Azure Cosmos DB |
| 3 | +description: Learn how to monitor server latency for operations in Azure Cosmos DB account or a container. Owners of an Azure Cosmos DB account can understand the server-side latency issues with your Azure Cosmos accounts. |
| 4 | +ms.service: cosmos-db |
| 5 | +ms.topic: conceptual |
| 6 | +author: kanshiG |
| 7 | +ms.author: govindk |
| 8 | +ms.date: 04/07/2020 |
| 9 | +--- |
| 10 | + |
| 11 | +# How to monitor the server-side latency for operations in an Azure Cosmos DB container or account |
| 12 | + |
| 13 | +Azure Monitor for Azure Cosmos DB provides a metrics view to monitor your account and create dashboards. The Azure Cosmos DB metrics are collected by default, this feature does not require you to enable or configure anything explicitly. |
| 14 | +The server-side latency metric is used to view the server-side latency of an operation. For example, if you see unusually large latency for point operations such as: |
| 15 | + |
| 16 | +* A get or set operation with partition key and id in direct mode |
| 17 | +* A read or write operation or |
| 18 | +* A query |
| 19 | + |
| 20 | +You can look up the diagnostic log to see the size of data returned. If you see a sustained high latency for query operations, you can look up the diagnostic log for size of data returned, [throughput or RU/s](cosmosdb-monitor-resource-logs.md#diagnostic-queries) used, or the number of such operations in a given period. This way, you can debug the server-side latency issues. |
| 21 | + |
| 22 | +## View server-side latency metric |
| 23 | + |
| 24 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 25 | + |
| 26 | +1. Select **Monitor** from the left-hand navigation bar and select **Metrics**. |
| 27 | + |
| 28 | +  |
| 29 | + |
| 30 | +1. From the **Metrics** pane > **Select a resource** > choose the required **subscription**, and **resource group**. For the **Resource type**, select **Azure Cosmos DB accounts**, choose one of your existing Azure Cosmos accounts, and select **Apply**. |
| 31 | + |
| 32 | +  |
| 33 | + |
| 34 | +1. Next select the **Server Side Latency** metric from the list of available metrics. To learn in detail about all the available metrics in this list, see the [Metrics by category](monitor-cosmos-db-reference.md) article. In this example, let's select **Server Side Latency** and **Avg** as the aggregation value. In addition to these details, you can also select the **Time range** and **Time granularity** of the metrics. At max, you can view metrics for the past 30 days. After you apply the filter, a chart is displayed based on your filter. You can see the average number of request units consumed per minute for the selected period. |
| 35 | + |
| 36 | +  |
| 37 | + |
| 38 | +### Filters for server-side latency |
| 39 | + |
| 40 | +You can also filter metrics and the chart displayed by a specific **CollectionName**, **ConnectionMode**, **DatabaseName**, **OperationType**, **Region**, and **PublicAPIType**. |
| 41 | + |
| 42 | +To filter the metrics, select **Add filter** and choose the required property such as **PublicAPIType** and select the value **sql**. Add another filter for **OperationType**. The graph then displays the server-side latency for different operations during the selected period. The operations executed via Stored procedure are not logged so they are not available under the OperationType metric. |
| 43 | + |
| 44 | +The **Server Side Latency** metrics for each operation are displayed as shown in the following image: |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +You can also group the metrics by using the **Apply splitting** option. |
| 49 | + |
| 50 | +## Next steps |
| 51 | + |
| 52 | +* Monitor Azure Cosmos DB data by using [diagnostic settings](cosmosdb-monitor-resource-logs.md) in Azure |
| 53 | +* [Audit Azure Cosmos DB control plane operations](audit-control-plane-logs.md) |
0 commit comments