需要从 Azure App Insights 中找到每个 API 调用的峰值使用情况

问题描述 投票:0回答:1

需要使用查询在 Azure App Insight 中查找给定日期中每个 API 的最大使用小时数。 例如

API A 在下午 1 点到 2 点之间的总命中率为 10,下午 2 点到下午 3 点为 20,下午 3 点到下午 4 点为 15

API B 在下午 1 点到 2 点之间的总命中率为 5,下午 2 点到下午 3 点为 8,下午 3 点到下午 4 点为 10

API C 在下午 1 点到 2 点之间的总命中率为 30,下午 2 点到下午 3 点为 12,下午 3 点到下午 4 点为 9

需要这样的结果。不希望哪个小时达到最大值,即使哪个小时也可以。

operation_Name 最大请求数
API A 20
API B 10
API C 30

requests
| summarize MaxRequestsCount=max(itemCount) by bin(timestamp, 1h) ,operation_Name 
| order by RequestsCount desc // order from highest to lower (descending)
azure azure-application-insights kql azure-monitoring
1个回答
0
投票

你非常接近 - 只需要在最后添加一个

project

requests
| summarize MaxRequestsCount=max(itemCount) by bin(timestamp, 1h) ,operation_Name 
| order by MaxRequestsCount // order from highest to lower (descending)
| project operation_Name, MaxRequestsCount
© www.soinside.com 2019 - 2024. All rights reserved.