Soru

Zorluk: OrtaQuery and Analyze Application Insights Telemetry

An Azure App Service web application experiences performance degradation due to slow external HTTP dependency calls. You need to write a Kusto Query Language (KQL) query in Application Insights to identify the top three external dependencies that failed in the last 24 hours, sorted by their average duration, along with the total count of failures for each dependency. The query must be optimized for performance and scan the minimum amount of data.

Which KQL query should you use?

  1. A
    requests
    | where success == false
    | summarize AvgDuration = avg(duration), FailureCount = count() by name
    | top 3 by AvgDuration desc
  2. B
    dependencies
    | where success == false
    | summarize AvgDuration = avg(duration), FailureCount = count() by name
    | top 3 by AvgDuration desc
  3. dependencies
    | where timestamp > ago(24h) and success == false
    | summarize AvgDuration = avg(duration), FailureCount = count() by name
    | top 3 by AvgDuration desc
    Cevap
  4. D
    dependencies
    | where success == false
    | summarize AvgDuration = avg(duration), FailureCount = count() by name
    | top 3 by AvgDuration desc
    | where timestamp > ago(24h)

Cevap

The correct query filters the dependencies table by timestamp and success status first, then summarizes the average duration and count of failures by name, and finally selects the top 3 by average duration descending.
The query filtering by timestamp and success at the very beginning of the pipeline is correct because it limits the scope of the telemetry records before aggregation, optimizing query performance. It utilizes the dependencies table to analyze outgoing calls and aggregates by name using avg(duration) and count() to calculate average duration and total failures respectively.

Adım Adım Çözüm

1
Identify the appropriate Application Insights table for external calls.
The dependencies table is selected.
The requests table only tracks incoming HTTP requests, whereas external calls are logged in the dependencies table.
2
Apply a time-range filter as early as possible in the KQL query.
The clause 'where timestamp > ago(24h)' is placed immediately after the table name.
Filtering early minimizes the volume of scanned telemetry data, improving query performance and preventing scan limits from being reached.
3
Filter for failed dependencies and aggregate the results.
The query filters for 'success == false' and uses 'summarize AvgDuration = avg(duration), FailureCount = count() by name' followed by 'top 3 by AvgDuration desc'.
This properly calculates the average duration and total failure count per dependency name, and retrieves the top three slow failed dependencies.

Anahtar Kavram

Querying and optimizing Application Insights telemetry using KQL by applying early time filters
Bu soruyu puanla