SuperAPI AI 工具集

query-app-insights

数据与分析

查看项目

更新于 10-15 21:43

技能介绍

用途:查询 Azure Application Insights 遥测数据,回答关于命令使用、扩展活动与性能指标的问题。

主要能力:通过 KQL 查询 customEvents(Legacy)、dependencies(OTEL Spans)、requests(Root Spans)等表;支持按执行器名称、时间范围、指标进行检索;可测量执行时间(Legacy 用 customMeasurements.executionTime,OTEL 用 duration)。

使用方式:先确认环境变量 APP_INSIGHTS_API_KEY 与 APP_INSIGHTS_CLIENT_ID 存在;用 tsx scripts/queryAppInsights.ts "customEvents | take 1" 测试 API;解析问题后确定命令、扩展、时间范围与指标;若查命令需先找到其执行器名称;构建 KQL 查询时使用执行器名称而非命令 ID;执行 tsx scripts/queryAppInsights.ts "<kql-query>" 并解读结果。

关键点:遥测使用执行器名称而非命令 ID;事件模式以 /commandExecution 结尾(Legacy/v2)或存于 dependencies 表(OTEL/v3);OTEL 属性包括 name、cloud_RoleName、operation_Id、operation_ParentId;根 Span 过滤条件为 operation_ParentId == operation_Id。

参考文档:references/command-id-vs-executor.md、references/query-patterns.md、references/script.md。

限制:需具备有效凭据与相应访问权限;具体权限范围、配额与错误处理细节暂未提供。