A cloud-native microservices application deployed on Azure Kubernetes Service (AKS) logs telemetry to a shared Azure Application Insights workspace. You need to write a Kusto Query Language (KQL) query to analyze dependency calls that failed in the last 24 hours. The query must join the dependency logs with custom event telemetry to retrieve the name of the failing dependency and the custom event name, using the `operation_Id` column.
To minimize resource consumption and query execution time, which KQL query should you use?
- dependencies
| where timestamp > ago(24h) and success == false
| join kind=inner (
customEvents
| where timestamp > ago(24h)
) on operation_Id
| project dependencyName = name, eventName = name1Answer - Bdependencies
| where timestamp > ago(24h) and success == false
| join kind=inner customEvents on operation_Id
| project dependencyName = name, eventName = name1 - Cdependencies
| where success == false
| join kind=inner customEvents on operation_Id
| where timestamp > ago(24h)
| project dependencyName = name, eventName = name1 - Ddependencies
| where success == false
| join kind=inner (
customEvents
| where timestamp > ago(24h)
) on operation_Id
| project dependencyName = name, eventName = name1
Answer
The KQL query that filters both the dependencies and customEvents tables by time range before performing the inner join on operation_Id is the correct and optimized query.
The correct query applies the time range filter on both the left table (dependencies) and the right table (customEvents) before performing the join. In Kusto Query Language (KQL), filtering data as early as possible on both sides of a join is critical to minimize the dataset sizes being processed by the join operator, ensuring optimal query performance and preventing execution timeouts.
Step-by-Step Solution
Key Concept
KQL Query Optimization using Time-Range Filters on Joined Tables