Skip to content

internal/trace: back using OpenTelemetry span instead of OpenTracing

Administrator requested to merge otel-default-trace-pkg into main

Created by: bobheadxi

Now that we export to Jaeger via OpenTelemetry instead of OpenTracing, we can remove a number of OpenTracing-specific things internally and instead operate purely on OpenTelemetry within internal/trace. OpenTracing calls elsewhere are all translated to OpenTelemetry via the OpenTracing bridge.

This allows us to start leveraging OpenTelemetry APIs more extensively - the codebase can now directly use go.opentelemetry.io/otel/trace, and internal/trace has been updated with the addition of:

  • (*internal/trace.Trace).AddEvent - this is similar to LogFields, but now accepts a name in the OpenTelemetry spec
  • (*internal/trace.Trace).SetAttributes - this is similar to TagFields, but uses the OpenTelemetry attributes API

And the deprecation of:

  • (*internal/trace.Trace).LogFields (use AddEvent instead)
  • (*internal/trace.Trace).TagFields (use SetAttributes instead)

As well as the removal of some old adapters that were specific to OpenTracing.

Deprecated APIs will still work, passing through to the updated APIs.

Builds on top of #40709

Test plan

sg run jaeger
sg start

In jaeger tracing mode, we should see spans as expected:

image

Merge request reports

Loading