jenkinsci/opentelemetry-plugin

Way to insert custom SpanProcessors and SpanExporters?

silmeth opened this issue · 2 comments

What feature do you want to see added?

Hi, I need to create Opentelemetry-like spans from Jenkins pipelines but also export start span events, before the spans are finished, to an external data store – thus I thought of extending this plugin by adding my own SpanProcessor which would send those events.

But since the plugin uses AutoConfigurationOpenTelemetrySdk, the only non-hacky way to do that, that I can think of, is to set that by hand in the Configuration Properties field (if adding a new SpanProcessor is even possible there?), and I’d rather have this happen automatically when my plugin is enabled, without manual tweaks by the user.

Is it possible for the opentelemetry-plugin to provide some sort of extension point/other API that would allow one to inject additional span processors and span exporters?

(What I’m thinking of doing instead now is basically just copying the whole logic of the listeners in opentelemetry plugin to create my own spans using otel SDK, but using my own tracer instead. I could also hack around the opentelemetry-plugin, replacing the tracer,by calling afterSdkInitialized() again on all the OtelComponents ­– but that’s very hacky and would break the plugin’s functionality. I’d much rather just add another processor that exports the events as they appear, and perhaps another exporter with a separate configuration.)

Upstream changes

No response

Could you please engage with the OpenTelemetry Auto Configure to get the enhancement done upstream?
Once The AutoConfigureSDK exposes such a capability, we will be happy to make use of it in the Jenkins OpenTelemetry plugin.