Enable/disable programmatically opentelemetry exporters.

huangapple go评论63阅读模式
英文:

Enable/disable programmatically opentelemetry exporters

问题

我想要能够在需要进行故障排除时仅启用导出器的能力。禁用代理不合理,因为仪器化应在启动 JVM 时进行,所以我的想法是以禁用导出器的方式启动服务器,如下所示:

opentelemetry-javaagent.jar -Dotel.traces.exporter=none -Dotel.metrics.exporter=none

然后,通过 JMX 的某种方式,我们可以启用导出器。

有办法实现这一点吗?

英文:

I would like to have the ability to enable exporters only when needed for troubleshooting. Disabling the agent wouldn't make sense, since the instrumentation should happen when starting the jvm, so my idea is to start my server with disabled exporters like this:

> opentelemetry-javaagent.jar -Dotel.traces.exporter=none -Dotel.metrics.exporter=none

and then somehow with JMX we can enable the exporters.

Is there a way to achieve this?

答案1

得分: 2

我建议,与其禁用导出功能,不如创建一个自定义的采样器。你可以大部分时间将采样关闭,并在需要时启用它。这也能避免收集和处理跨度的开销。

英文:

I would suggest that instead of disabling the export, you make a custom sampler. You can have sampling turned off most of the time and enable it as you see fit. This also would avoid the overhead of collecting and processing spans.

huangapple
  • 本文由 发表于 2023年3月31日 23:50:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75900466.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定