The instana package provides Python metrics and traces (request, queue & cross-host) for Instana.
This package supports Python 2.7 or greater.
Any and all feedback is welcome. Happy Python visibility.
The instana package will automatically collect metrics and distributed traces from your Python processes. Just install and go.
pip install instana
into the virtual-env or container (hosted on pypi)
The Instana package can then be activated without any code changes required by setting the following environment variable for your Python application:
export AUTOWRAPT_BOOTSTRAP=instana
alternatively, if you prefer the manual method, simply import the instana
package inside of your Python application:
import instana
See our detailed Installation document for additional information covering Django, Flask, End-user Monitoring (EUM) and more.
This Python package supports OpenTracing. When using this package, the OpenTracing tracer (opentracing.tracer
) is automatically set to the InstanaTracer
.
import opentracing
parent_span = opentracing.tracer.start_span(operation_name="asteroid")
# ... work
child_span = opentracing.tracer.start_span(operation_name="spacedust", child_of=parent_span)
child_span.set_tag(ext.SPAN_KIND, ext.SPAN_KIND_RPC_CLIENT)
# ... work
child_span.finish()
# ... work
parent_span.finish()
Note: The Instana sensor has automatic instrumentation that activates at runtime. If you need to get the current tracing context from existing instrumentation, you can use opentracing.tracer.current_context()
and pass that return value as childof
:
context = opentracing.tracer.current_context()
span = opentracing.tracer.start_span("my_span", child_of=context)
Also note that under evented systems such as gevent, concurrence and/or greenlets (which aren't supportet yet), the value opentracing.tracer.current_context()
is likely to be inconsistent.
For details on how to configure the Instana Python package, see Configuration.md
You can find more documentation covering supported components and minimum versions in the Instana documentation portal.
Bug reports and pull requests are welcome on GitHub at https://github.com/instana/python-sensor.
Want to instrument other languages? See our Nodejs, Go, Ruby instrumentation or many other supported technologies.