|
| 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. The server-side latency metric is used to view the server-side latency of an operation. Azure Cosmos DB provides SLA of less than 10 ms for point read/write operations with direct connectivity. For point read and write operations, the SLAs are calculated as detailed in the [SLA document](https://azure.microsoft.com/support/legal/sla/cosmos-db/v1_3/). |
| 14 | + |
| 15 | +If you see unusually large latency for point operations such as: |
| 16 | + |
| 17 | +* A get or set operation with partition key and ID in direct mode |
| 18 | +* A read or write operation or |
| 19 | +* A query |
| 20 | + |
| 21 | +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. |
| 22 | + |
| 23 | +## View server-side latency metric |
| 24 | + |
| 25 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 26 | + |
| 27 | +1. Select **Monitor** from the left-hand navigation bar and select **Metrics**. |
| 28 | + |
| 29 | +  |
| 30 | + |
| 31 | +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**. |
| 32 | + |
| 33 | +  |
| 34 | + |
| 35 | +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. |
| 36 | + |
| 37 | +  |
| 38 | + |
| 39 | +## Filters for server-side latency |
| 40 | + |
| 41 | +You can also filter metrics and the chart displayed by a specific **CollectionName**, **ConnectionMode**, **DatabaseName**, **OperationType**, **Region**, and **PublicAPIType**. |
| 42 | + |
| 43 | +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. |
| 44 | + |
| 45 | +The **Server Side Latency** metrics for each operation are displayed as shown in the following image: |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +You can also group the metrics by using the **Apply splitting** option. |
| 50 | + |
| 51 | +## Next steps |
| 52 | + |
| 53 | +* Monitor Azure Cosmos DB data by using [diagnostic settings](cosmosdb-monitor-resource-logs.md) in Azure |
| 54 | +* [Audit Azure Cosmos DB control plane operations](audit-control-plane-logs.md) |
0 commit comments