Soru

Zorluk: OrtaQuery and Analyze Application Insights Telemetry

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?

  1. requests | where timestamp > ago(7d) | summarize FailureRate = countif(success == false) * 100.0 / count() by bin(timestamp, 1d)Cevap
  2. requests | where timestamp > ago(7d) | summarize SuccessCount = countif(success == true), TotalCount = count() by bin(timestamp, 1d) | project timestamp, FailureRate = (TotalCount - SuccessCount) * 100.0 / TotalCountCevap
  3. C
    requests | summarize FailureRate = countif(success == false) * 100.0 / count() by bin(timestamp, 1d)
  4. D
    requests | summarize SuccessCount = countif(success == true), TotalCount = count() by bin(timestamp, 1d) | project timestamp, FailureRate = (TotalCount - SuccessCount) * 100.0 / TotalCount

Cevap

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.

Adım Adım Çözüm

1
Filter the telemetry data by time range using a where operator with the timestamp.
The database engine scans only the partition matching the last 7 days, optimizing query speed and reducing resource consumption.
To prevent full table scans and query timeouts, KQL queries in Application Insights must specify a time range.
2
Use the summarize operator to group the requests daily using the bin function on the timestamp and compute the failure rate.
A dataset grouped by day containing the calculated percentage of failed requests.
Grouping by a daily time bin allows tracking failure trends over time, and dividing failed requests by total requests yields the failure rate.

Anahtar Kavram

Optimizing KQL queries in Application Insights by applying time-range filters to prevent performance degradation.
Bu soruyu puanla