通过 API 检索 Azure AppInsights 实时指标

Retrieve Azure AppInsights Live Metrics through API

有一个一年前的问题 How can I retrieve through an API *Live Metrics* of Microsoft Application Insights 关于是否可以通过一些 API

提取 appInsights 为应用程序生成的 LiveMetrics 数据

现在我在官方文档中没有看到任何与实时相关的内容 - https://dev.applicationinsights.io/reference。老问题的答案也是没有任何办法得到它们。

但也许有人知道今年 AppInsights 团队的计划是否发生了变化并且他们正在努力API?

通过 API 实时提取数据到自己的 alerting\metrics 系统来处理来自不同 microservices\applications 的数据并以聚合方式实时显示它们可能真的很有用。 例如,我们可以构建类似 OpServer has but based on different applications and their AppInsights data .

的东西

因为现在没有办法得到它

注意:我在 Microsoft 的 Application Insights 团队工作。

LiveMetrics 数据不会永久存储在任何地方,也没有 API 可以检索它。只有当有人活跃在 Live Metrics 门户页面上时,才会收集数据。浏览器 window 关闭时,数据也随之消失。

如果您的目标是实时获得 metrics/other,那么您可以通过实现自己的 ITelemetryProcessor 来实现。大多数人使用 ITelemetryProcessor 来 "filter" 排除不需要的遥测。但这不是规则。所有遥测都通过 TelemetryProcessor,您可以选择过滤数据或对其执行其他操作。在你的情况下,你想立即将它发送到一些实时服务。事实上,LiveMetrics(内部称为 QuickPul​​se)是作为 TelemetryProcessor 实现的。 (https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/WEB/Src/PerformanceCollector/Perf.Shared/QuickPulseTelemetryProcessor.cs#L158)

关于 TelemetryProcessor 的一般文档: https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-filtering-sampling#create-a-telemetry-processor-c