Azure AppInsights 自定义 RequestTelemetry 属性

Azure AppInsights Custom RequestTelemetry Properties

我正在向 RequestTelemetry 对象添加一些自定义属性,如下所示

Java 网络应用程序

RequestTelemetry.getProperties.put(键,值);

但是门户中没有反映出来。

所以我创建了一个新的 telemetryClient 并调用了 telemettyClient.trackRequest() 但它在门户中创建了一个重复的请求条目。

有没有办法在不复制遥测对象的情况下实现同样的效果。

TIA

有一个 HttpContext 扩展方法可以获取当前请求遥测数据:

System.Web.HttpContextExtension.GetRequestTelemetry

https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/master/Src/Web/Web.Shared.Net/HttpContextExtension.cs

您可以使用它来根据特定请求设置属性。

或者,您可以实现一个 TelemetryInitializer,允许您将更多 properties/etc 附加到正在生成的任何和所有遥测数据,然后只查看经过的 RequestTelemetry 项。

遥测模块是我们访问 AI Java SDK 中的 http 请求响应对象的唯一地方。这是我写的一篇博客,解释了如何通过请求遥测发送自定义 http 数据

https://dtechonline.wordpress.com