build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /sdk/metric build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/otlp/otlptrace/otlptracegrpc build(deps): bump codecov/codecov-action from 3.1.5 to 4.1.0 build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/zipkin build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /metric build(deps): bump github.com/prometheus/client_golang from 1.18.0 to 1.19.0 in /example/prometheus build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/stdout/stdouttrace build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/otlp/otlptrace/otlptracehttp build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/otlp/otlptrace build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /trace build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/stdout/stdoutmetric build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /bridge/opentracing build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /schema build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /log build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /sdk build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /bridge/opencensus build(deps): bump go.opentelemetry.io/build-tools/gotmpl from 0.12.0 to 0.13.0 in /internal/tools build(deps): bump go.opentelemetry.io/build-tools/multimod from 0.12.0 to 0.13.0 in /internal/tools build(deps): bump go.opentelemetry.io/build-tools/dbotconf from 0.12.0 to 0.13.0 in /internal/tools build(deps): bump go.opentelemetry.io/build-tools/semconvgen from 0.12.0 to 0.13.0 in /internal/tools build(deps): bump go.opentelemetry.io/build-tools/crosslink from 0.12.0 to 0.13.0 in /internal/tools build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/otlp/otlpmetric/otlpmetrichttp build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /bridge/opentracing/test build(deps): bump github.com/prometheus/client_golang from 1.18.0 to 1.19.0 in /exporters/prometheus build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /exporters/prometheus
"Passthrough" setup for OpenTelemetry
Some Go programs may wish to propagate context without recording spans. To do this in OpenTelemetry, simply install TextMapPropagators
, but do not install a TracerProvider using the SDK. This works because the default TracerProvider implementation returns a "Non-Recording" span that keeps the context of the caller but does not record spans.
For example, when you initialize your global settings, the following will propagate context without recording spans:
// Setup Propagators only
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
But the following will propagate context and create new, potentially recorded spans:
// Setup SDK
exp, _ := stdout.New(stdout.WithPrettyPrint())
tp = sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exp),
)
otel.SetTracerProvider(tp)
// Setup Propagators
otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))
The Demo
The demo has the following call structure:
Outer -> Passthrough -> Inner
If all components had both an SDK and propagators registered, we would expect the trace to look like:
|-------outer---------|
|-Passthrough recv-|
|Passthrough send|
|---inner---|
However, in this demo, only the outer and inner have TracerProvider backed by the SDK. All components have Propagators set. In this case, we expect to see:
|-------outer---------|
|---inner---|