Microsoft Certified: Azure Developer Associate (AZ-204)Monitor, troubleshoot, and optimize Azure solutionsMedium

A financial analytics application uses Azure Cosmos DB to store time-series data. Developers need to troubleshoot performance issues related to slow queries and high Request Unit (RU) consumption. They want to identify which specific queries are consuming the most RUs and contributing to the performance bottlenecks. Which Azure Monitor feature integrated with Cosmos DB should they use to get detailed query metrics and optimize their queries?

  1. ACosmos DB Diagnostic Logs (Log Analytics)
  2. BAzure Monitor Activity Log
  3. CAzure Monitor Metrics Explorer
  4. DAzure Service Health
Show answer & explanation

Correct answer: A. Cosmos DB Diagnostic Logs (Log Analytics)

Cosmos DB Diagnostic Logs, when sent to Log Analytics, provide detailed query metrics, including RU consumption, query duration, and index usage. This granular data is essential for identifying and optimizing inefficient queries.

Why the other options are wrong

  • B. Activity Log tracks control-plane operations, not data-plane query performance.
  • C. Metrics Explorer shows aggregated metrics (e.g., total RUs), but not details for individual queries.
  • D. Azure Service Health provides information about the health of Azure services, not application-specific query performance.

Cosmos DB Diagnostic Logs

Detailed operational logs from Azure Cosmos DB that can be sent to Azure Log Analytics for in-depth analysis of data plane requests, query performance, and indexing behavior.

  • Includes metrics like RU consumption, query duration, and status codes.
  • Essential for troubleshooting and optimizing Cosmos DB queries.
  • Can be queried using Kusto Query Language (KQL) in Log Analytics.

Memory trick: Cosmos DB logs reveal the query secrets!

More Monitor, troubleshoot, and optimize Azure solutions questions