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 import cpstats
44+ from cherrypy .lib .cpstats import StatsPage
4145
4246ENDPOINTS = {}
4347
@@ -114,6 +118,7 @@ def bind_opentsdb_server(args):
114118 opentsdb_server .ssl_module = 'builtin'
115119 opentsdb_server .ssl_certificate = certPath
116120 opentsdb_server .ssl_private_key = keyPath
121+ opentsdb_server .statistics = analytics .cherrypy_internal_stats
117122 opentsdb_server .subscribe ()
118123
119124
@@ -126,6 +131,7 @@ def bind_prometheus_server(args):
126131 prometheus_server .ssl_module = 'builtin'
127132 prometheus_server .ssl_certificate = certPath
128133 prometheus_server .ssl_private_key = keyPath
134+ prometheus_server .statistics = analytics .cherrypy_internal_stats
129135 prometheus_server .subscribe ()
130136
131137
@@ -278,7 +284,6 @@ def main(argv):
278284 {'request.dispatch' : cherrypy .dispatch .MethodDispatcher ()}
279285 }
280286 )
281-
282287 registered_apps .append ("OpenTSDB Api listening on Grafana queries" )
283288
284289 if args .get ('prometheus' , None ):
@@ -317,6 +322,7 @@ def main(argv):
317322 }
318323 )
319324 registered_apps .append ("Prometheus Exporter Api listening on Prometheus requests" )
325+ cherrypy .tree .mount (StatsPage (), '/cherrypy_internal_stats' )
320326
321327 logger .info ("%s" , MSG ['sysStart' ].format (sys .version , cherrypy .__version__ ))
322328
0 commit comments