You are troubleshooting a performance issue in a web application. You need to identify the top 3 operations with the longest average duration over the past 12 hours by querying the Application Insights telemetry. The query must be optimized to minimize data scan limits and query execution time.
Which Kusto Query Language (KQL) query should you run to retrieve this data efficiently?
- requests
| where timestamp > ago(12h)
| summarize AvgDuration = avg(duration) by name
| top 3 by AvgDuration descCevap - Brequests
| summarize AvgDuration = avg(duration) by name
| top 3 by AvgDuration desc - Crequests
| summarize AvgDuration = avg(duration) by name, timestamp
| where timestamp > ago(12h)
| top 3 by AvgDuration desc - Drequests
| where timestamp > ago(12h)
| summarize avg(duration) by name
| top 3 by duration desc
Cevap
The KQL query that filters by timestamp > ago(12h) first, aggregates the average duration using summarize AvgDuration = avg(duration) by name, and then uses top 3 by AvgDuration desc.
The correct query filters the requests table by timestamp first, ensuring only telemetry from the past 12 hours is scanned and processed. It then calculates the average duration using the summarize operator and correctly references the aggregated alias in the top operator.
Adım Adım Çözüm
Anahtar Kavram
KQL Query Optimization with Time Range Filtering