Soru

Zorluk: OrtaQuery and Analyze Application Insights Telemetry

An Azure App Service web application is experiencing latency issues. You need to write an optimized Kusto Query Language (KQL) query in Application Insights to identify the top 5 slowest dependencies based on their average duration over the last 24 hours. The query must minimize the data scanned to ensure high performance.

Which KQL query should you run?

  1. dependencies
    | where timestamp > ago(24h)
    | summarize avg_duration = avg(duration) by target
    | top 5 by avg_duration desc
    Cevap
  2. B
    dependencies
    | summarize avg_duration = avg(duration) by target
    | top 5 by avg_duration desc
  3. C
    dependencies
    | where timestamp > ago(24h)
    | where isnotempty(sdkVersion) and isnotempty(connectionString)
    | summarize avg_duration = avg(duration) by target
    | top 5 by avg_duration desc
  4. D
    dependencies
    | where timestamp > ago(24h)
    | where target has "cdn" and url has "cache=bypass"
    | summarize avg_duration = avg(duration) by target
    | top 5 by avg_duration desc

Cevap

The KQL query that filters the dependencies table by timestamp first, then calculates the average duration grouped by target, and finally selects the top 5 results sorted in descending order of average duration.
The correct query filters the `dependencies` table by `timestamp > ago(24h)` first to minimize data scanning, then groups by `target` using `summarize` to calculate the average `duration`, and uses the `top` operator to return the 5 slowest dependencies.

Adım Adım Çözüm

1
Filter by time range
Adds `| where timestamp > ago(24h)` right after the table name.
Ensures that the query scans only the last 24 hours of data, optimizing performance.
2
Aggregate duration by target
Adds `| summarize avg_duration = avg(duration) by target`.
Calculates the average latency (duration) for each unique dependency target.
3
Sort and limit results
Adds `| top 5 by avg_duration desc`.
Orders the aggregated results by average duration in descending order and returns only the top 5 records.

Anahtar Kavram

Optimizing Kusto Query Language (KQL) queries in Azure Application Insights by applying time-range filters early.
Tahmini Süre:1m 30s
Bu soruyu puanla