The LightStep distributed tracing library for Python
Clone or download
nimeshksingh Merge pull request #60 from lightstep/nksingh/remove_accidental_change
Remove accidentally commited Makefile change
Latest commit 72e9749 Dec 12, 2018


PyPI Circle CI MIT license

The LightStep distributed tracing library for Python.


apt-get install python-dev
pip install lightstep

Developer Setup


pyenv install 2.7.15
pyenv install 3.4.9
pyenv install 3.5.6
pyenv install 3.6.6
pyenv install 3.7.0
pyenv local 2.7.15 3.4.9
  • Run the examples:
source .tox/py37/bin/activate
python examples/nontrivial/

Only required for LightStep developers

pip install modernize

Only required for LightStep developers

brew install protobuf
  • Generating the proto code
cd ..
git clone
git clone
cd lightstep-tracer-python
make proto

Getting Started with Tracing

Please see the example programs for examples of how to use this library. In particular:

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(

  with opentracing.tracer.start_active_span('TestSpan') as scope:
    scope.span.log_event('test message', payload={'life': 42})


This library is the LightStep binding for OpenTracing. See the OpenTracing Python API for additional detail.