Other Articles

Cosmos DB – Monitor Latency

This check ensures that latency monitoring is enabled for Azure Cosmos DB DocumentDB accounts. Monitoring latency helps maintain performance, detect service degradation, and ensure that applications meet availability and response time requirements.

Check Details

  • Resource: Azure Cosmos DB (DocumentDB)
  • Check: Ensure Latency Monitoring Is Enabled
  • Risk: Without latency monitoring, performance degradation or regional issues may go undetected, potentially leading to application downtime, slow response times, and breach of service level agreements.

Remediation via Azure Portal

  1. Log in to the Azure Portal. Azure Portal dashboard
  2. Navigate to Azure Cosmos DB and select the affected database account. Azure Cosmos DB accounts list
  3. In the left-hand menu, select Metrics under the Monitoring section. Cosmos DB metrics blade
  4. From the metrics dropdown, select Server Side Latency or Total Request Latency.
  5. Configure diagnostic settings to send metrics to Log Analytics, Event Hub, or Storage Account for continuous monitoring. Cosmos DB metrics blade
  6. Create alerts for latency thresholds to ensure proactive performance management.

Remediation via Azure CLI

  1. Open Azure Cloud Shell or a local terminal with Azure CLI installed. Azure Cloud Shell
  2. Enable diagnostic settings to collect latency metrics:
    az monitor diagnostic-settings create \
     --name cosmos-latency-monitoring \
     --resource <cosmosdb-resource-id> \
     --workspace <log-analytics-workspace-id> \
     --metrics '[{"category": "AllMetrics", "enabled": true}]'
    
  3. Verify diagnostic settings configuration:
    az monitor diagnostic-settings list \
     --resource <cosmosdb-resource-id>
    

Ensure that metrics collection is enabled and that latency-related metrics are being sent to the configured monitoring destination.