Soru

Zorluk: OrtaQuery and Analyze Application Insights Telemetry

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?

  1. A
    dependencies
    | where type == "HTTP"
    | top 5 by duration desc
    | where timestamp > ago(6h)
  2. B
    dependencies
    | where type == "HTTP"
    | top 5 by duration desc
  3. dependencies
    | where timestamp > ago(6h) and type == "HTTP"
    | top 5 by duration desc
    Cevap
  4. D
    dependencies
    | 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

1
Apply the time range filter `timestamp > ago(6h)` and type filter `type == 'HTTP'` at the very beginning of the query pipeline.
Limits the scope of the search to HTTP dependencies logged within the last 6 hours, minimizing data scan.
KQL queries execute operations sequentially; filtering early prevents downstream operations from processing unnecessary historical data.
2
Use the `top 5 by duration desc` operator to retrieve the slowest dependencies.
Returns the 5 records with the largest `duration` values in descending order.
The `top` operator is optimized for finding the largest values and performs better than sorting the entire dataset with `order by` followed by `take`.

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
Bu soruyu puanla