OpenTelemetry Python
Backend & InfraOpenTelemetry Python API and SDK
Release History
v1.39.11 fixThis is a patch release fixing an issue related to silencing events API warnings for internal users.
v1.39.0Breaking1 fix2 featuresThis release introduces major breaking changes to the Logs API/SDK by removing LogData and renaming several Log classes to LogRecord, while also deprecating the Events API in favor of enhanced LogRecord usage.
v1.38.01 featureThis release extends the functionality of Logger.emit and introduces pre-commit checks for RST validity. It also adds deprecation warnings for upcoming class renames.
v1.37.03 fixes3 featuresThis release introduces experimental composite samplers and new environment variables for configuring OTLP exporter credentials during auto-instrumentation. It also includes several bug fixes related to log handling and performance improvements via caching.
v1.36.02 fixes1 featureThis release improves logging configuration stability by ensuring the OTLP LogHandler persists and fixes a potential deadlock. It also updates exporter shutdown behavior to enforce time limits and adds documentation for the Prometheus exporter.
v1.35.0Breaking6 fixes2 featuresThis release stabilizes the Log signal with several breaking changes and deprecations, including renaming `LogRecordProcessor.emit` to `on_emit` and deprecating explicit trace context arguments in favor of a context object for logging. It also updates OTLP exporters with improved timeout handling and jitter.
v1.34.11 fix1 featureThis is a patch release fixing an invalid mypy ignore directive and restoring the `span_exporter` property on `BatchSpanProcessor`.
v1.34.0Breaking1 fix2 featuresThis release drops support for Python 3.8, updates type checking mechanisms, and includes refactoring in log and span processors along with a fix for a shutdown recursion error.
v1.33.11 fixThis patch release fixes a critical issue in BatchLogRecordProcessor that caused crashes during shutdown by removing excessive log messages.
v1.33.0Breaking3 fixesThis release stabilizes code attribute names in the SDK, fixes several bugs related to HTTP connections and log serialization, and updates semantic conventions.
v1.32.11 fixThis is a patch release addressing issues found in the previous 1.32.0/0.53b0 version.
v1.32.05 fixesThis release focuses on bug fixes, including correcting the OTLP HTTP metrics exporter user agent and patching logging behavior, alongside performance improvements for baggage operations.
v1.31.11 fixThis patch release reverts a change regarding `BaseException` recording in `trace_api.use_span()` to fix an issue from the previous 1.31.0/0.52b0 release.
v1.31.04 fixes2 featuresThis release includes several bug fixes across OTLP encoding, Prometheus exporting, and configuration handling. It also introduces type annotations for context attachment/detachment and improves resilience when loading resource detectors.
v1.30.0Breaking2 fixes3 featuresThis release introduces support for Python 3.13, adds an attributes field to get_meter, and fixes serialization issues for None values in logs. A breaking change involves the removal of an incorrectly placed network attribute constant in semantic conventions.
Common Errors
ConnectionRefusedError2 reportsConnectionRefusedError in OpenTelemetry typically indicates that the target service (e.g., the collector) isn't running or is unreachable at the specified host and port. Verify the collector is running and accessible from the machine running your OpenTelemetry application; double-check the host and port configuration in your exporter to match the collector's listening address. Ensure no firewall rules are blocking communication between your application and the collector.
NewConnectionError2 reportsNewConnectionError usually indicates the exporter cannot connect to the specified backend endpoint. Verify the endpoint URL is correct and that the backend service is running and accessible from the host where the OpenTelemetry application is running; also ensure no firewall rules are blocking the connection. If you are only trying to disable exporting, explicitly set the exporter to `None` or remove its instantiation entirely.
MaxRetryError2 reportsMaxRetryError in OpenTelemetry often occurs when the exporter fails to connect to the backend (e.g., OTLP collector) due to network issues or incorrect endpoint configuration and repeatedly retries, exceeding the maximum retry attempts. To fix this, verify the backend address is correct and reachable from your application, and consider increasing the `OTEL_EXPORTER_OTLP_METRICS_RETRY_MAX_ATTEMPTS` or `OTEL_EXPORTER_OTLP_TRACES_RETRY_MAX_ATTEMPTS` environment variables to allow more retries, or implement exponential backoff with jitter in your exporter configuration for improved resilience. Additionally, examine backend logs to troubleshoot potential server-side issues preventing successful connection.
TelemetryOptionalImportError1 reportTelemetryOptionalImportError usually means you're trying to use a feature (like a specific exporter) that requires an optional dependency which hasn't been installed. Fix it by installing the missing dependency using `pip install <package_name>`, where `<package_name>` is the name of the optional package needed, often indicated in the traceback or documentation for the feature you're using (e.g., `pip install opentelemetry-exporter-otlp-proto-grpc` for the OTLP exporter). Rerun your code after installation.
ConnectionResetError1 reportConnectionResetError usually arises from the server prematurely closing the connection, often due to timeouts or resource limitations. Implement retry logic with exponential backoff for your OTLP exporter, and configure appropriate timeouts on both the client (OpenTelemetry SDK) and server (collector/backend) to ensure they are aligned and sufficiently long for your workload. Also investigate server-side logs to diagnose potential resource exhaustion or configured limits that might be triggering connection closures.
InvalidConfigError1 reportInvalidConfigError often arises from outdated or incompatible dependencies defined in your project's setup.py or pyproject.toml, especially conflicting versions of OpenTelemetry or tracing libraries. To resolve this, update your project's dependency specifications to use compatible and actively maintained versions of OpenTelemetry packages, and carefully manage version constraints to avoid conflicts, potentially using dependency management tools like pip-tools or Poetry.
Related Backend & Infra Packages
Production-Grade Container Scheduling and Management
Node.js JavaScript runtime ✨🐢🚀✨
Promise based HTTP client for the browser and node.js
A modern runtime for JavaScript and TypeScript.
Deliver web apps with confidence 🚀
Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
Subscribe to Updates
Get notified when new versions are released