OpenTelemetry instrumentation for the Valkey Python Client.
opentelemetry-python-contrib-external-valkey is available on PyPI. You can install it with
pip install opentelemetry-python-contrib-external-valkeyor
uv add opentelemetry-python-contrib-external-valkeyor something equivalent.
For global instrumentation of the Valkey Python client you can do
from opentelemetry.instrumentation.valkey import ValkeyInstrumentor
ValkeyInstrumentor().instrument()For more detailed documentation please have a look at the opentelemetry-instrumentation-redis documentation and just replace [rR]edis with [vV]alkey.
opentelemetry-instrumentation-redis instruments the redis module and has multiple isinstance checks for classes from it. Since the [Valkey Python Client] is a fork of the Redis Python Client, any instrumentation through opentelemetry-instrumentation-redis has no effect on the valkey module or any of its classes. opentelemetry-python-contrib-external-valkey fills this gap until Valkey is officially supported and gives Valkey users the same user experience for instrumentation as Redis users.
This repository is a fork of opentelemetry-python-contrib and specifically the instrumentation/opentelemetry-instrumentation-redis folder. 95% and more of the changes in the src and tests folders are just replacing the strings redis and Redis with valkey and Valkey respectively.