You need to write an optimized Kusto Query Language (KQL) query that returns the average duration of failed dependency calls grouped by target for the last 12 hours. The query must be optimized to filter the data as early as possible. How should you complete the KQL query to satisfy these requirements? Complete the query by filling in the missing KQL operators and fields in the blanks.
Cevap:dependencies
| 【where】 timestamp > ago(12h)
| where 【success】 == false
| 【summarize】 AverageDuration = avg(duration) by target
| 【where】 timestamp > ago(12h)
| where 【success】 == false
| 【summarize】 AverageDuration = avg(duration) by target
Cevap
The completed query uses the 'where' operator to filter by timestamp first, the 'success' property to filter for failed dependency calls, and the 'summarize' operator to compute the average duration by target.
The query starts with the 'dependencies' table. It filters for records from the last 12 hours using '| where timestamp > ago(12h)' to ensure the query remains optimized. Next, it filters for unsuccessful calls using '| where success == false'. Finally, it groups the results and calculates the average duration using '| summarize AverageDuration = avg(duration) by target'.
Adım Adım Çözüm
Anahtar Kavram
Writing optimized KQL queries on Application Insights telemetry by applying early time filters and performing aggregations.
Tahmini Süre:1m 30s