You have an Azure subscription that contains an Azure Cosmos DB account.
You need to recommend a solution to generate an alert from Azure Log Analytics when a request charge for a query exceeds 50 request units more than 20 times within a 15-minute window.
What should you recommend?
Click on the arrows to vote for the correct answer
A. B. C. D.A
The correct answer to this question is A: Create a search query to identify when requestCharge_s exceeds 50. Configure an alert threshold of 20 and a period of 15.
Explanation: Azure Cosmos DB is a fully managed NoSQL database service that provides global distribution, elastic scaling of throughput and storage, and low latency. It provides metrics and logs that can be used to monitor and optimize performance, including request charge, which is the number of request units (RU) consumed by a database operation.
To monitor the request charge for a query in Azure Cosmos DB, we can use Azure Log Analytics, which is a service that collects and analyzes data from various sources, including Azure resources and custom sources. We can create a search query in Log Analytics to filter and aggregate the Cosmos DB metrics and logs, and then create an alert based on the query result.
In this scenario, the requirement is to generate an alert when a query exceeds 50 request units more than 20 times within a 15-minute window. This means that we need to monitor the requestCharge_s metric, which represents the request charge for a single operation, and count the number of times it exceeds 50 within a 15-minute period.
To create a search query for this purpose, we can use the following Kusto query language (KQL) syntax:
csharpAzureDiagnostics | where Category == "CosmosDBRequests" | where requestCharge_s > 50 | summarize count() by bin(TimeGenerated, 15s) | where count_ > 20
This query filters the Azure Cosmos DB requests logs, selects the records where the requestCharge_s value is greater than 50, groups the records by a 15-second time bin, and counts the number of records in each bin. The query then selects the bins where the count is greater than 20, which indicates that the request charge exceeded 50 more than 20 times within a 15-minute window.
We can then create an alert rule in Log Analytics based on this query result. The alert rule can be configured with a threshold of 20, which is the minimum number of occurrences required to trigger the alert, and a period of 15 minutes, which is the time window for the query.
Therefore, the recommended solution is to create a search query to identify when requestCharge_s exceeds 50. Configure an alert threshold of 20 and a period of 15, which corresponds to answer option A. Answer option B is incorrect because it includes the duration_s metric, which is not relevant to the request charge threshold. Answer option C is incorrect because it sets the frequency to 20, which is not relevant to the threshold condition. Answer option D is incorrect because it only monitors the duration_s metric and does not include the request charge threshold condition.