Practical introduction to OpenTelemetry tracing by Nicolas Frankel

Learn the core concepts of OpenTelemetry tracing, from auto-instrumentation to production deployment. Perfect for developers wanting to implement distributed tracing in their systems.

Key takeaways
  • OpenTelemetry is a standardized approach for distributed tracing across different technologies and components, merging OpenTracing and OpenCensus standards

  • Two main approaches to implement OpenTelemetry:

    • Auto-instrumentation (recommended for beginners) - uses runtime agents and requires no code changes
    • Manual instrumentation - requires adding dependencies and code but offers more control
  • Tracing concepts:

    • Traces follow requests across distributed system components
    • Spans represent units of work within components
    • Spans can have multiple children but only one parent
    • Context propagation happens via HTTP headers (W3C trace context)
  • For asynchronous messaging:

    • Need to pass trace context as metadata if supported
    • Manually extract/inject trace context if metadata not supported
    • Requires more manual work compared to HTTP
  • Key considerations for production:

    • Sampling is crucial - don’t trace every request
    • Start with low sampling rate (~10%) and increase based on confidence
    • Consider performance impact and storage costs
    • Configure proper centralized collection and storage
  • Compatible with multiple backends:

    • Can use Jaeger, Zipkin or any OpenTelemetry-compatible collector
    • Allows switching backends without changing application code
    • OpenTelemetry Collector can forward to multiple destinations
  • Structured logging is preferred over unstructured:

    • Produces data that can be directly indexed
    • Avoids complex parsing and transformation
    • More efficient for centralized logging systems