Skip to content

Commit

Permalink
Add message and example to Redis Usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
sd2k committed May 3, 2022
1 parent 0765def commit 0498d3e
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@
client = redis.StrictRedis(host="localhost", port=6379)
client.get("my-key")
Async Redis clients (i.e. redis.asyncio.Redis) are also instrumented in the same way:
.. code:: python
from opentelemetry.instrumentation.redis import RedisInstrumentor
import redis.asyncio
# Instrument redis
RedisInstrumentor().instrument()
# This will report a span with the default settings
async def redis_get():
client = redis.asyncio.Redis(host="localhost", port=6379)
await client.get("my-key")
The `instrument` method accepts the following keyword args:
tracer_provider (TracerProvider) - an optional tracer provider
Expand Down

0 comments on commit 0498d3e

Please sign in to comment.