Skip to main content

Deployment

The Python Agent is a performance monitoring client designed for Web frameworks based on the WSGI protocol. In theory, any Web framework based on the WSGI protocol can be monitored.

Prerequisites

  • Please confirm that the current Agent version supports your application and deployment method. For details, see the Supported List.
  • For Tingyun SaaS platform, register a Tingyun account and obtain a license key.
  • Set up the Agent's configuration file.

All three conditions above are required, otherwise the Agent cannot work properly.

Agent Deployment

UniAgent Deployment (Linux Only)

When there are applications in multiple languages on a Linux server, it is recommended to use UniAgent for installation.

The installation path is fixed at /opt/tingyun-oneagent. For installation steps, please refer to UniAgent Deployment Guide.

The UniAgent package integrates Agents for Java/PHP/.NET Core/Node.js/Python. After installation, you do not need to manually modify the application's configuration files. All Agent embedding actions are automatically completed by UniAgent, and it can automatically monitor applications inside Docker containers.

After UniAgent installation is complete, if you need to monitor Python applications, you need to manually enable the Python monitoring switch in /opt/tingyun-oneagent/conf/interceptor.conf by setting python_enabled=true.

sudo sed -i -e "s/python_enabled.*/python_enabled=true/" /opt/tingyun-oneagent/conf/interceptor.conf

Then restart the Python application.

Standard Agent Deployment

First install the Agent, then configure the Agent. For detailed configuration options, see Agent Configuration.

Install the Agent

You can download the required Agent from Deployment Management > Download Center.

Assume the installation package you obtained is tingyun-1.1.0.tar.gz. Perform the following operations to install (activate the virtual environment first if using one). If you have multiple versions of Python installed, please confirm the Python path used by your application and install the Agent to the specified Python directory.

tar --zxvf tingyun-1.1.0.tar.gz -C /tmp
/path/to/python /tmp/tingyun-1.1.0/setup.py install

Configure the Agent

  1. Generate the configuration file by running the following command:

    tingyun-admin generate-config YourLicenseKey outputFile.ini
  2. Set collectors.

    The format is collectors=IP:Port, where the IP address is the server address where tingyun-collector is located, and Port is the value of collector.port in collector.properties. Set ssl to False.

    Note: The configuration file provides many options for different functions. For details, see the Agent Configuration section.

  3. Embed the Agent.

    Assuming the configuration file is stored at /tmp/tingyun.ini, configure as follows:

    TINGYUN_CONFIG_FILE=/tmp/tingyun.ini tingyun-admin run-program <application start command> <application start parameters>

    Example:

    TINGYUN_CONFIG_FILE=/tmp/tingyun.ini tingyun-admin run-program python manage.py runserver
  4. Access the application.