Why does OpenTelemetry separate the API from the SDK?
AdvancedConceptTracing & OpenTelemetry
Answer
So that libraries can depend on the API without forcing a telemetry implementation on the application.
- A library (an HTTP client, an ORM) calls the API to create spans. If the application never installs an SDK, the API is a no-op: near-zero overhead, no exporter, no surprises.
- The application owner chooses and configures the SDK: samplers, exporters, resource attributes.
- The API is kept very stable (backward compatible), while the SDK can evolve.
This is why it is safe for library authors to ship native OTel instrumentation and why you never call SDK classes from shared library code. It also lets you swap SDK configuration (or even a vendor distro) without recompiling libraries.
More on Tracing & OpenTelemetry
What is distributed tracing, and what are a trace, a span and a span context?BeginnerWhat fields does an OpenTelemetry span carry?BeginnerWhat are span kinds and why do they matter?IntermediateWhat does the W3C `traceparent` header look like?IntermediateWhat is baggage, and how is it different from span attributes?IntermediateWhat is OpenTelemetry and what are its main parts?Beginner