You are troubleshooting a performance degradation in an Azure Web App. You need to analyze the daily failure rate of incoming HTTP requests recorded in Application Insights over the last 7 days. To prevent query timeouts and minimize resource usage on your Application Insights resource, the queries must be optimized. Which two of the following Kusto Query Language (KQL) queries will successfully calculate the daily failure rate while meeting the optimization requirement?
- requests | where timestamp > ago(7d) | summarize FailureRate = countif(success == false) * 100.0 / count() by bin(timestamp, 1d)Answer
- requests | where timestamp > ago(7d) | summarize SuccessCount = countif(success == true), TotalCount = count() by bin(timestamp, 1d) | project timestamp, FailureRate = (TotalCount - SuccessCount) * 100.0 / TotalCountAnswer
- Crequests | summarize FailureRate = countif(success == false) * 100.0 / count() by bin(timestamp, 1d)
- Drequests | summarize SuccessCount = countif(success == true), TotalCount = count() by bin(timestamp, 1d) | project timestamp, FailureRate = (TotalCount - SuccessCount) * 100.0 / TotalCount
Answer
The queries that filter requests where the timestamp is greater than seven days ago and then summarize the failure rate by daily bins.
The correct queries analyze request failures by either directly counting unsuccessful requests (success == false) or subtracting successful requests from total requests. Both queries utilize the where timestamp > ago(7d) filter, which restricts the telemetry scan to the target window and ensures the query executes efficiently without timing out.
Step-by-Step Solution
Key Concept
Optimizing KQL queries in Application Insights by applying time-range filters to prevent performance degradation.