OpenTracing support for Elasticsearch
Project description
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.
And it’s also possible to trace only specific pubsub objects:
redis_opentracing.init_tracing(tracer, trace_all_classes=False)
pubsub = client.pubsub()
redis_opentracing.trace_pubsub(pubsub)
pubsub.subscribe('incoming-fruits')
msg = pubsub.get_message() # This message will appear as a 'SUB' operation.
Incoming messages through get_message, listen and run_in_thread will be traced, and any command executed through the pubsub’s execute_command method will be traced too.
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 community@opentracing.io.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file redis_opentracing-0.1.2.tar.gz
.
File metadata
- Download URL: redis_opentracing-0.1.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed3cbeb3a58d9bcb9cb6625cf3ac33fd089e5bcd7cac3a48d9321c1bc9b43248 |
|
MD5 | df73c72989fce3f91c50db34e6e299d1 |
|
BLAKE2b-256 | c761a77c5fca61ea3eeb836edde8627c22c50bdaccd416d78f1716ddebbc87dd |