mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-12-10 09:50:58 +02:00
1cbd4c2b77
Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/internal/retry Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlpmetric/otlpmetrichttp Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /schema Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/zipkin Bump github.com/openzipkin/zipkin-go from 0.4.0 to 0.4.1 in /exporters/zipkin Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/zipkin Bump google.golang.org/grpc from 1.46.2 to 1.50.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump google.golang.org/grpc from 1.46.2 to 1.50.1 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.27.1 to 1.28.1 in /exporters/otlp/otlpmetric Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/otlp/otlptrace Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlptrace Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/otlp/otlpmetric Bump google.golang.org/grpc from 1.42.0 to 1.50.1 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/stdout/stdouttrace Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/prometheus Bump google.golang.org/protobuf from 1.28.0 to 1.28.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlpmetric Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump google.golang.org/grpc from 1.46.2 to 1.50.1 in /exporters/otlp/otlptrace/otlptracegrpc Bump go.uber.org/goleak from 1.1.12 to 1.2.0 in /exporters/otlp/otlptrace/otlptracegrpc Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /exporters/jaeger Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /trace Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/jaeger Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /metric Bump github.com/stretchr/testify from 1.7.1 to 1.8.0 in /exporters/otlp/otlptrace/otlptracehttp Bump github.com/google/go-cmp from 0.5.8 to 0.5.9 in /trace Co-authored-by: Aneurysm9 <Aneurysm9@users.noreply.github.com> |
||
---|---|---|
.. | ||
internal | ||
migration | ||
bridge_test.go | ||
bridge.go | ||
doc.go | ||
go.mod | ||
go.sum | ||
mix_test.go | ||
README.md | ||
util.go | ||
wrapper.go |
OpenTelemetry/OpenTracing Bridge
Getting started
go get go.opentelemetry.io/otel/bridge/opentracing
Assuming you have configured an OpenTelemetry TracerProvider
, these will be the steps to follow to wire up the bridge:
import (
"go.opentelemetry.io/otel"
otelBridge "go.opentelemetry.io/otel/bridge/opentracing"
)
func main() {
/* Create tracerProvider and configure OpenTelemetry ... */
otelTracer := tracerProvider.Tracer("tracer_name")
// Use the bridgeTracer as your OpenTracing tracer.
bridgeTracer, wrapperTracerProvider := otelBridge.NewTracerPair(otelTracer)
// Set the wrapperTracerProvider as the global OpenTelemetry
// TracerProvider so instrumentation will use it by default.
otel.SetTracerProvider(wrapperTracerProvider)
/* ... */
}
Interop from trace context from OpenTracing to OpenTelemetry
In order to get OpenTracing spans properly into the OpenTelemetry context, so they can be propagated (both internally, and externally), you will need to explicitly use the BridgeTracer
for creating your OpenTracing spans, rather than a bare OpenTracing Tracer
instance.
When you have started an OpenTracing Span, make sure the OpenTelemetry knows about it like this:
ctxWithOTSpan := opentracing.ContextWithSpan(ctx, otSpan)
ctxWithOTAndOTelSpan := bridgeTracer.ContextWithSpanHook(ctxWithOTSpan, otSpan)
// Propagate the otSpan to both OpenTracing and OpenTelemetry
// instrumentation by using the ctxWithOTAndOTelSpan context.