Skip to main content

OpenStack oslo.service instrumentation for OpenTelemetry

Project description

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file opentelemetry_instrumentation_oslo_service-0.11.0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_oslo_service-0.11.0.tar.gz
Algorithm Hash digest
SHA256 27f743c4028bdbe3c7741fc4db3303247aea03d3fc4d204c4105f8bfc62ae770
MD5 0b20bc42bc186fe08504c7f3686d9878
BLAKE2b-256 b677b301b560bcae0f2b2248e33166fbcf1495436b1feaed128603a8a460b0cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentelemetry_instrumentation_oslo_service-0.11.0.tar.gz:

Publisher: publish-pypi.yml on daipham3213/opentelemetry-openstack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opentelemetry_instrumentation_oslo_service-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_oslo_service-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a159df039f5109c3c7eed5ebaee0201a2403ef81bd40fa4eccf9edfc42e12d86
MD5 089070e67a14e937d6fee0e2d72a93e0
BLAKE2b-256 c6aa72da95c5c6f7837e00d2551de8e5221f7a9a63b65fe5d1e8200260c6c97a

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentelemetry_instrumentation_oslo_service-0.11.0-py3-none-any.whl:

Publisher: publish-pypi.yml on daipham3213/opentelemetry-openstack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page