应用程序洞察:计算 API 请求的最大 RPS

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

我想形成一个 KQL 查询来确定给定时间内特定 API 请求的最大 RPS。 例如:确定 App Insights 中特定 API 在 2 个月内的最大 RPS。 我能够确定平均 RPS,但这仅适用于相对较短的持续时间(以秒为单位)。

azure-application-insights azure-api-management
1个回答
0
投票

假设您在 Application Insights 中使用

requests
表,则构建查询的方法如下:

  1. 按您感兴趣的 API 端点或路径过滤数据。
  2. 以一秒的间隔对数据进行分箱。
  3. 计算每个 bin 中的请求数量。
  4. 返回最大计数。
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
© www.soinside.com 2019 - 2024. All rights reserved.