Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

Repository files navigation

lightstep-tracer-python

PyPICircle CIMIT license

The LightStep distributed tracing library for Python.

Installation

apt-get install python-dev
pip install lightstep

Developer Setup

Prerequisites

pyenvinstall2.7.15pyenvinstall3.4.9pyenvinstall3.5.6pyenvinstall3.6.6pyenvinstall3.7.0pyenvlocal2.7.153.4.9
tox
  • Run the examples:
source .tox/py37/bin/activatepythonexamples/nontrivial/main.py

Only required for LightStep developers

pipinstallmodernize

Only required for LightStep developers

brewinstallprotobuf
  • Generating the proto code
cd ..
gitclonehttps://github.com/googleapis/googleapis.gitgitclonehttps://github.com/lightstep/lightstep-tracer-common.gitcdlightstep-tracer-pythonmakeproto

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:

importopentracingimportlightstepif__name__=="__main__":
opentracing.tracer=lightstep.Tracer(
component_name='your_microservice_name',
access_token='{your_access_token}')
withopentracing.tracer.start_active_span('TestSpan') asscope:
scope.span.log_event('test message', payload={'life': 42})
opentracing.tracer.flush()

Thrift

When using apache thrift rpc, make sure to both disable use_http by setting it to False as well as enabling use_thrift.

returnlightstep.Tracer(
...
use_http=False,
use_thrift=True)

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

About

The LightStep distributed tracing library for Python

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages