File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 3838 client = redis.StrictRedis(host="localhost", port=6379)
3939 client.get("my-key")
4040
41+ Async Redis clients (i.e. `redis.asyncio.Redis`) are also instrumented in the same way:
42+
43+ .. code:: python
44+
45+ from opentelemetry.instrumentation.redis import RedisInstrumentor
46+ import redis.asyncio
47+
48+
49+ # Instrument redis
50+ RedisInstrumentor().instrument()
51+
52+ # This will report a span with the default settings
53+ async def redis_get():
54+ client = redis.asyncio.Redis(host="localhost", port=6379)
55+ await client.get("my-key")
56+
4157The `instrument` method accepts the following keyword args:
4258
4359tracer_provider (TracerProvider) - an optional tracer provider
You can’t perform that action at this time.
0 commit comments