Skip to content

OpenTracing instrumentation for Python's Redis client.

Notifications You must be signed in to change notification settings

carlosalberto/python-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis Opentracing

This package enables distributed tracing for the Python redis library.

Installation

Run the following command:

$ pip install redis_opentracing

Getting started

Tracing a Redis client requires setting up an OpenTracing-compatible tracer, and calling init_tracing to set up the tracing wrappers. See the examples directory for several different approaches.

import redis
import redis_opentracing

redis_opentracing.init_tracing(tracer)

client = redis.StrictRedis()
client.set('last_access', datetime.datetime.now())

It's possible to trace only specific Redis clients:

redis_opentracing.init_tracing(tracer, trace_all_classes=False)
redis_opentracing.trace_client(client)

# Only commands and pipelines executed through this client will
# be traced.
res = client.get('last_access')

It's also possible to trace only specific pipelines:

redis_opentracing.init_tracing(tracer, trace_all_classes=False)

pipe = client.pipeline()
redis_opentracing.trace_pipeline(pipe)

# This pipeline will be executed as a single MULTI command.
pipe.lpush('fruits', 'lemon', 'watermelon')
pipe.rpush('fruits', 'pineapple', 'apple')
pipe.execute()

When pipeline commands are executed as a transaction, these commands will be grouped under a single 'MULTI' operation. They'll also appear as a single operation in the trace. Outside of a transaction, each command will generate a span.

Further information

If you’re interested in learning more about the OpenTracing standard, please visit opentracing.io or join the mailing list. If you would like to implement OpenTracing in your project and need help, feel free to send us a note at [email protected].

About

OpenTracing instrumentation for Python's Redis client.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published