Skip to content

Commit 7a3c0f3

Browse files
committed
Rename prometheus metrics to be more standard
1 parent de13203 commit 7a3c0f3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

notebook/metrics.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
from prometheus_client import Histogram
99

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'],
1515
)
1616

1717
def prometheus_log_method(handler):
@@ -30,8 +30,8 @@ def prometheus_log_method(handler):
3030
that is the 'log_function' tornado setting. This makes it get called
3131
at the end of every request, allowing us to record the metrics we need.
3232
"""
33-
REQUEST_DURATION_SECONDS.labels(
33+
HTTP_REQUEST_DURATION_SECONDS.labels(
3434
method=handler.request.method,
3535
handler='{}.{}'.format(handler.__class__.__module__, type(handler).__name__),
36-
code=handler.get_status()
36+
status_code=handler.get_status()
3737
).observe(handler.request.request_time())

0 commit comments

Comments
 (0)