1

我正在尝试在 Application Insights 中制作一个图表,以绘制每次调用我的 API 时执行的特定操作的数量,并按执行它的语言分组。我添加了以下遥测事件:

telemetryClient.TrackEvent("Count event", 
            properties:new Dictionary<string, string>(){{"language", language}}, 
            metrics:new Dictionary<string, double>(){ {"messageCount", operationCount } } );

在指标资源管理器中,当我按我的事件名称过滤时,我可以根据需要按语言分组。当事件显示为日志条目时,我可以在事件的 CustomData 中看到 operationCount 值,但我无法在图表中显示该值。我只能选择汇总 Sum,这是调用我的 API 的次数的计数:

在此处输入图像描述

有什么方法可以制作一个图表,其中 operationCount 值作为 y 轴,时间作为 x 轴,按语言拆分?

4

1 回答 1

3

您应该能够使用 Application Insights Analytics 完成此操作(然后在需要时固定到仪表板)。

下面是具有 10m 桶的按语言划分的面积图:

customEvents
| where timestamp > ago(1d)
| extend language = tostring(customDimensions.language)
| summarize sum(todouble(customMeasurements.messageCount)) by language, bin(timestamp, 10m)
| render areachart 
于 2018-02-27T17:18:31.493 回答