我使用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)
最佳答案
当 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/