Azure App Insights查询请求计数与响应时间遇timestamp字段解析错误
问题解决:Kusto查询中'timestamp'列无法解析的错误
错误原因
你把时间过滤的where语句放在了summarize之后,但summarize操作会根据operation_Name聚合数据,聚合后的结果集里已经不存在timestamp列了,所以查询会报错找不到该列。正确的逻辑应该是先过滤时间范围,再进行聚合统计。
修正后的查询语句
let startDatetime = todatetime("2023-03-15 14:00:00.0"); let endDatetime = todatetime("2023-03-15 15:45:00.0"); requests | where timestamp > startDatetime and timestamp < endDatetime // 先过滤目标时间范围的原始数据 | summarize RequestsCount=sum(itemCount), AverageDuration=avg(duration), percentiles(duration, 50, 95, 99) by operation_Name | order by RequestsCount desc // 按请求数从高到低排序
逻辑说明
- 先通过
where筛选出指定时段的原始请求数据,确保后续聚合的是目标时间范围内的有效数据 summarize操作会按接口名称(operation_Name)分组,计算每组的请求总数、平均响应时间,以及响应时间的50/95/99分位数- 最后按请求总数降序排列结果,方便快速查看访问量最高的接口
内容的提问来源于stack exchange,提问作者Tech lover
相关产品推荐
相关产品推荐

