OpenTelemetry oslo.log Instrumentation
OpenStack oslo.log instrumentation for OpenTelemetry.
oslo.log builds on top of the standard library logging module. This
instrumentor exports OpenStack service logs through the OpenTelemetry logs
pipeline (and onward to an OTLP collector) while keeping them correlated with
traces. On instrument() it:
- injects the OpenTelemetry attributes
otelTraceID,otelSpanID,otelTraceSampledandotelServiceNameonto every log record, so they are available to oslo.log'sContextFormatterformat strings; - installs an
OsloLogHandleron oslo.log's root logger so records are exported through the configuredlogger_provider(disable withenable_log_auto_instrumentation=False); - maps oslo request context (request id, user/project ids, ...) onto exported
record attributes (disable with
map_oslo_context=False).
The exported log body is the raw log message; structured fields travel as attributes.
Correlation across threads/greenthreads: the trace a record is correlated to comes from the current OpenTelemetry context, which lives in a
contextvars.Contextthat Python does not copy into worker threads or greenthreads. A record logged off the request thread would otherwise exporttrace_id/span_idas0— the common cause of "my oslo.log records have no trace id" in OpenStack. Enableopentelemetry-instrumentation-oslo-service, which carries the context across oslo.service's concurrency primitives (threading.Thread,futuristpools, and eventlet spawns).
oslo_log.log.setup rebuilds the root logger's handlers from oslo.config,
dropping every existing handler. The instrumentor wraps setup so the
exporting handler is re-attached afterwards, and keeps working even when
setup runs (or runs again) after instrument().
Note: the handler is attached to oslo.log's root logger, not the stdlib root logger. Records from non-oslo libraries that log straight to the stdlib root are handled by
opentelemetry-instrumentation-logging, not this package.
Usage
from opentelemetry.instrumentation.oslo_log import OsloLogInstrumentor
OsloLogInstrumentor().instrument(logger_provider=logger_provider)
To surface the injected trace context in oslo.log output, reference the fields
from logging_context_format_string / logging_default_format_string in your
oslo.config:
[DEFAULT]
logging_default_format_string = %(asctime)s %(levelname)s %(name)s [trace_id=%(otelTraceID)s span_id=%(otelSpanID)s] %(message)s
logging_context_format_string = %(asctime)s %(levelname)s %(name)s [%(request_id)s trace_id=%(otelTraceID)s span_id=%(otelSpanID)s] %(message)s
Exported context attributes
When map_oslo_context is enabled (the default), the following oslo request
context fields are mapped onto exported log record attributes:
| oslo context value | exported attribute |
|---|---|
request_id |
openstack.request_id |
global_request_id |
openstack.global_request_id |
user |
openstack.user_id |
user_name |
openstack.user_name |
project |
openstack.project_id |
project_name |
openstack.project_name |
domain |
openstack.domain_id |
user_domain |
openstack.user_domain_id |
project_domain |
openstack.project_domain_id |
roles |
openstack.roles |
resource_uuid |
openstack.resource_uuid |
Authentication tokens are never exported.
Metadata
Release files for opentelemetry-instrumentation-oslo-log 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opentelemetry_instrumentation_oslo_log-0.14.0.tar.gz | 8.2 kB | With provenance | Details for opentelemetry_instrumentation_oslo_log-0.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opentelemetry_instrumentation_oslo_log-0.14.0-py3-none-any.whl | Python 3 | none | any | Details for opentelemetry_instrumentation_oslo_log-0.14.0-py3-none-any.whl |
Total release size: 16.7 kB
Release files / opentelemetry_instrumentation_oslo_log-0.14.0.tar.gz
| Download URL | opentelemetry_instrumentation_oslo_log-0.14.0.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a0d8f61d669b9ed4bbd802a172dfdf461b57bdcae99dbacc3c36850b172762d
|
|
BLAKE2b-256 checksum How to use checksums |
0447baac16f9abde0c7e2c03960874a1bef5ab0c2d262091a56c4d22112affbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / opentelemetry_instrumentation_oslo_log-0.14.0-py3-none-any.whl
| Download URL | opentelemetry_instrumentation_oslo_log-0.14.0-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91fa6cce8d1e836fd04211a3dad96f6b173b29abc853d95408381713ffe3d930
|
|
BLAKE2b-256 checksum How to use checksums |
ad01a1a7fb1a0d91d89f09d614a9c396975fe5acb82448760d8c678e9859e748
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for opentelemetry-instrumentation-oslo-log 0.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for opentelemetry_instrumentation_oslo_log-0.14.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.