You are analyzing application performance issues for an Azure Web App by using Application Insights. You need to write a Kusto Query Language (KQL) query that retrieves the top 5 external dependency calls with the longest average duration over the last 24 hours. The query must execute efficiently and avoid scanning unnecessary historical data.
Which two of the following queries should you use?
- dependencies
| where timestamp > ago(24h)
| summarize AvgDuration = avg(duration) by name
| top 5 by AvgDuration descAnswer - dependencies
| where timestamp > ago(24h)
| summarize AvgDuration = avg(duration) by name
| order by AvgDuration desc
| take 5Answer - Cdependencies
| summarize AvgDuration = avg(duration) by name, timestamp
| where timestamp > ago(24h)
| top 5 by AvgDuration desc - Ddependencies
| summarize AvgDuration = avg(duration) by name
| top 5 by AvgDuration desc
Answer
The queries that first filter dependencies by timestamp > ago(24h) and then summarize duration by name using either 'top 5 by AvgDuration desc' or 'order by AvgDuration desc | take 5' are correct.
The correct queries apply the time filter (where timestamp > ago(24h)) immediately after referencing the dependencies table. This ensures the query engine only scans the last 24 hours of data. The aggregation calculates the average duration grouped by name. Finally, the top 5 or order by and take 5 operators are functionally equivalent ways to retrieve the 5 slowest dependencies.
Step-by-Step Solution
Key Concept
Efficient telemetry querying in Application Insights using Kusto Query Language (KQL) by filtering on timestamp first.