Python - The Instana Python Package

Stan Loves Python

The Instana Python package: Python Distributed Tracing & Metrics Sensor.

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.

The Instana Host agent automatically finds and instruments your running Python applications with no required user steps or restarts.

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


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


Automatic installation

Instana remotely instruments your Python applications automatically by Instana AutoTrace™. However, if you want to install the package manually, see Manual Installation.

Manual Installation

The Instana Host agent automatically finds and instruments your running Python applications. However, you can manually install the package.

To instrument your applications, manually install the package into the virtualenv, pipenv, or container (hosted on pypi) by running this command:

pip install instana

To update an existing installation, run this command:

pip install -U instana

Activating Without Code Changes

To activate the Instana package without any code changes, set this environment variable for your Python application:


The Instana Python package automatically instruments your Python application, and when it locates the Instana host agent, it begins to report Python metrics and distributed traces.

Activating via Import

Alternatively, to manually import the instana package to inside your Python application, run this command:

import instana

For additional information about Django, Flask, End-user Monitoring (EUM), and more, see the Installation document.


For out of the box metrics and distributed tracing, no configuration is required. However, individual components are configurable. For more information, see the Python configuration.

Kubernetes & OpenShift

For information on how to ensure that your instrumented applications can contact the Instana Host Agent, see the documentation.

API Client

Using the Instana REST API, the Python package includes an API client to download metrics, views, events, and more, that are displayed on your Instana dashboard.

For information and examples on how to use the Python API client, see the documentation.

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.


For the Instana Python package release history, including changes made to the package, see the Github Releases page.

See Also