mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Simpler statsd integration
No need to specify a logger class. --statsd-to is enough to trigger the Statsd logger automatically
This commit is contained in:
parent
c3421a833d
commit
05051aa8b2
@ -154,7 +154,7 @@ statsD consumer.
|
|||||||
|
|
||||||
To use this instrumentation mechanism, simply use a new logger::
|
To use this instrumentation mechanism, simply use a new logger::
|
||||||
|
|
||||||
$ gunicorn --logging-class gunicorn.instrument.statsd.Statsd ...
|
$ gunicorn --statsd-to localhost:8125 ...
|
||||||
|
|
||||||
The `Statsd` logger overrides `gunicorn.glogging.Logger` to track
|
The `Statsd` logger overrides `gunicorn.glogging.Logger` to track
|
||||||
all requests. The following metrics are generated:
|
all requests. The following metrics are generated:
|
||||||
|
|||||||
@ -143,7 +143,12 @@ class Config(object):
|
|||||||
# support the default
|
# support the default
|
||||||
uri = "gunicorn.glogging.Logger"
|
uri = "gunicorn.glogging.Logger"
|
||||||
|
|
||||||
logger_class = util.load_class(uri,
|
# if statsd is on, automagically switch to the statsd logger
|
||||||
|
if 'statsd_to' in self.settings:
|
||||||
|
logger_class = util.load_class("gunicorn.instrument.statsd.Statsd",
|
||||||
|
section="gunicorn.loggers")
|
||||||
|
else:
|
||||||
|
logger_class = util.load_class(uri,
|
||||||
default="gunicorn.glogging.Logger",
|
default="gunicorn.glogging.Logger",
|
||||||
section="gunicorn.loggers")
|
section="gunicorn.loggers")
|
||||||
|
|
||||||
@ -1639,7 +1644,7 @@ if sys.version_info >= (2, 7):
|
|||||||
class StatsdTo(Setting):
|
class StatsdTo(Setting):
|
||||||
name = "statsd_to"
|
name = "statsd_to"
|
||||||
section = "Logging"
|
section = "Logging"
|
||||||
cli = ["--log-statsd-to"]
|
cli = ["--statsd-to"]
|
||||||
meta = "STATSD_ADDR"
|
meta = "STATSD_ADDR"
|
||||||
default = "localhost:8125"
|
default = "localhost:8125"
|
||||||
validator = validate_hostport
|
validator = validate_hostport
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user