Metadata-Version: 2.3
Name: opentelemetry-instrumentation-faststream
Version: 0.1.3
Summary: FastStream instrumentation for OpenTelemetry
Project-URL: Documentation, https://github.com/ashambalev/opentelemetry-instrumentation-faststream#readme
Project-URL: Issues, https://github.com/ashambalev/opentelemetry-instrumentation-faststream/issues
Project-URL: Source, https://github.com/ashambalev/opentelemetry-instrumentation-faststream
Author-email: Artem Shambalev <a.shambalev@gmail.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.11
Requires-Dist: opentelemetry-api~=1.5
Requires-Dist: opentelemetry-instrumentation~=0.44b0
Requires-Dist: wrapt<2.0.0,>=1.0.0
Provides-Extra: instruments
Requires-Dist: faststream[redis]<0.6.0,>=0.5.2; extra == 'instruments'
Provides-Extra: quality
Requires-Dist: mypy~=1.8.0; extra == 'quality'
Requires-Dist: pre-commit~=3.6.0; extra == 'quality'
Requires-Dist: ruff~=0.3.0; extra == 'quality'
Provides-Extra: tests
Requires-Dist: aio-pika; extra == 'tests'
Requires-Dist: aiokafka; extra == 'tests'
Requires-Dist: faststream[kafka,nats,rabbit,redis]<0.6.0,>=0.5.2; extra == 'tests'
Requires-Dist: nats-py; extra == 'tests'
Requires-Dist: opentelemetry-test-utils~=0.45b0; extra == 'tests'
Requires-Dist: pytest-asyncio==0.23.6; extra == 'tests'
Requires-Dist: pytest-cov~=4.1; extra == 'tests'
Requires-Dist: pytest~=8.0.0; extra == 'tests'
Requires-Dist: redis; extra == 'tests'
Requires-Dist: wrapt<2.0.0,>=1.0.0; extra == 'tests'
Description-Content-Type: text/markdown

# FastStream instrumentation for OpenTelemetry

[![PyPI - Version](https://img.shields.io/pypi/v/opentelemetry-instrumentation-faststream.svg)](https://pypi.org/project/opentelemetry-instrumentation-faststream)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/opentelemetry-instrumentation-faststream.svg)](https://pypi.org/project/opentelemetry-instrumentation-faststream)


This library allows tracing requests made by the [**FastStream**](https://faststream.airt.ai/latest/) library.


## Installation

```console
pip install opentelemetry-instrumentation-faststream
```

## Usage

### Middlewares

#### Redis

```python
from opentelemetry.instrumentation.faststream.middlewares import RedisOtelMiddleware

broker = RedisBroker("redis://localhost:6379", middlewares=[RedisOtelMiddleware])
```

#### Kafka

```python
from opentelemetry.instrumentation.faststream.middlewares import KafkaOtelMiddleware

broker = KafkaBroker("redis://localhost:6379", middlewares=[KafkaOtelMiddleware])
```

#### RabbitMQ

```python
from opentelemetry.instrumentation.faststream.middlewares import RabbitOtelMiddleware

broker = RabbitBroker("redis://localhost:6379", middlewares=[RabbitOtelMiddleware])
```

#### NATS

```python
from opentelemetry.instrumentation.faststream.middlewares import NatsOtelMiddleware

broker = NatsBroker("redis://localhost:6379", middlewares=[NatsOtelMiddleware])
```

### Instrumentation

```python
from opentelemetry.instrumentation.faststream import FastStreamInstrumentator

# Instrument all brokers automatically
FastStreamInstrumentator().instrument()

# Uninstrument
FastStreamInstrumentator().uninstrument()
```

## License

`opentelemetry-instrumentation-faststream` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
