opentracing-decorator - A Python decorator for OpenTracing trace generation.
Opentracing Decorator is a small Python library that adds a convenient decorator for generating OpenTracing traces. It works with any client implementation that follows the OpenTracing standard.
Note: Opentracing Decorator is in early beta. Use in production at your own risk. Although the library is small and quite stable, some bugs arising from edge cases should be expected.
Let's get started...
# examples/simple.py
import time
from jaeger_client import Config
from opentracing_decorator import Tracing
# No sampler host and port specified because the Jaeger client picks localhost:6831 by default.
config = Config(
config={
"sampler": {
"type": "const", # Not advised to have constant sampling in production.
"param": 1,
},
"logging": True,
},
service_name="example-service",
validate=True,
)
jaeger_tracer = config.initialize_tracer()
# Pass in an instance of a tracer implementation.
# Here, we're using the Jaeger client.
tracing = Tracing(tracer=jaeger_tracer)
# Decorate functions with the @tracing.trace decorator and an operation_name.
@tracing.trace(operation_name="MyOperationName")
def do_some_work(x, y, z):
return x + y + z
if __name__ == "__main__":
do_some_work(10, 20, 30)
# Give some time to report traces.
time.sleep(5)
jaeger_tracer.close()
Features
- Automatic Span tagging of function parameters (Opt-In).
- Automatic Span logging of function return values (Opt-In).
- Works with any OpenTracing compatible tracing client.
Installation
Install with pip:
$ pip install opentracing-decorator
Opentracing Decorator requires Python 3.6+.
Documentation
Project documentation is available at https://doughepi.github.io/opentracing-decorator/.
For a run-through of all the basics, head over to the QuickStart.
The Developer Interface provides a comprehensive API reference.
To learn more about the OpenTracing standards, check out The OpenTracing Project
Contribute
If you want to contribute to Opentracing Decorator check out the Contributing Guide to learn how to start.
Dependencies
The Opentracing Decorator project relies on these excellent libraries:
opentracing- The no-op implementation of the OpenTracing standard.flatten-dict- To support some of the parameter tagging and return logging.
— ⭐️ —
Opentracing Decorator is MIT licensed code. Designed & built in Minneapolis, MN. Used at General Mills.
Metadata
Release files for opentracing-decorator 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| opentracing-decorator-1.1.0.tar.gz | 5.3 kB | Without provenance | Details for opentracing-decorator-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opentracing_decorator-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for opentracing_decorator-1.1.0-py3-none-any.whl |
Total release size: 11.1 kB
Release files / opentracing-decorator-1.1.0.tar.gz
| Download URL | opentracing-decorator-1.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6e8692624e936a7cca32580ba95b1c04a58a480e4ceed346f25a7ebb540c78f
|
|
BLAKE2b-256 checksum How to use checksums |
3ec5a513402c8438f59d0eb547797e42aa8224836b1baa25e4564166e69df715
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|
Release files / opentracing_decorator-1.1.0-py3-none-any.whl
| Download URL | opentracing_decorator-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ca057f36b598878652a91d75d5c1ccd7c2d86550fc95d648f1b206c8b852ddf
|
|
BLAKE2b-256 checksum How to use checksums |
e7d9dc60b3a25e4acd7f8aa74157aa61f6aba7a724504f68e27c2d50a169d97e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|
Security for opentracing-decorator 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.