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.
Answer:kql
let threshold = toscalar(
dependencies
| where timestamp > ago(6h)
| summarize 【percentile】(duration, 90)
);
dependencies
| where timestamp > ago(6h)
| where duration > 【threshold】
let threshold = toscalar(
dependencies
| where timestamp > ago(6h)
| summarize 【percentile】(duration, 90)
);
dependencies
| where timestamp > ago(6h)
| where duration > 【threshold】
Answer
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.
Step-by-Step Solution
Key Concept
Calculating percentiles and using scalar variables in Kusto Query Language (KQL) queries for telemetry analysis.
Estimated Time:1m 30s