mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-01-19 00:37:36 +01:00
This happens, for example, when a http proxy in front of the application is configured with a timeout and the node server is too slow to respond. Currently such timeouts are counted as 200s by express-prom-bundle. This PR changes that to 499 "Client Closed Request". This way it's possible to tell them apart.
12 lines
217 B
JavaScript
12 lines
217 B
JavaScript
'use strict';
|
|
|
|
const CLIENT_CLOSED_REQUEST_CODE = 499;
|
|
|
|
module.exports = function(res) {
|
|
if (res.headersSent) {
|
|
return res.status_code || res.statusCode;
|
|
} else {
|
|
return CLIENT_CLOSED_REQUEST_CODE;
|
|
}
|
|
};
|