tiangolo / uvicorn-gunicorn-fastapi-docker

Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python with performance auto-tuning.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gunicorn instrumentation with statsd_host

christian-2 opened this issue · comments

I would like to configure--statsd-host for Gunicorn instrumentation in tiangolo/uvicorn-gunicorn-fastapi:python3.7-alpine3.8. So far, I have not had success e.g. with echo "statsd_host = 'localhost:9125'" >> /gunicorn_conf.py in /apps/prestart.sh. Is there a better way to try this and is is possible at all?

Thanks for you response. I am now employing GUNICORN_CMD_ARGS="--statsd-host=localhost:9125 --statsd-prefix=service.app --log-level=debug". Gunicon logs this at startup:

logger_class: gunicorn.glogging.Logger
statsd_host: ('localhost', 9125)
statsd_prefix: service.app

So this looks good, also because it suggests that no custom logger is in play and interferes (benoitc/gunicorn#1187, benoitc/gunicorn#1405). But Gunicorn instrumentation is still not working e.g. in the sense that tcpdump does not reveal any traffic on port 9125. I am wondering what else I could be missing.

Hmm, I'm not really sure, I haven't used that. Maybe it would be best to first try with Gunicorn alone with a small independent app (say with Flask) and see how that works.

Then try with Gunicorn and Uvicorn.

And then try again inside Docker.

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.