【发布时间】:2019-11-11 15:33:07
【问题描述】:
我正在向 Azure 报告一些自定义事件,自定义事件中有一个值保存在名为“totalTime”的 customMeasurements 对象下。
事件本身如下所示:
loading-time: {
customMeasurements : {
totalTime: 123
}
}
我正在尝试创建一个图表,显示每小时报告给 azure 的所有事件的平均总时间。所以我需要能够收集和平均事件中的值。
我似乎不知道如何从 Azure AppInsights Analytics 中访问 customMeasurements 值。这是 Azure 提供的一些代码。
union customEvents
| where timestamp between(datetime("2019-11-10T16:00:00.000Z")..datetime("2019-11-11T16:00:00.000Z"))
| where name == "loading-time"
| summarize Ocurrences=count() by bin(timestamp, 1h)
| order by timestamp asc
| render barchart
此代码仅计算过去 24 小时内报告的事件数并按小时显示。
我已尝试通过执行访问事件中保存的 customMeasurements 对象
summarize Occurrences=avg(customMeasurements["totalTime"])
但 Azure 不喜欢这样,所以我做错了。如何访问我需要的值?我似乎也找不到任何文档。
【问题讨论】:
标签: azure azure-application-insights