Python - The Instana Python Package

Stan Loves Python

The Instana Python package: Python Distributed Tracing & Metrics Sensor


The Instana Python package is a zero configuration tool that will automatically collect key metrics and distributed traces from your Python processes.



Instana remotely instruments your Python applications automatically via Instana AutoTrace™.

What is Instana AutoTrace?

Instana AutoTrace™ is a next generation distributed tracing and service discovery technology powering Instana’s fully automatic, no-effort and instant observability experience.

A more technical explanation:

The Instana Host agent will automatically find and instrument your running Python applications with no user steps (or restarts) required.

For more information and background, see the blog post on Python AutoTrace or the AutoTrace configuration documentation to modify AutoTrace behavior.

Manual Installation

If you wish to instead manually instrument your applications you can install the package with the following into the virtualenv, pipenv or container (hosted on pypi):

pip install instana

or to alternatively update an existing installation:

pip install -U instana

Activating Without Code Changes

The Instana package can be activated without any code changes required by setting the following environment variable for your Python application:


This will cause the Instana Python package to automatically instrument your Python application. Once it finds the Instana host agent, it will begin to report Python metrics and distributed traces.

Activating via Import

Alternatively, if you prefer the really manual method, simply import the instana package inside of your Python application:

import instana

See also our detailed Installation document for additional information covering Django, Flask, End-user Monitoring (EUM) and more.


Although the package has no configuration required for out of the box metrics and distributed tracing, individual components can be configured as needed. See the Python configuration page for more information.

Kubernetes & OpenShift

Please see this document on assuring that your instrumented applications can contact the Instana Host Agent.

API Client

The Instana Python package includes an API client that can be used to access the raw data of your Instana dashboard using the Instana REST API. Download metrics, views, events and more.

For details on how to use this Python API client with examples, please see the documentation here.

Custom Tracing

The Instana Python package supports custom tracing via OpenTracing APIs. See the OpenTracing page for more information.


Seeing something unexpected or having trouble trying to configure something? See the Python Troubleshooting page for help.


To see the Instana Python package release history, which also details the changes made in the Instana package, please see the Github Releases page.

See Also