Documentation forSolarWinds Observability

Install the Python Library

The Python Library is a custom distro of OpenTelemetry Python, delivered as a package named solarwinds-apm. Install the library from the Python Package Index (PyPI) and use its command line interface (CLI) commands to bootstrap and instrument your Python application.

Python Library requirements

Requirements for Python wheel

The solarwinds-apm package provides pre-built binary distributions (Python wheels) for most supported systems. Installing the package using the pip command will automatically select the Python wheel compatible with your system.

System requirements for installation from the Python wheels are the following:

  • Package installer for Python (pip) version 19.3 or greater

    If you are running an older version, upgrade pip with the command pip install --upgrade pip

  • An operating system that is compatible with the manylinux2014 Python wheel platform specification (see PEP599 from the Python Developer's Guide)

    Most modern Linux operating systems, except for Alpine Linux, are compatible with the manylinux2014 Python wheel platform specification.

If your system does not satisfy the above requirements, you can install solarwinds-apm from the source. See Requirements for Source Distribution.

Requirements for Source Distribution

If your platform is not supported by the wheels provided with the package, use the pip command to install solarwinds-apm from the source distribution. When installing from the source distribution, the package will compile an extension during install.

System requirements for installation from source distribution are the following:

  • Python header files
  • the gnu compiler
  • the make command

The command to install the above components is specific to the underlying operating system you are using.

On Debian/Ubuntu:

sudo apt-get install python3-dev g++ make

On RHEL/CentOS/Amazon Linux:

sudo yum install python3-devel gcc-c++ make

On Alpine Linux:

sudo apk add python3-dev g++ make

Some systems may provide multiple Python versions. If this is the case, specify the versioned header package, such as python3-dev, that matches the correct Python runtime.

See Components supported by the Python Library to verify your system is supported.

The extension is compiled into a binary with both system and Python version dependencies. Do not copy the installed library package from one platform onto another platform; instead, install the library on each individual platform.

Install the Python Library

Install the library from PyPI, then run the opentelemetry-bootstrap command. This command detects and installs the instrumentation packages applicable to your system:

pip install solarwinds-apm
opentelemetry-bootstrap --action=install

Make sure you install the Python Library after installing all other service dependencies. This order of installation allows opentelemetry-bootstrap to detect the packages and install the corresponding instrumentation libraries. For example:

pip install -r requirements.txt           # installs all other dependencies
pip install solarwinds-apm
opentelemetry-bootstrap --action=install

Enable the Python Library

The library requires a service key to connect to your account, and must be loaded by running your application with the opentelemetry-instrument command.

Service key

The service key should be defined in the environment your application runs in (see Configure the Python Library):

export SW_APM_SERVICE_KEY="YourApiToken:YourServiceName"

The Service key is used to identify your account and the service being instrumented. It is shown in the Add Data dialog when adding the new service.

It is a required configuration and should be in the form of YourApiToken:YourServiceName. Replace YourApiToken with the SolarWinds Observability API token (ingestion type) generated for this service, and replace YourServiceName with your chosen name for this service. See API Tokens.

Load the Library

Run your application with the prefix command opentelemetry-instrument to wrap all common Python frameworks and start exporting traces and metrics. For example:

opentelemetry-instrument command_to_run_your_service

The scripts are not supported under any SolarWinds support program or service. The scripts are provided AS IS without warranty of any kind. SolarWinds further disclaims all warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The risk arising out of the use or performance of the scripts and documentation stays with you. In no event shall SolarWinds or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the scripts or documentation.