8000 Document statsd_* commands. · alex-python/gunicorn@f0b9468 · GitHub
[go: up one dir, main page]

Skip to content

Commit f0b9468

Browse files
committed
Document statsd_* commands.
1 parent 43d1eba commit f0b9468

File tree

5 files changed

+52
-33
lines changed

5 files changed

+52
-33
lines changed

README.rst

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,6 @@ Example with test app::
4545
$ gunicorn --workers=2 test:app
4646

4747

48-
Instrumentation
49-
---------------
50-
51-
Gunicorn provides an optional instrumentation of the arbiter and
52-
workers using the statsD_ protocol over UDP. Thanks to the
53-
`gunicorn.instrument.statsd` module, Gunicorn becomes a statsD client
54-
The use of UDP cleanly isolates Gunicorn from the receiving end of the statsD
55-
metrics so that instrumentation does not cause Gunicorn to be held up by a slow
56-
statsD consumer.
57-
58-
To use statsD, just tell gunicorn where the statsD server is:
59-
60-
$ gunicorn --statsd-host=localhost:8125 ...
61-
62-
The `Statsd` logger overrides `gunicorn.glogging.Logger` to track
63-
all requests. The following metrics are generated:
64-
65-
* ``gunicorn.requests``: request rate per second
66-
* ``gunicorn.request.duration``: histogram of request duration (in millisecond)
67-
* ``gunicorn.workers``: number of workers managed by the arbiter (gauge)
68-
* ``gunicorn.log.critical``: rate of critical log messages
69-
* ``gunicorn.log.error``: rate of error log messages
70-
* ``gunicorn.log.warning``: rate of warning log messages
71-
* ``gunicorn.log.exception``: rate of exceptional log messages
72-
73-
To generate new metrics you can `log.info` with a few additional keywords::
74-
75-
log.info("...", extra={"metric": "my.metric", "value": "1.2", "mtype": "gauge"})
76-
7748
License
7849
-------
7950

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Contents
4040
run
4141
configure
4242
settings
43+
instrumentation
4344
deploy
4445
design
4546
signals

docs/source/instrumentation.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _instrumentation:
2+
3+
===============
4+
Instrumentation
5+
===============
6+
7+
.. versionadded:: 19.1
8+
9+
Gunicorn provides an optional instrumentation of the arbiter and
10+
workers using the statsD_ protocol over UDP. Thanks to the
11+
``gunicorn.instrument.statsd`` module, Gunicorn becomes a statsD client
12+
The use of UDP cleanly isolates Gunicorn from the receiving end of the statsD
13+
metrics so that instrumentation does not cause Gunicorn to be held up by a slow
14+
statsD consumer.
15+
16+
To use statsD, just tell gunicorn where the statsD server is:
17+
18+
.. code-block:: bash
19+
20+
$ gunicorn --statsd-host=localhost:8125 ...
21+
22+
The ``Statsd`` logger overrides ``gunicorn.glogging.Logger`` to track
23+
all requests. The following metrics are generated:
24+
25+
* ``gunicorn.requests``: request rate per second
26+
* ``gunicorn.request.duration``: histogram of request duration (in millisecond)
27+
* ``gunicorn.workers``: number of workers managed by the arbiter (gauge)
28+
* ``gunicorn.log.critical``: rate of critical log messages
29+
* ``gunicorn.log.error``: rate of error log messages
30+
* ``gunicorn.log.warning``: rate of warning log messages
31+
* ``gunicorn.log.exception``: rate of exceptional log messages
32+
33+
To generate new metrics you can ``log.info`` with a few additional keywords::
34+
35+
log.info("...", extra={"metric": "my.metric", "value": "1.2", "mtype": "gauge"})
36+
37+
.. _statsD: http://github.com/etsy/statsd

docs/source/settings.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,13 +956,18 @@ statsd_host
956956
* ``--statsd-host STATSD_ADDR``
957957
* ``None``
958958

959-
host:port of the statsd server to log to
959+
``host:port`` of the statsd server to log to.
960+
961+
.. versionadded:: 19.1
960962

961963
statsd_prefix
962964
~~~~~~~~~~~~~
963965

964966
* ``--statsd-prefix STATSD_PREFIX``
965967
* ````
966968

967-
Prefix to use when emitting statsd metrics (a trailing . is added, if not provided)
969+
Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
970+
if not provided).
971+
972+
.. versionadded:: 19.2
968973

gunicorn/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,9 @@ class StatsdHost(Setting):
16691669
default = None
16701670
validator = validate_hostport
16711671
desc = """\
1672-
host:port of the statsd server to log to
1672+
``host:port`` of the statsd server to log to.
1673+
1674+
.. versionadded:: 19.1
16731675
"""
16741676

16751677
class StatsdPrefix(Setting):
@@ -1680,5 +1682,8 @@ class StatsdPrefix(Setting):
16801682
default = ""
16811683
validator = validate_string
16821684
desc = """\
1683-
Prefix to use when emitting statsd metrics (a trailing . is added, if not provided)
1685+
Prefix to use when emitting statsd metrics (a trailing ``.`` is added,
1686+
if not provided).
1687+
1688+
.. versionadded:: 19.2
16841689
"""

0 commit comments

Comments
 (0)
0