Count requests even when the info is not complete
This commit is contained in:
parent
a68618c336
commit
22086ba914
@ -79,21 +79,23 @@ module.exports = function metricsCollector () {
|
||||
const { statusCode, headers } = response;
|
||||
const { 'carto-user': user } = headers;
|
||||
|
||||
if (statusCode === undefined || headers === undefined || user === undefined) {
|
||||
this.push(chunk);
|
||||
return callback();
|
||||
}
|
||||
|
||||
requestCounter.inc();
|
||||
|
||||
if (statusCode !== undefined && user !== undefined) {
|
||||
userRequestCounter.labels(user, `${statusCode}`).inc();
|
||||
}
|
||||
|
||||
if (statusCode >= 200 && statusCode < 400) {
|
||||
requestOkCounter.inc();
|
||||
if (user !== undefined) {
|
||||
userRequestOkCounter.labels(user, `${statusCode}`).inc();
|
||||
} else {
|
||||
}
|
||||
} else if (statusCode >= 400) {
|
||||
requestErrorCounter.inc();
|
||||
if (user !== undefined) {
|
||||
userRequestErrorCounter.labels(user, `${statusCode}`).inc();
|
||||
}
|
||||
}
|
||||
|
||||
const { response: responseTime } = stats;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user