首页 > Java > java教程 > 如何发布用于 opentelemetry/honeycomb 的 JetBrains Rider 插件

如何发布用于 opentelemetry/honeycomb 的 JetBrains Rider 插件

DDD
发布: 2024-10-23 06:07:30
原创
365 人浏览过

How to publish JetBrains Rider plugin for opentelemetry/honeycomb

两周前我有机会与 honeycomb.io 合作,主要是我正在更改发送数据的代码 appinsights azre 现在也需要将数据发送到 honeycomb。虽然不太复杂,但是很难捕捉到这些
记录行并确保我们是否正确调用端点以及发送了哪些数据。 appinsights 有一个很棒的插件 https://github.com/Socolin/ApplicationInsightsRiderPlugin 但没有可以显示 opentelemetry 调用的插件,是的 honeycomb.io 使用 OTEL 协议意味着 opentelemetry 现在是可观察性的行业标准。

所以我需要学习如何查看 opentelemetry 调试日志,这不容易配置,因为 opentelemetry API 要求你配置控制台导出器,它会在日志中显示一些数据,如下所示

Activity.TraceId:            39de3d235089b014c5e37abefdc3a7f8
Activity.SpanId:             03ae17902e901577
Activity.TraceFlags:         Recorded
Activity.ActivitySourceName: Microsoft.AspNetCore
Activity.DisplayName:        GET Hello
Activity.Kind:               Server
Activity.StartTime:          2024-10-06T21:53:05.9553689Z
Activity.Duration:           00:00:00.2187686
Activity.Tags:
server.address: localhost
server.port: 8080
http.request.method: GET
url.scheme: http
url.path: /Hello
network.protocol.version: 1.1
user_agent.original: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
http.route: Hello
http.response.status_code: 200
Resource associated with Activity:
service.name: my-service-name
telemetry.sdk.name: opentelemetry
telemetry.sdk.language: dotnet
telemetry.sdk.version: 1.9.0
登录后复制

这需要更改为 json 以便我解析它并在骑手调试窗口中更好地显示它,所以我编写了这个新的导出器。

{"activity":{"traceId":"b49d03d8b55c2f8dfc9f385b3191fdee","spanId":"47c531f9a5a32dca","activityTraceFlags":"Recorded","parentSpanId":"0000000000000000","activitySourceName":"Microsoft.AspNetCore","activitySourceVersion":"","displayName":"GET Hello","kind":"Server","startTime":"2024-10-06T21:54:22.8551436Z","duration":"00:00:00.0013247","tags":{"server.address":"localhost","server.port":"8080","http.request.method":"GET","url.scheme":"http","url.path":"/Hello","network.protocol.version":"1.1","user_agent.original":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0","http.route":"Hello","http.response.status_code":"200"},"statusCode":"Unset","events":[],"links":[],"resource":{"service.name":"my-service-name","telemetry.sdk.name":"opentelemetry","telemetry.sdk.language":"dotnet","telemetry.sdk.version":"1.9.0"},"rootId":"b49d03d8b55c2f8dfc9f385b3191fdee","operationName":"Microsoft.AspNetCore.Hosting.HttpRequestIn"}}
登录后复制

现在我有了 json 调试日志,我所需要的就是从 Socolin 的插件中删除 appinsights 并解析 opentelemetry json 并将其显示在调试窗口中。

在此处查看视频或屏幕截图

以上是如何发布用于 opentelemetry/honeycomb 的 JetBrains Rider 插件的详细内容。更多信息请关注PHP中文网其他相关文章!

来源:dev.to
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板