Skip to main content

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|eventlet or pass backend="...";
  • 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:

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, ssl, select, etc. — otherwise the patch is partial. A partial patch is not just a context-propagation problem: eventlet no longer owns the sockets, so a connection (e.g. the RabbitMQ transport) that a fork()-ing service — such as multi-backend cinder-volume under oslo.service ProcessLauncher — establishes gets inherited across the fork and shared between parent and child. oslo.messaging then logs "Process forked after connection established!" and message ACKs are lost.

To beat that race the patch is applied from the distro — the earliest in-process hook auto-instrumentation runs, before the SDK's OTLP exporter imports the socket stack — and again from the configurator before its own super()._configure(), so it is correct even with the stock distro. Opt in:

export OTEL_PYTHON_DISTRO=oslo_service
export OTEL_PYTHON_CONFIGURATOR=oslo_service
export OTEL_PYTHON_EVENTLET_MONKEY_PATCH=true
opentelemetry-instrument <your-service>
  • OTEL_PYTHON_EVENTLET_MONKEY_PATCH=true calls eventlet.monkey_patch() at the earliest point and pins OTEL_PYTHON_OSLO_SERVICE_BACKEND=eventlet so the backend matches the now-green stack. (eventlet must be installed; if it is not, a warning is emitted and startup continues unpatched.)
  • OTEL_PYTHON_DISTRO=oslo_service selects OsloServiceDistro, which is what makes the patch run early enough (before any exporter import). Without it only the configurator patches, which is later and may already be too late.
  • OTEL_PYTHON_CONFIGURATOR=oslo_service is set automatically by the distro; set it explicitly too if you are not using OTEL_PYTHON_DISTRO=oslo_service.

If you don't run on eventlet, none of these variables are needed.

Release files for opentelemetry-instrumentation-oslo-service 0.12.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentelemetry-instrumentation-oslo-service 0.12.4
File Size Uploaded
opentelemetry_instrumentation_oslo_service-0.12.4.tar.gz 12.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opentelemetry-instrumentation-oslo-service 0.12.4
File Interpreter ABI Platform
opentelemetry_instrumentation_oslo_service-0.12.4-py3-none-any.whl Python 3 none any Details

Total release size: 25.1 kB

Release files / opentelemetry_instrumentation_oslo_service-0.12.4.tar.gz

Download URL opentelemetry_instrumentation_oslo_service-0.12.4.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c1e1fc9fe2197a65b72bedd5c3578af81be6c424427edc2023cb6d1fa6abf23d
BLAKE2b-256 checksum
How to use checksums
e196db7fc13159616a36924cfbce27f8287c4d0e2225d2199a902d930406458c
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 18, 2026.

Transparency log

Release files / opentelemetry_instrumentation_oslo_service-0.12.4-py3-none-any.whl

Download URL opentelemetry_instrumentation_oslo_service-0.12.4-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ebcca8229ff824a8f6f6ccff330b779c1159b03d60da9bd3667c4269c710a9cf
BLAKE2b-256 checksum
How to use checksums
02b6ad8346d9e9c1e72cf0770c18b04448c93cc4b464b9de15106f7dd35df577
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 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.13.0

2 release files

0.12.5

2 release files

This release

0.12.4 This release

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page