An e-commerce system writes custom telemetry to Application Insights. To troubleshoot a sudden latency spike in checkout processing, you must identify the top 5 slowest dependencies of type 'HTTP' over the last 6 hours. You must write a query that minimizes resource consumption and query execution time.
Which KQL query should you execute to retrieve these results efficiently?
- Adependencies
| where type == "HTTP"
| top 5 by duration desc
| where timestamp > ago(6h) - Bdependencies
| where type == "HTTP"
| top 5 by duration desc - dependencies
| where timestamp > ago(6h) and type == "HTTP"
| top 5 by duration descCevap - Ddependencies
| project timestamp, type, duration, name
| top 5 by duration desc
| where type == "HTTP" and timestamp > ago(6h)
Cevap
The query that filters by timestamp and type first, and then applies the top operator: dependencies | where timestamp > ago(6h) and type == "HTTP" | top 5 by duration desc
The correct query applies the time range filter (`timestamp > ago(6h)`) and the type filter (`type == "HTTP"`) immediately at the start of the query pipeline. This ensures that the query engine only scans telemetry data within the specified time window, improving performance. The `top 5 by duration desc` operator is then used to efficiently retrieve the 5 slowest dependencies.
Adım Adım Çözüm
Anahtar Kavram
Filtering telemetry data by time range early in Kusto Query Language (KQL) queries to optimize query performance and limit data scanning.
Tahmini Süre:1m 30s