| name | opentelemetry-python-1-41-0 |
| description | OpenTelemetry Python toolkit for distributed tracing, metrics collection, and log management with OTLP exporters, automatic instrumentation, custom sampling, and context propagation. Use when instrumenting Python applications for observability, configuring trace/metric/log pipelines, setting up OTLP exporters, or integrating with distributed tracing backends like Jaeger, Zipkin, or Prometheus. |
| license | MIT |
| author | Tangled <noreply@tangledgroup.com> |
| version | 0.1.0 |
| tags | ["opentelemetry","observability","tracing","metrics","logging","distributed-tracing","otel","python"] |
| category | observability |
| external_references | ["https://github.com/open-telemetry/opentelemetry-python/tree/v1.41.0","https://github.com/open-telemetry/opentelemetry-python-contrib","https://github.com/open-telemetry/opentelemetry-specification","https://opentelemetry-python.readthedocs.io/","https://opentelemetry.io/ecosystem/registry/?component=instrumentation&language=python","https://opentelemetry.io/docs/languages/python/"] |
OpenTelemetry Python 1.41.0
Overview
OpenTelemetry Python is the official Python implementation of the OpenTelemetry observability framework. Version 1.41.0 provides stable support for traces and metrics, with logs in development status. It consists of two main packages: opentelemetry-api (abstract interfaces and no-op implementations) and opentelemetry-sdk (the reference SDK implementation). Libraries should depend only on the API package, while applications choose and configure the SDK.
The project follows the OpenTelemetry specification and supports three telemetry signals:
- Traces — Stable. Distributed request tracing with spans, span processors, sampling, and exporters.
- Metrics — Stable. Synchronous and asynchronous instruments (Counter, UpDownCounter, Histogram, Gauge, Observable variants) with MetricReader-based architecture.
- Logs — Development status. LoggerProvider/Logger API with LogRecord, SeverityNumber, and bridge to Python's standard
logging module via LoggingHandler.
When to Use
- Instrumenting Python applications for distributed tracing (HTTP servers, databases, message queues)
- Setting up metrics collection with counters, histograms, gauges, and up-down counters
- Configuring OTLP exporters to send telemetry to backends (Jaeger, Zipkin, Prometheus, OpenTelemetry Collector)
- Implementing custom samplers or span processors for fine-grained control
- Propagating trace context across service boundaries using W3C TraceContext and Baggage
- Using auto-instrumentation for frameworks like Flask, Django, FastAPI, SQLAlchemy, Redis, and more
- Building observability pipelines following the OpenTelemetry 1.55.0 specification
- Integrating with Python's standard
logging module for structured log correlation with traces
Core Concepts
Signals: OpenTelemetry collects three types of telemetry — traces (request flows), metrics (numerical measurements), and logs (structured event records). Each signal has its own Provider, instrument type, and exporter.
API vs SDK: The API package (opentelemetry-api) defines abstract interfaces. The SDK package (opentelemetry-sdk) provides the reference implementation. Libraries depend on API only; applications configure the SDK.
Context Propagation: Trace context flows through opentelemetry.context.Context objects, implicitly propagated via thread-local storage or explicitly passed. W3C TraceContext and Baggage propagators handle cross-process context transfer via HTTP headers.