1

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?

Anouar
  • 42
  • 1
  • 13

1 Answers1

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.

Danny Dyla
  • 631
  • 4
  • 15
  • what do you mean by a custom sampler? use sdk manual instrumentation? – Anouar Mar 31 '23 at 21:51
  • I did take a look at https://opentelemetry.io/docs/concepts/sampling/ and Head Sampling is your suggestion? – Anouar Apr 03 '23 at 10:56
  • Yes with head sampling you can prevent the spans from being collected and exported. Your sampler can use any mechanism. Some form of probability is common, but you could also create a sampler which switches between always on and always off using any mechanism you like such as JMX. – Danny Dyla Apr 03 '23 at 16:03