jochen-schweizer / express-prom-bundle

express middleware with standard prometheus metrics in one bundle
MIT License
303 stars 67 forks source link

Use statuscode 499 for requests that are closed before response is sent #120

Closed petuomin closed 9 months ago

petuomin commented 1 year ago

Sometimes requests are closed by client before the server has a chance to send response.

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. It would also happen if the user's browser goes away without waiting for the response.

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.

petuomin commented 1 year ago

Hi @disjunction

Do you think you could find some time to have a look at this PR. I would really appreciate it. Working around the misleading metrics is bit annyoing.