7
7
8
8
from prometheus_client import Histogram
9
9
10
- # This is a fairly standard name for HTTP request latency reporting.
11
- REQUEST_DURATION_SECONDS = Histogram (
12
- 'request_duration_seconds ' ,
13
- 'request duration for all HTTP requests' ,
14
- ['method' , 'handler' , 'code ' ],
10
+ # This is a fairly standard name for HTTP duration latency reporting
11
+ HTTP_REQUEST_DURATION_SECONDS = Histogram (
12
+ 'http_request_duration_seconds ' ,
13
+ 'duration in seconds for all HTTP requests' ,
14
+ ['method' , 'handler' , 'status_code ' ],
15
15
)
16
16
17
17
def prometheus_log_method (handler ):
@@ -30,8 +30,8 @@ def prometheus_log_method(handler):
30
30
that is the 'log_function' tornado setting. This makes it get called
31
31
at the end of every request, allowing us to record the metrics we need.
32
32
"""
33
- REQUEST_DURATION_SECONDS .labels (
33
+ HTTP_REQUEST_DURATION_SECONDS .labels (
34
34
method = handler .request .method ,
35
35
handler = '{}.{}' .format (handler .__class__ .__module__ , type (handler ).__name__ ),
36
- code = handler .get_status ()
36
+ status_code = handler .get_status ()
37
37
).observe (handler .request .request_time ())
0 commit comments