Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit fe7f982

Browse files
Merge pull request #82 from microservices-demo/monitoring/label-rename
Rename path label to route and add service label
2 parents 30f0673 + 73bb871 commit fe7f982

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

api/metrics/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
const metric = {
99
http: {
1010
requests: {
11-
duration: new client.Summary('request_duration_seconds', 'request duration in seconds', ['method', 'path', 'status_code']),
11+
duration: new client.Summary('request_duration_seconds', 'request duration in seconds', ['service', 'method', 'route', 'status_code']),
1212
}
1313
}
1414
}
@@ -19,11 +19,11 @@
1919
}
2020

2121
function observe(method, path, statusCode, start) {
22-
var path = path.toLowerCase();
23-
if (path !== '/metrics' && path !== '/metrics/') {
22+
var route = path.toLowerCase();
23+
if (route !== '/metrics' && route !== '/metrics/') {
2424
var duration = s(start);
2525
var method = method.toLowerCase();
26-
metric.http.requests.duration.labels(method, path, statusCode).observe(duration);
26+
metric.http.requests.duration.labels('front-end', method, route, statusCode).observe(duration);
2727
}
2828
};
2929

0 commit comments

Comments
 (0)