ZeroTierOne/ext/opentelemetry-cpp-1.21.0/opentracing-shim
2025-07-11 10:37:21 -07:00
..
include/opentelemetry/opentracingshim add otel library to ext 2025-07-11 10:37:21 -07:00
src add otel library to ext 2025-07-11 10:37:21 -07:00
test add otel library to ext 2025-07-11 10:37:21 -07:00
BUILD add otel library to ext 2025-07-11 10:37:21 -07:00
CMakeLists.txt add otel library to ext 2025-07-11 10:37:21 -07:00
README.md add otel library to ext 2025-07-11 10:37:21 -07:00

C++ OpenTracing Shim

Apache License

An OpenTracing shim is a bridge layer from OpenTelemetry to the OpenTracing API. It takes an OpenTelemetry Tracer and exposes it as an implementation compatible with that of an OpenTracing Tracer.

Usage

Use the TracerShim wherever you initialize your OpenTracing tracers. There are 2 ways to expose an OpenTracing Tracer:

  1. From the global OpenTelemetry configuration:

    auto tracer_shim = TracerShim::createTracerShim();
    
  2. From a provided OpenTelemetry Tracer instance:

    auto tracer_shim = TracerShim::createTracerShim(tracer);
    

Optionally, one can also specify the propagators to be used for the OpenTracing TextMap and HttpHeaders formats:

OpenTracingPropagators propagators{
  .text_map = nostd::shared_ptr<TextMapPropagator>(new CustomTextMap()),
  .http_headers = nostd::shared_ptr<TextMapPropagator>(new trace::propagation::HttpTraceContext())
};

auto tracer_shim = TracerShim::createTracerShim(tracer, propagators);

If propagators are not specified, OpenTelemetry's global propagator will be used.

More information and help

License

Apache 2.0 - See LICENSE for more information.