Skip to content

Commit 3b492c3

Browse files
Update README.md
1 parent c70d755 commit 3b492c3

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ pip install taskiq-faststream[nats]
4646
pip install taskiq-faststream[redis]
4747
```
4848

49+
For **OpenTelemetry** distributed tracing support:
50+
51+
```bash
52+
pip install taskiq-faststream[otel]
53+
```
54+
4955
## Usage
5056

5157
The package gives you two classes: `AppWrapper` and `BrokerWrapper`
@@ -141,3 +147,37 @@ taskiq_broker.task(
141147
...,
142148
)
143149
```
150+
151+
## OpenTelemetry Support
152+
153+
**taskiq-faststream** supports distributed tracing with OpenTelemetry. To enable it, install the `otel` extra and pass `enable_otel=True` when creating the broker wrapper:
154+
155+
```python
156+
from faststream.nats import NatsBroker
157+
from taskiq_faststream import BrokerWrapper
158+
159+
broker = NatsBroker()
160+
161+
# Enable OpenTelemetry middleware
162+
taskiq_broker = BrokerWrapper(broker, enable_otel=True)
163+
```
164+
165+
This will automatically add OpenTelemetry middleware to track task execution, providing insights into:
166+
- Task execution spans
167+
- Task dependencies and call chains
168+
- Performance metrics
169+
- Error tracking
170+
171+
Make sure to configure your OpenTelemetry exporter (e.g., Jaeger, Zipkin) according to your monitoring setup.
172+
173+
The same applies to `AppWrapper`:
174+
175+
```python
176+
from faststream import FastStream
177+
from taskiq_faststream import AppWrapper
178+
179+
app = FastStream(broker)
180+
181+
# Enable OpenTelemetry middleware
182+
taskiq_broker = AppWrapper(app, enable_otel=True)
183+
```

0 commit comments

Comments
 (0)