All Products
Search
Document Center

Application Real-Time Monitoring Service:Report Python application data through SkyWalking

Last Updated:Mar 11, 2026

When you run Python microservices across distributed environments, you need end-to-end visibility into requests as they cross service boundaries. The SkyWalking Python agent automatically instruments 30+ libraries -- including Django, Flask, Redis, Kafka, and MySQL -- so you can report trace data to Managed Service for OpenTelemetry with minimal code changes.

This topic walks you through installing the agent, obtaining your endpoint, and configuring the agent to report traces.

Background information

Apache SkyWalking is an application performance monitoring (APM) and distributed tracing system designed for microservices, cloud-native architectures, and containers such as Docker, Kubernetes, and Mesos. SkyWalking-Python is the official Python agent repository of SkyWalking. You can use SkyWalking-Python to automatically instrument third-party libraries such as Kafka, AIOHTTP, Redis, and WebSockets.

Prerequisites

Before you begin, make sure that you have:

  • Python 3.7 or later installed

  • A Python project where you want to add tracing

  • pip available to install packages

Install the SkyWalking Python agent:

pip install apache-skywalking

Get the SkyWalking endpoint

To connect the agent to Managed Service for OpenTelemetry, obtain the endpoint and authentication token from the console.

  1. Log on to the Managed Service for OpenTelemetry console.

  2. In the left-side navigation pane, click Cluster Configurations. On the page that appears, click the Access point information tab.

  3. In the top navigation bar, select a region. In the Cluster Information section, turn on Show Token.

  4. Set the Client parameter to SkyWalking.

  5. In the Related Information column, copy the endpoint and token.

SkyWalking endpoint information
Note

If your application runs in an Alibaba Cloud production environment, use the VPC endpoint. Otherwise, use the public endpoint.

Instrument your Python application

The SkyWalking Python agent supports two configuration methods: in-code configuration and environment variables. Pick whichever fits your deployment.

Option 1: Configure in code

Import the SkyWalking modules and call config.init() with your endpoint, token, and service name before starting the agent.

from skywalking import agent, config

# Replace placeholders with your actual values
config.init(
    agent_collector_backend_services='<endpoint>',   # SkyWalking endpoint from the console
    agent_authentication='<auth-token>',             # Authentication token from the console
    agent_name='<your-service-name>',                # A name to identify your application
    agent_protocol='grpc',                           # Reporting protocol
    agent_log_reporter_active=False,                 # Disable log reporting (not supported)
    agent_meter_reporter_active=False                # Disable meter reporting (not supported)
)

agent.start()

Replace the following placeholders with your actual values:

PlaceholderDescriptionExample
<endpoint>SkyWalking endpoint from the console<your-endpoint>
<auth-token>Authentication token from the consolexxxxxxxxxxxx
<your-service-name>A name to identify your application in tracesmy-python-app

Option 2: Configure through environment variables

Set the following environment variables and start the agent in your code without passing parameters.

export SW_AGENT_COLLECTOR_BACKEND_SERVICES=<endpoint>
export SW_AGENT_AUTHENTICATION=<auth-token>
export SW_AGENT_NAME=<your-service-name>
export SW_AGENT_PROTOCOL=grpc
export SW_AGENT_LOG_REPORTER_ACTIVE=false
export SW_AGENT_METER_REPORTER_ACTIVE=false

Then start the agent in your Python code:

from skywalking import agent, config

config.init()
agent.start()

For Docker containers, add the environment variables to the environment section of your docker-compose.yaml file:

services:
  my-app:
    image: my-python-app
    environment:
      SW_AGENT_COLLECTOR_BACKEND_SERVICES: "<endpoint>"
      SW_AGENT_AUTHENTICATION: "<auth-token>"
      SW_AGENT_NAME: "my-python-app"
      SW_AGENT_PROTOCOL: "grpc"
      SW_AGENT_LOG_REPORTER_ACTIVE: "false"
      SW_AGENT_METER_REPORTER_ACTIVE: "false"

After you configure the agent, restart your application to start reporting trace data.

Configuration reference

For more information about optional parameters, see the Apache SkyWalking Python configuration reference.

Supported libraries

SkyWalking-Python automatically instruments the following libraries. No additional code changes are needed once the agent is running.

LibraryPython version - Library versionPlug-in
aiohttp3.7+ - 3.7.*sw_aiohttp
aioredis3.7+ - 2.0.*sw_aioredis
aiormq3.7+ - 6.3, 6.4sw_aiormq
amqp3.7+ - 2.6.1sw_amqp
asyncpg3.7+ - 0.25.0sw_asyncpg
bottle3.7+ - 0.12.23sw_bottle
celery3.7+ - 5.1sw_celery
confluent_kafka3.7+ - 1.5.0, 1.7.0, 1.8.2sw_confluent_kafka
django3.7+ - 3.2sw_django
elasticsearch3.7+ - 7.13, 7.14, 7.15sw_elasticsearch
falcon3.7+ - 2.4.1, 2.5, 2.6; 3.10+ - 2.5, 2.6; 3.11+ - not supportedsw_falcon
fastapi3.7+ - 0.88.*, 0.89.*sw_fastapi
flask3.7+ - 2.0sw_flask
happybase3.7+ - 1.2.0sw_happybase
http.server3.7+ - *sw_http_server
werkzeug3.7+ - 1.0.1, 2.0sw_http_server
httpx3.7+ - 0.22.*, 0.23.*sw_httpx
kafka-python3.7+ - 2.0sw_kafka
loguru3.7+ - 0.6.0, 0.7.0sw_loguru
mysqlclient3.7+ - 2.1.*sw_mysqlclient
neo4j3.7+ - 5.*sw_neo4j
psycopg\[binary\]3.7+ - 3.0.18, 3.1.*; 3.11+ - 3.1.*sw_psycopg
psycopg2-binary3.7+ - 2.9; 3.10+ - not supportedsw_psycopg2
pymongo3.7+ - 3.11.*sw_pymongo
pymysql3.7+ - 1.0sw_pymysql
pyramid3.7+ - 1.10, 2.0sw_pyramid
pika3.7+ - 1.2sw_rabbitmq
redis3.7+ - 3.5.*, 4.5.1sw_redis
requests3.7+ - 2.25, 2.26sw_requests
sanic3.7+ - 20.12; 3.10+ - not supportedsw_sanic
tornado3.7+ - 6.0, 6.1sw_tornado
urllib33.7+ - 1.25, 1.26sw_urllib3
urllib.request3.7+ - *sw_urllib_request
websockets3.7+ - 10.3, 10.4sw_websockets

Sample code

For a complete working example, see the skywalking-demo repository on GitHub.

The demo application uses Flask to handle HTTP requests and route them between services, with MySQL database operations along the way. After the agent reports data, you can view cross-process traces and MySQL call monitoring data in the Managed Service for OpenTelemetry console.

FAQ

Method not found: skywalking.v3.LogReportService/collect

Managed Service for OpenTelemetry does not support SkyWalking log collection. Disable the log reporter:

config.init(agent_log_reporter_active=False)

Or set the environment variable:

export SW_AGENT_LOG_REPORTER_ACTIVE=false

Method not found: skywalking.v3.MeterReportService/collect when reporting over gRPC

The backend does not support SkyWalking metrics collection. Disable the meter reporter:

config.init(agent_meter_reporter_active=False)

Or set the environment variable:

export SW_AGENT_METER_REPORTER_ACTIVE=false
Note

Both parameters are already set to False in the configuration examples in this topic. If you followed the examples, these errors do not occur.

References