OpenTelemetry oslo.service Instrumentation
OpenStack oslo.service instrumentation for OpenTelemetry.
oslo.service is OpenStack's service framework: it launches services and runs
their background work (ThreadGroup, looping/periodic calls, RPC servers) on
either a threading or an eventlet backend. This instrumentor emits no
telemetry of its own — it makes the active trace context survive the
concurrency boundaries oslo.service introduces, so spans and oslo.log records
created in spawned work stay correlated with the request that spawned them.
The trace a record/span is correlated to comes from the current OpenTelemetry
context, which lives in a contextvars.Context. Python does not copy that
context into new threads or greenthreads, so work handed to a worker would
otherwise start on a fresh, disconnected trace (or export trace_id/span_id
as 0).
On instrument() it:
- selects the oslo.service backend (threading by default) unless the host has
already chosen one — set
OTEL_PYTHON_OSLO_SERVICE_BACKEND=threading|eventletor passbackend="..."; - propagates the active context across oslo.service's concurrency primitives.
What gets propagated
| Backend | Primitive | Wrapped |
|---|---|---|
| threading | ThreadGroup.add_thread (a threading.Thread per task) |
threading.Thread.start / run |
| threading | looping / periodic calls (a futurist pool) |
futurist.ThreadPoolExecutor.submit |
| eventlet | greenthreads (ThreadGroup, hand-offs) |
eventlet.spawn / spawn_n / spawn_after, GreenPool.spawn / spawn_n, futurist.GreenThreadPoolExecutor.submit |
Not covered:
- stdlib
concurrent.futuresthread pools — enableopentelemetry-instrumentation-threading; threading.Timer/Threadsubclasses that overriderun, and cross-process (ProcessPoolExecutor) work.
Note: this context propagation previously lived in the oslo.messaging (eventlet spawns) and oslo.log (threads/futurist) instrumentors. It is consolidated here so it is defined once and benefits every OpenStack service, regardless of which of those instrumentors it also enables.
Usage
from opentelemetry.instrumentation.oslo_service import OsloServiceInstrumentor
OsloServiceInstrumentor().instrument()
To pair with log/trace instrumentation, enable it alongside the others (order does not matter):
OsloServiceInstrumentor().instrument()
OsloMessagingInstrumentor().instrument(tracer_provider=tracer_provider)
OsloLogInstrumentor().instrument(logger_provider=logger_provider)
Auto-instrumentation
Under opentelemetry-instrument, this package also ships an OpenTelemetry
distro and configurator so the instrumentor is enabled without any code change.
Eventlet monkey-patching
Services that run on the eventlet backend must monkey-patch the stdlib
before anything imports socket, threading, etc. — otherwise the patch is
partial and context propagation across greenthreads is unreliable. The
configurator can do this for you, at the earliest point in the
auto-instrumentation startup, when you opt in:
export OTEL_PYTHON_CONFIGURATOR=oslo_service
export OTEL_PYTHON_EVENTLET_MONKEY_PATCH=true
opentelemetry-instrument <your-service>
OTEL_PYTHON_EVENTLET_MONKEY_PATCH=truetells the configurator to calleventlet.monkey_patch(). (eventletmust be installed; if it is not, a warning is emitted and startup continues unpatched.)OTEL_PYTHON_CONFIGURATOR=oslo_serviceis required. Auto-instrumentation loads only one configurator, and the stockopentelemetry-distroone is otherwise selected first — so without this the oslo.service configurator (and the monkey-patch) is silently skipped.
If you don't run on eventlet, neither variable is needed.
Release files for opentelemetry-instrumentation-oslo-service 0.12.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opentelemetry_instrumentation_oslo_service-0.12.1.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentelemetry_instrumentation_oslo_service-0.12.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / opentelemetry_instrumentation_oslo_service-0.12.1.tar.gz
| Download URL | opentelemetry_instrumentation_oslo_service-0.12.1.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f873d00cfb991a05e79fbb2ba01e66989b7406bbff0576597e1042aceca72f99
|
|
BLAKE2b-256 checksum How to use checksums |
3759a3a0a76337d59c18fd479959a0465996bfdc932acb0b29cba6ca353f428e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 14, 2026.
Transparency logRelease files / opentelemetry_instrumentation_oslo_service-0.12.1-py3-none-any.whl
| Download URL | opentelemetry_instrumentation_oslo_service-0.12.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b97ace8ff5fe9d0f4bf18c5cd836716cdf93685e255db547a12c19e45bdeeb9
|
|
BLAKE2b-256 checksum How to use checksums |
3f97654ddc833dd237addd2eb6929546f3c981501396c4b1c5d32330cdef9213
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 14, 2026.
Transparency log