This example shows how to use the opentelemetry-opentracing-shim package to interact with libraries instrumented with opentracing-python.
The included rediscache
library creates spans via the OpenTracing Redis integration, redis_opentracing. Spans are exported via the Jaeger exporter, which is attached to the OpenTelemetry tracer.
The source files required to run this example are available here.
Installation JaegerStart Jaeger
docker run --rm \ -p 4317:4317 \ -p 4318:4318 \ -p 16686:16686 \ jaegertracing/all-in-one:latest \ --log-level=debugRedis
Install Redis following the instructions.
Make sure that the Redis server is running by executing this:
Python DependenciesInstall the Python dependencies in requirements.txt
pip install -r requirements.txt
Alternatively, you can install the Python dependencies separately:
pip install \ opentelemetry-api \ opentelemetry-sdk \ opentelemetry-exporter-otlp \ opentelemetry-opentracing-shim \ redis \ redis_opentracingRun the Application
The example script calculates a few Fibonacci numbers and stores the results in Redis. The script, the rediscache
library, and the OpenTracing Redis integration all contribute spans to the trace.
To run the script:
After running, you can view the generated trace in the Jaeger UI.
Jaeger UIOpen the Jaeger UI in your browser at http://localhost:16686 and view traces for the “OpenTracing Shim Example” service.
Each main.py
run should generate a trace, and each trace should include multiple spans that represent calls to Redis.
Note that tags and logs (OpenTracing) and attributes and events (OpenTelemetry) from both tracing systems appear in the exported trace.
Useful linksRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4