2626import os
2727import errno
2828import logging
29+ import analytics
30+
2931from logging import handlers
3032from queryHandler .QueryHandler import PerfmonConnError
3133from queryHandler import SensorConfig
3840from prometheus import PrometheusExporter
3941from watcher import ConfigWatcher
4042from cherrypy import _cperror
43+ from cherrypy .lib .cpstats import StatsPage
4144
4245ENDPOINTS = {}
4346
@@ -114,6 +117,7 @@ def bind_opentsdb_server(args):
114117 opentsdb_server .ssl_module = 'builtin'
115118 opentsdb_server .ssl_certificate = certPath
116119 opentsdb_server .ssl_private_key = keyPath
120+ opentsdb_server .statistics = analytics .cherrypy_internal_stats
117121 opentsdb_server .subscribe ()
118122
119123
@@ -126,6 +130,7 @@ def bind_prometheus_server(args):
126130 prometheus_server .ssl_module = 'builtin'
127131 prometheus_server .ssl_certificate = certPath
128132 prometheus_server .ssl_private_key = keyPath
133+ prometheus_server .statistics = analytics .cherrypy_internal_stats
129134 prometheus_server .subscribe ()
130135
131136
@@ -278,7 +283,6 @@ def main(argv):
278283 {'request.dispatch' : cherrypy .dispatch .MethodDispatcher ()}
279284 }
280285 )
281-
282286 registered_apps .append ("OpenTSDB Api listening on Grafana queries" )
283287
284288 if args .get ('prometheus' , None ):
@@ -317,6 +321,7 @@ def main(argv):
317321 }
318322 )
319323 registered_apps .append ("Prometheus Exporter Api listening on Prometheus requests" )
324+ cherrypy .tree .mount (StatsPage (), '/cherrypy_internal_stats' )
320325
321326 logger .info ("%s" , MSG ['sysStart' ].format (sys .version , cherrypy .__version__ ))
322327
0 commit comments