How to use with uWSGI ?

uWSGI is popular in the Python ecosystem. It is a lightweight, fast, and easy-to-use web server.

When uWSGI is used with Skywalking, the pre-fork mechanism of uWSGI must be considered. Some discussion can be found here .

If you get some problems when using skywalking, you can try to use the following method to call @postfork, the low-level api of uWSGI to initialize the skywalking client.

The following is an example of the use of uWSGI and flask, the initialization parameters of skywalking can be referred to Legacy Setup

# main.py
from uwsgidecorators import postfork
from skywalking import agent, config

@postfork
def init_tracing():
    config.init(collector_address='127.0.0.1:11800', agent_name='your awesome service')

    agent.start()

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()
uwsgi --die-on-term \
    --http 0.0.0.0:5000 \
    --http-manage-expect \
    --master --workers 3 \
    --enable-threads \
    --threads 3 \
    --manage-script-name \
    --mount /=main:app