azure - 如何在 Azure AppInsights 中对自定义指标进行百分位数?

标签 azure azure-application-insights prometheus azure-log-analytics azure-monitoring

我使用Prometheus来存储performance metrics并以百分位数形式查询结果(例如第 95 个百分位数响应时间)。我用过prometheus-net发射它们。

Azure AppInsights 中的等效项是什么?

我看到有percentile functions在 AppInsights/Kusto 中,但是当我使用 GetMetric("blah").TrackValue(42) 时,它会存储 Count、Min、Max、Sum 和 StdDev,这不是我在 Prometheus 中习惯的直方图分桶方法。

for(int i=0; i < 500; i++) {
  //Write some metrics
  telemetryClient.GetMetric("blah").TrackValue(42); //real data isn't constant
}
customMetrics
| where name == "blah" 
//| summarize avg(value), percentiles(value, 50, 95)  by bin(timestamp, 2m)

这是我用随机值记录的一些数据。值列是总和,这是不正确的,所以我不知道如何正确地对此数据进行百分位数。 enter image description here

最佳答案

GetMetric().TrackValue() API 与默认聚合一起使用时,不会存储每个单独的值,1 分钟后会生成一个值,并将该值与总和/计数一起发送到 AI/最小/最大/...分布。因此,稍后无法在 Analytics 中绘制原始数据点的百分位数。

目前,GetMetric().TrackValue() API 可用的聚合很少,直方图/tdigest 不是其中之一。您可以在 AI SDK GitHub repository 上提交功能请求(或贡献) .

目前的解决方法是使用旧版 API,默认情况下提交时间点指标而不进行聚合:TrackMetric()TrackEvent( 中的一系列测量值) )。这将增加发送的遥测项目的数量(每个指标将单独发送,无需 1 分钟聚合值),但这将为您提供每个值,以便在必要时在 Analytics 中执行百分位数聚合。

关于azure - 如何在 Azure AppInsights 中对自定义指标进行百分位数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58124268/

相关文章:

prometheus - 为什么 Grafana 在仪表板上复制图例,但在资源管理器模式下不复制?

python - 面临导入错误: DLL load failed while implementing Microsoft azure iothub_service_client

azure - 如何从 Azure 门户删除 Web App 的应用程序洞察监控(取消映射)?

Azure RemoteApp 安全问题

azure - Application Insights 采样会采样掉异常吗?

Azure 函数请求跟踪

docker - 无法使用 docker-compose 文件启动 prometheus。总是抛出错误/etc/prometheus/prometheus.yaml : no such file or directory

kubernetes - 如何在 CustomResourceDefinitions 更改后更新资源

windows azure 上的 python 云应用程序

.net - 无法使用 Azure DevOps API 获取最新版本