Query App Insights
Query Azure Application Insights telemetry to answer questions about command usage, extension activity, performance.
Prerequisites
APP_INSIGHTS_API_KEYenv varAPP_INSIGHTS_CLIENT_IDenv var
Workflow
- Validate credentials - check env vars exist
- Test API -
node scripts/queryAppInsights.mts "customEvents | take 1" - Interpret question - identify commands, extensions, time ranges, metrics
- Find executor name - if checking a command, find its executor name (see references)
- Build KQL query - use executor names, not command IDs
- Execute -
node scripts/queryAppInsights.mts "<kql-query>" - Answer - interpret results, format clearly
Key Points
- Legacy
/commandExecutiontelemetry uses executor names (commandName), not command IDs. OTEL command spans exposecommand. - Event pattern: Legacy names end with
/commandExecution; OTEL spans usedependenciesby default on Node andcustomEventson Web - Tables:
customEvents(Legacy events, Web OTEL spans, and configured Node OTEL spans),dependencies(default Node OTEL spans),requests(Root Spans) - OTEL fields:
name,operation_Id,operation_ParentId; extension name iscloud_RoleNameindependencies,customDimensions.common.extnamein WebcustomEvents - Dependencies root filter:
where operation_ParentId == operation_Id - Measurements:
customMeasurements.executionTime(ms for Legacy) orduration(ms for OTEL) - For Web Console's production store, platform filter, and user-count field, follow Web Console query patterns.
References
references/command-id-vs-executor.md- Finding executor names, shared executors, commands without telemetryreferences/query-patterns.md- Common KQL patternsreferences/script.md- Script implementation details