Skip to content

Repository files navigation

FastStream instrumentation for OpenTelemetry

PyPI - Version PyPI - Python Version

This library allows tracing requests made by the FastStream library.

Installation

pip install opentelemetry-instrumentation-faststream

Usage

Middlewares

Redis

from opentelemetry.instrumentation.faststream.middlewares import RedisOtelMiddleware

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

Kafka

from opentelemetry.instrumentation.faststream.middlewares import KafkaOtelMiddleware

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

RabbitMQ

from opentelemetry.instrumentation.faststream.middlewares import RabbitOtelMiddleware

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

NATS

from opentelemetry.instrumentation.faststream.middlewares import NatsOtelMiddleware

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

Instrumentation

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 license.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages