Skip to content

Instrumentation

Added in 19.1

Gunicorn exposes optional instrumentation for the arbiter and workers using the statsD protocol over UDP. The gunicorn.instrument.statsd module turns Gunicorn into a statsD client.

UDP keeps Gunicorn isolated from slow statsD consumers, so metrics collection does not impact request handling.

Tell Gunicorn where the statsD server is located:

gunicorn --statsd-host=localhost:8125 --statsd-prefix=service.app ...

The Statsd logger subclasses gunicorn.glogging.Logger and tracks:

  • gunicorn.requests — request rate per second
  • gunicorn.request.duration — request duration histogram (milliseconds.md)
  • gunicorn.workers — number of workers managed by the arbiter (gauge.md)
  • gunicorn.log.critical — rate of critical log messages
  • gunicorn.log.error — rate of error log messages
  • gunicorn.log.warning — rate of warning log messages
  • gunicorn.log.exception — rate of exceptional log messages

See the statsd_host setting for additional options.

statsD