The LightStep distributed tracing library for Python.
apt-get install python-dev
pip install lightstep
Please see the example programs for examples of how to use this library. In particular:
- Trivial Example shows how to use the library on a single host.
- Context in Headers shows how to pass a
TraceContext
throughHTTP
headers.
You can run the examples by doing:
tox
source .tox/py27/bin/activate
python examples/nontrivial/main.py
Or if your python code is already instrumented for OpenTracing, you can simply switch to LightStep's implementation with:
import opentracing
import lightstep
if __name__ == "__main__":
opentracing.tracer = lightstep.Tracer(
component_name='your_microservice_name',
access_token='{your_access_token}')
with opentracing.tracer.start_span('TestSpan') as span:
span.log_event('test message', payload={'life': 42})
opentracing.tracer.flush()
This library is the LightStep binding for OpenTracing. See the OpenTracing Python API for additional detail.