26
26
import os
27
27
import errno
28
28
import logging
29
+ import analytics
30
+
29
31
from logging import handlers
30
32
from queryHandler .QueryHandler import PerfmonConnError
31
33
from queryHandler import SensorConfig
38
40
from prometheus import PrometheusExporter
39
41
from watcher import ConfigWatcher
40
42
from cherrypy import _cperror
43
+ from cherrypy .lib import cpstats
44
+ from cherrypy .lib .cpstats import StatsPage
41
45
42
46
ENDPOINTS = {}
43
47
@@ -114,6 +118,7 @@ def bind_opentsdb_server(args):
114
118
opentsdb_server .ssl_module = 'builtin'
115
119
opentsdb_server .ssl_certificate = certPath
116
120
opentsdb_server .ssl_private_key = keyPath
121
+ opentsdb_server .statistics = analytics .cherrypy_internal_stats
117
122
opentsdb_server .subscribe ()
118
123
119
124
@@ -126,6 +131,7 @@ def bind_prometheus_server(args):
126
131
prometheus_server .ssl_module = 'builtin'
127
132
prometheus_server .ssl_certificate = certPath
128
133
prometheus_server .ssl_private_key = keyPath
134
+ prometheus_server .statistics = analytics .cherrypy_internal_stats
129
135
prometheus_server .subscribe ()
130
136
131
137
@@ -278,7 +284,6 @@ def main(argv):
278
284
{'request.dispatch' : cherrypy .dispatch .MethodDispatcher ()}
279
285
}
280
286
)
281
-
282
287
registered_apps .append ("OpenTSDB Api listening on Grafana queries" )
283
288
284
289
if args .get ('prometheus' , None ):
@@ -317,6 +322,7 @@ def main(argv):
317
322
}
318
323
)
319
324
registered_apps .append ("Prometheus Exporter Api listening on Prometheus requests" )
325
+ cherrypy .tree .mount (StatsPage (), '/cherrypy_internal_stats' )
320
326
321
327
logger .info ("%s" , MSG ['sysStart' ].format (sys .version , cherrypy .__version__ ))
322
328
0 commit comments