Azure AppInsight - 我的自定义属性在哪里?

Azure AppInsight - Where is my custom attributes?

提问人:Farid 提问时间:11/7/2023 最后编辑:Farid 更新时间:11/20/2023 访问量:84

问:

我正在使用 OpenTelemetry,并尝试将自定义属性添加到当前 Span,我可以看到该属性(user.name,user.role)显示为跟踪的一部分:

// This is a sample trace coming from console exporter
Activity.TraceId:            1be70cf887cbde79d34d55e79642a9ee
Activity.SpanId:             4a40500a30985ff2
// Yada yada
Activity.Tags:
    net.host.name: localhost
    net.host.port: 7253
    // The next 2 are my custom attributes
    user.name: Ahamat, Farid
    user.role: Guest, Officer
    http.status_code: 200
Resource associated with Activity:
    // Yada yada

但我无法了解如何在 Azure App Insight 中查看此自定义属性。有人知道吗?

这里必须强调的是,我使用的是 OpenTelemetry。我没有使用 AppInsight SDK。

.NET Azure Open-Telemetry AppInsights

评论

0赞 Pavan 11/7/2023
你能分享你尝试过的代码吗?
0赞 Farid 11/7/2023
这与代码无关。这是关于尝试找出 AppInsight 如何/在何处显示我创建的自定义属性。
0赞 Pavan 11/7/2023
明白了,只是为了确认,您是否在本地配置了自定义属性?
0赞 Farid 11/7/2023
是的。跟踪显示自定义属性。我上面展示的那个:这是我生成的跟踪,它有我的属性。

答:

1赞 SaiVamshiKrishna 11/14/2023 #1
  • 使用 Azure Application Insight。自定义属性和在 Application Insights 中查询自定义数据

  • 代码取自参考 MSDOC

这是我添加自定义属性的方式。
enter image description here

  • 自定义 attribe 的日志通过请求查询找到
  • 在 Application Insights 中,搜索日志,在日志中运行requests

enter image description here

  • 也可以在请求的“交易搜索”中找到端到端交易详细信息
  • 您可以找到与触发的时间间隔相对应的属性详细信息。

enter image description here