Metadata-Version: 2.4
Name: opentelemetry-instrumentation-oslo-messaging
Version: 0.8.1
Summary: OpenStack oslo.messaging instrumentation for OpenTelemetry
Author-email: Pham Le Gia Dai <daipham3213@gmail.com>
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Requires-Dist: opentelemetry-api
Requires-Dist: opentelemetry-instrumentation
Requires-Dist: opentelemetry-semantic-conventions
Requires-Dist: opentelemetry-util-http
Requires-Dist: wrapt
Provides-Extra: instruments
Requires-Dist: oslo-messaging; extra == 'instruments'
Description-Content-Type: text/markdown

# OpenTelemetry oslo.messaging Instrumentation

OpenStack oslo.messaging instrumentation for OpenTelemetry.

It patches two thin layers to produce end-to-end producer → consumer traces.

**Producer — context injection.** `Transport._send` and
`Transport._send_notification` inject the current W3C trace context into the
message's on-the-wire context dictionary:

- This runs *after* the serializer, so it is serializer-agnostic — it works with
  any `Serializer` (including production's `RequestContextSerializer`, whose
  `to_dict()` would otherwise drop unknown keys).
- It is a single chokepoint covering every send path: RPC calls, casts, fanout,
  replies, and notifications.
- No producer span is created; the trace linkage rides on whatever span is
  already active in the caller (e.g. the WSGI request span).

**Consumer — spans.** The dispatchers open `CONSUMER` spans parented to the
producer, extracting context from the incoming message:

- `RPCDispatcher.dispatch` → a `CONSUMER` span `oslo.messaging.rpc.process`
- `NotificationDispatcher.dispatch` → a `CONSUMER` span
  `oslo.messaging.notification.process`

The span is scoped to the dispatch call, so the remote context is never attached
beyond message handling. Message payloads are never recorded as span attributes.
The batch notification dispatcher is not instrumented.

## Usage

```python
from opentelemetry.instrumentation.oslo_messaging import (
    OsloMessagingInstrumentor,
)

OsloMessagingInstrumentor().instrument()
```
