mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Document statsd_* commands.
This commit is contained in:
parent
43d1eba3e3
commit
f0b9468ea3
29
README.rst
29
README.rst
@ -45,35 +45,6 @@ Example with test app::
|
|||||||
$ gunicorn --workers=2 test:app
|
$ gunicorn --workers=2 test:app
|
||||||
|
|
||||||
|
|
||||||
Instrumentation
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Gunicorn provides an optional instrumentation of the arbiter and
|
|
||||||
workers using the statsD_ protocol over UDP. Thanks to the
|
|
||||||
`gunicorn.instrument.statsd` module, Gunicorn becomes a statsD client
|
|
||||||
The use of UDP cleanly isolates Gunicorn from the receiving end of the statsD
|
|
||||||
metrics so that instrumentation does not cause Gunicorn to be held up by a slow
|
|
||||||
statsD consumer.
|
|
||||||
|
|
||||||
To use statsD, just tell gunicorn where the statsD server is:
|
|
||||||
|
|
||||||
$ gunicorn --statsd-host=localhost:8125 ...
|
|
||||||
|
|
||||||
The `Statsd` logger overrides `gunicorn.glogging.Logger` to track
|
|
||||||
all requests. The following metrics are generated:
|
|
||||||
|
|
||||||
* ``gunicorn.requests``: request rate per second
|
|
||||||
* ``gunicorn.request.duration``: histogram of request duration (in millisecond)
|
|
||||||
* ``gunicorn.workers``: number of workers managed by the arbiter (gauge)
|
|
||||||
* ``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
|
|
||||||
|
|
||||||
To generate new metrics you can `log.info` with a few additional keywords::
|
|
||||||
|
|
||||||
log.info("...", extra={"metric": "my.metric", "value": "1.2", "mtype": "gauge"})
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ Contents
|
|||||||
run
|
run
|
||||||
configure
|
configure
|
||||||
settings
|
settings
|
||||||
|
instrumentation
|
||||||
deploy
|
deploy
|
||||||
design
|
design
|
||||||
signals
|
signals
|
||||||
|
|||||||
37
docs/source/instrumentation.rst
Normal file
37
docs/source/instrumentation.rst
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
.. _instrumentation:
|
||||||
|
|
||||||
|
===============
|
||||||
|
Instrumentation
|
||||||
|
===============
|
||||||
|
|
||||||
|
.. versionadded:: 19.1
|
||||||
|
|
||||||
|
Gunicorn provides an optional instrumentation of the arbiter and
|
||||||
|
workers using the statsD_ protocol over UDP. Thanks to the
|
||||||
|
``gunicorn.instrument.statsd`` module, Gunicorn becomes a statsD client
|
||||||
|
The use of UDP cleanly isolates Gunicorn from the receiving end of the statsD
|
||||||
|
metrics so that instrumentation does not cause Gunicorn to be held up by a slow
|
||||||
|
statsD consumer.
|
||||||
|
|
||||||
|
To use statsD, just tell gunicorn where the statsD server is:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ gunicorn --statsd-host=localhost:8125 ...
|
||||||
|
|
||||||
|
The ``Statsd`` logger overrides ``gunicorn.glogging.Logger`` to track
|
||||||
|
all requests. The following metrics are generated:
|
||||||
|
|
||||||
|
* ``gunicorn.requests``: request rate per second
|
||||||
|
* ``gunicorn.request.duration``: histogram of request duration (in millisecond)
|
||||||
|
* ``gunicorn.workers``: number of workers managed by the arbiter (gauge)
|
||||||
|
* ``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
|
||||||
|
|
||||||
|
To generate new metrics you can ``log.info`` with a few additional keywords::
|
||||||
|
|
||||||
|
log.info("...", extra={"metric": "my.metric", "value": "1.2", "mtype": "gauge"})
|
||||||
|
|
||||||
|
.. _statsD: http://github.com/etsy/statsd
|
||||||
@ -956,7 +956,9 @@ statsd_host
|
|||||||
* ``--statsd-host STATSD_ADDR``
|
* ``--statsd-host STATSD_ADDR``
|
||||||
* ``None``
|
* ``None``
|
||||||
|
|
||||||
host:port of the statsd server to log to
|
``host:port`` of the statsd server to log to.
|
||||||
|
|
||||||
|
.. versionadded:: 19.1
|
||||||
|
|
||||||
statsd_prefix
|
statsd_prefix
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
@ -964,5 +966,8 @@ statsd_prefix
|
|||||||
* ``--statsd-prefix STATSD_PREFIX``
|
* ``--statsd-prefix STATSD_PREFIX``
|
||||||
* ````
|
* ````
|
||||||
|
|
||||||
Prefix to use when emitting statsd metrics (a trailing . is added, if not provided)
|
Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
|
||||||
|
if not provided).
|
||||||
|
|
||||||
|
.. versionadded:: 19.2
|
||||||
|
|
||||||
|
|||||||
@ -1669,7 +1669,9 @@ class StatsdHost(Setting):
|
|||||||
default = None
|
default = None
|
||||||
validator = validate_hostport
|
validator = validate_hostport
|
||||||
desc = """\
|
desc = """\
|
||||||
host:port of the statsd server to log to
|
``host:port`` of the statsd server to log to.
|
||||||
|
|
||||||
|
.. versionadded:: 19.1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class StatsdPrefix(Setting):
|
class StatsdPrefix(Setting):
|
||||||
@ -1680,5 +1682,8 @@ class StatsdPrefix(Setting):
|
|||||||
default = ""
|
default = ""
|
||||||
validator = validate_string
|
validator = validate_string
|
||||||
desc = """\
|
desc = """\
|
||||||
Prefix to use when emitting statsd metrics (a trailing . is added, if not provided)
|
Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
|
||||||
|
if not provided).
|
||||||
|
|
||||||
|
.. versionadded:: 19.2
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user