File tree 1 file changed +16
-0
lines changed
instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 38
38
client = redis.StrictRedis(host="localhost", port=6379)
39
39
client.get("my-key")
40
40
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
+
41
57
The `instrument` method accepts the following keyword args:
42
58
43
59
tracer_provider (TracerProvider) - an optional tracer provider
You can’t perform that action at this time.
0 commit comments