xray-python-opentracing

OpenTracing adapter for AWS X-Ray

MIT License

Stars
8

WIP: xray-python-opentracing

Python OpenTracing implementation for AWS X-Ray, a distributed tracing system.

WIP (but it works for us). Heavily based on the excellent LightStep Tracer.

Installation

xray-python-opentracing is not yet on PyPI, but you can add the following line to your requirements.txt:

git+git://github.com/nornagon/xray-python-opentracing.git@9a40fbc

Getting started

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 this implementation with:

import opentracing
import xray_ot

if __name__ == "__main__":
  opentracing.tracer = xray_ot.Tracer(
    component_name='your_microservice_name',
    collector_host='127.0.0.1',
    collector_port=2000)

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

  opentracing.tracer.flush()

This library is an AWS X-Ray binding for OpenTracing. See the OpenTracing Python API for additional detail.