OpenTelemetry Redis Instrumentation

Instrument redis to report Redis queries.

There are two options for instrumenting code. The first option is to use the opentelemetry-instrumentation executable which will automatically instrument your Redis client. The second is to programmatically enable instrumentation via the following code:

Usage

from opentelemetry import trace
from opentelemetry.instrumentation.redis import RedisInstrumentor
from opentelemetry.sdk.trace import TracerProvider
import redis

trace.set_tracer_provider(TracerProvider())

# Instrument redis
RedisInstrumentor().instrument(tracer_provider=trace.get_tracer_provider())

# This will report a span with the default settings
client = redis.StrictRedis(host="localhost", port=6379)
client.get("my-key")

API

class opentelemetry.instrumentation.redis.RedisInstrumentor[source]

Bases: opentelemetry.instrumentation.instrumentor.BaseInstrumentor

An instrumentor for Redis See BaseInstrumentor