We have quite a standard gunicorn setup with the default sync worker with the default 1 thread, running a Python app.
Gunicorn is started with this command line:
gunicorn \
--workers=16 \
--timeout=120 \
-b 127.0.0.1:8082 \
--paste production.ini \
2>> api-err.log 1>> api-out.log
The Python Sentry integration is loaded with the following:
import sentry_sdk
from sentry_sdk.integrations.pyramid import PyramidIntegration
sentry_sdk.init(
dsn="https://[email protected]/123",
integrations=[PyramidIntegration()],
release='1.2.3'
)
config = Configurator(settings=settings)
...
The issue is that whenever a Gunicorn worker timeout occurs, it is not logged to Sentry.
The only way we can see that there was a timeout is when we see "[CRITICAL] WORKER TIMEOUT" in api-err.log and the matching error code 499 lines in nginx.log.
It'd be important to log these timeout events to Sentry.
Could you write a python script that contains the same thing as your gunicorn executable, but calls sentry_sdk.init before running gunicorn? Trying to confirm something
This is the gunicorn executable:
```
import re
import sys
from gunicorn.app.wsgiapp import run
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script.pyw?|.exe)?$', '', sys.argv[0])
sys.exit(run())
````
Yes, could you edit it to call sentry_sdk.init() (with your DSN) before it calls run()? I believe this could "fix" the problem already.
Bump on the issue. Similar configuration but with gunicorn + falcon + sentry sdk.
Most helpful comment
Bump on the issue. Similar configuration but with gunicorn + falcon + sentry sdk.