Allow specifying statsd host/port/prefix info

Currently only passes it through to CHP. This is needed
for the cases when JupyterHub spawns and maintains CHP.
This commit is contained in:
YuviPanda
2016-03-30 18:59:32 -07:00
parent 2bbfd75f4d
commit c6d05d0840

View File

@@ -449,6 +449,20 @@ class JupyterHub(Application):
"""
).tag(config=True)
statsd_host = Unicode(
help="Host to send statds metrics to"
).tag(config=True)
statsd_port = Int(
8125,
help="Port on which to send statsd metrics about the hub"
).tag(config=True)
statsd_prefix = Unicode(
'jupyterhub',
help="Prefix to use for all metrics sent by jupyterhub to statsd"
)
handlers = List()
_log_formatter_cls = CoroutineLogFormatter
@@ -867,6 +881,12 @@ class JupyterHub(Application):
cmd.extend(['--ssl-key', self.ssl_key])
if self.ssl_cert:
cmd.extend(['--ssl-cert', self.ssl_cert])
if self.statsd_host:
cmd.extend([
'--statsd-host', self.statsd_host,
'--statsd-port', self.statsd_port,
'--statsd-prefix', self.statsd_prefix + '.chp'
])
# Require SSL to be used or `--no-ssl` to confirm no SSL on
if ' --ssl' not in ' '.join(cmd):
if self.confirm_no_ssl: