The Instana Python package: Python Distributed Tracing & Metrics Sensor.
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.
The Instana Python package is a zero-configuration tool that automatically collects key metrics and distributed traces from your Python processes.
Instana remotely instruments your Python applications automatically by Instana AutoTrace™. However, if you want to install the package manually, see 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
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.
Alternatively, to manually import the
instana package to inside your Python application, run this command:
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.
For information on how to ensure that your instrumented applications can contact the Instana Host Agent, see the documentation.
Note: This section assumes that the Instana agent is running on the Diego cells of the Cloud Foundry foundation. Without an agent running on the underpinning Diego cell, monitoring Cloud Foundry applications is not supported.
For information on how to setup Instana agents and the related Cloud Foundry or Pivotal Platform functionality, see our Cloud Foundry and Pivotal Platform documentation.
Monitoring Python Cloud Foundry applications requires the following steps:
- Add the
instanaPython package to the
- Add an
AUTOWRAPT_BOOTSTRAPenvironment variable with the value
instanato the application manifest as shown below
cf pushthe Cloud Foundry application
--- applications: - name: test-python-flask buildpacks: - python_buildpack env: AUTOWRAPT_BOOTSTRAP: instana
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.
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.