...
Code Block |
---|
... def post_fork(server, worker): import python_agent.init ... |
Uvicorn ASGI
Uvicorn does not support importing module to be run before the app is started (as in uwsgi).
in order to overcome this there is a code change need to be done at the source code in order to init Sealights when Uvicorn is loading
Code Block |
---|
...
# Check for an environment variable and import accordingly
if os.getenv('ENABLE_SEALIGHTS', 'false') == 'true':
import python_agent.init
... |
Running the app:
Code Block |
---|
export ENABLE_SEALIGHTS=true
uvicorn app:APP --host 0.0.0.0 --port 9092 --workers 1 --reload |
Other servers (Generic solution)
...