File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 28
28
'''Content type of the latest text format'''
29
29
30
30
31
- def make_wsgi_app ():
32
- '''Create a WSGI app which serves the metrics from the registry.'''
31
+ def make_wsgi_app (registry = core . REGISTRY ):
32
+ '''Create a WSGI app which serves the metrics from a registry.'''
33
33
def prometheus_app (environ , start_response ):
34
34
status = str ('200 OK' )
35
35
headers = [(str ('Content-type' ), CONTENT_TYPE_LATEST )]
36
36
start_response (status , headers )
37
- return [generate_latest (core . REGISTRY )]
37
+ return [generate_latest (registry )]
38
38
return prometheus_app
39
39
40
40
41
- def start_wsgi_server (port , addr = '' ):
41
+ def start_wsgi_server (port , addr = '' , registry = core . REGISTRY ):
42
42
"""Starts a WSGI server for prometheus metrics as a daemon thread."""
43
43
class PrometheusMetricsServer (threading .Thread ):
44
44
def run (self ):
45
- httpd = make_server (addr , port , make_wsgi_app ())
45
+ httpd = make_server (addr , port , make_wsgi_app (registry ))
46
46
httpd .serve_forever ()
47
47
t = PrometheusMetricsServer ()
48
48
t .daemon = True
You can’t perform that action at this time.
0 commit comments