Skip to content

Commit 48fd194

Browse files
committed
fix(metrics): use rule as path
Using the real path as metric created useless metrics. When using a dynamic rule, it creates unique paths with every metric, which makes it impossible to aggregate metrics to the same endpoint.
1 parent 893f14b commit 48fd194

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyms/flask/services/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def before_request(self): # pylint: disable=R0201
3131

3232
def after_request(self, response):
3333
request_latency = time.time() - request.start_time
34-
FLASK_REQUEST_LATENCY.labels(self.app_name, request.method, request.path, response.status_code).observe(request_latency)
35-
FLASK_REQUEST_COUNT.labels(self.app_name, request.method, request.path, response.status_code).inc()
34+
FLASK_REQUEST_LATENCY.labels(self.app_name, request.method, request.url_rule.rule, response.status_code).observe(request_latency)
35+
FLASK_REQUEST_COUNT.labels(self.app_name, request.method, request.url_rule.rule, response.status_code).inc()
3636

3737
return response
3838

0 commit comments

Comments
 (0)