Soru

Zorluk: OrtaQuery and Analyze Application Insights Telemetry

A developer is investigating a performance bottleneck in an Azure Function App. They want to retrieve all dependency calls from the last 6 hours that took longer than the 90th percentile of all dependency durations during that same period. Complete the Kusto Query Language (KQL) query to retrieve these slow dependency calls by filling in the blanks.

Cevap:kql
let threshold = toscalar(
dependencies
| where timestamp > ago(6h)
| summarize 【percentile】(duration, 90)
);
dependencies
| where timestamp > ago(6h)
| where duration > 【threshold】

Cevap

Use 'percentile' or 'percentiles' in the first blank to compute the 90th percentile baseline, and use 'threshold' in the second blank to filter dependency durations against the computed scalar variable.
The query calculates the 90th percentile of dependency call durations over the last 6 hours using the `percentile` function. By using `toscalar()`, this single value is stored in the `threshold` variable. The main query then references `threshold` to filter for dependency records whose duration exceeds the computed value.

Adım Adım Çözüm

1
Define the aggregation function to find the 90th percentile of dependency call durations.
The function `percentile(duration, 90)` is specified.
This determines the 90th percentile boundary value of the duration across all dependency records within the specified time range.
2
Assign the scalar value to a variable named threshold.
The `let threshold = toscalar(...)` expression assigns the scalar result.
Using `toscalar()` converts the single-value tabular result into a scalar type so it can be evaluated in subsequent filter comparisons.
3
Filter the primary dependencies table using the threshold variable.
The final filter statement evaluates `where duration > threshold`.
This isolates the dependency calls that took longer than the 90th percentile threshold limit.

Anahtar Kavram

Calculating percentiles and using scalar variables in Kusto Query Language (KQL) queries for telemetry analysis.
Tahmini Süre:1m 30s
Bu soruyu puanla