Skip to content

Don't record duration for errors

Bob Van Landuyt requested to merge bvl-duration-recording into master

What does this MR do?

This makes the request duration histograms consistent across both metrics and only records it when the request was successful.

It also makes sure that the way the error was received in the middleware does not matter anymore. Before this change, an error that bubbled up towards the middleware would count towards a groups error budget, but not towards the service availability. With this, both metrics will not include durations of requests that resulted in responses with a 5xx status code.

If a request failed, it's not very important for users how fast it failed.

For our metrics it could also skew results: A very fast 500 would have less impact on a service's availability or a groups budget spend than a slow one. While they should weigh the same. Similarly, a slow failure should not count double towards availability.

This results in the following scoring for requests:

Fast Slow
Success 2/2 1/2
Error 0/1 0/1

Part of gitlab-com/gl-infra/scalability#1098 (closed)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Bob Van Landuyt

Merge request reports

Loading