我想形成一个 KQL 查询来确定给定时间内特定 API 请求的最大 RPS。 例如:确定 App Insights 中特定 API 在 2 个月内的最大 RPS。 我能够确定平均 RPS,但这仅适用于相对较短的持续时间(以秒为单位)。
假设您在 Application Insights 中使用
requests
表,则构建查询的方法如下:
requests
| where timestamp > ago(2m) // Filter to consider the last 2 months.
| where url contains "/your-api-endpoint-path" // Modify this with your specific API endpoint or path.
| summarize CountPerSecond = count() by bin(timestamp, 1s)
| order by CountPerSecond desc
| take 1