Day 104: OpenTelemetry SDK basics
OpenTelemetry: one instrumentation standard, many backends
Before OpenTelemetry, instrumenting an app for tracing meant coupling your code to a specific vendor's SDK (Jaeger's client, a proprietary APM's agent). OpenTelemetry (OTel) is a vendor-neutral standard: instrument once with the OTel SDK, and send data to whichever backend you choose (or switch later) without re-instrumenting.
const span = tracer.startSpan('processOrder');
try {
await chargeCard(order);
await saveOrder(order);
} finally {
span.end();
}A span represents one unit of work with a start/end time; spans are linked into a trace representing one full request's journey across services. Auto-instrumentation libraries handle most common cases (HTTP calls, database queries) without manual span creation.
Key terms
- Span
- A single timed unit of work within a trace.
- Trace
- A collection of related spans representing one request's full journey.
Why is instrumenting an application with OpenTelemetry (rather than a vendor-specific SDK) valuable long-term?