Add an option to use Opentelemetry tracing, support zipkin + otlp #19505
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#10545
This PR allows using Opentelemetry to export traces thanks to [opentracing-bridge]
(https://pkg.go.dev/go.opentelemetry.io/otel/bridge/opentracing).
I initially wanted to remove all the opentracing things but it is not that easy if we want all the plugins built with the older version of the Go sdk to still have working tracing.
So in the end I used the bridge and introduced an environment variable to use Opentelemetry tracing, with either zipkin to stay compatible with the old tracing, and otlp that is very convenient to send traces to any backend.
When using
OPENTELEMETRY_INSTRUMENTATION
env var it will fully work only if the plugins are built with the latest version of the SDK, if that variable is not set nothing changed.Note: For Zipkin exporter with Opentelemetry we need to use the v2 trace endpoint, otherwise it works, but traces have an empty service name
Validated the behavior with Jaeger UI, the traces emitted by Opentelemetry instrumentation are similar to the ones emitted by Opentracing. I also tried the OTLP exporter and was able to export my trace to an Otel collector