Skip to content

feat: handle Wilson Score Boundary Conditions better

Part of #153 and https://gitlab.com/gitlab-com/gl-infra/gitlab-dedicated/team/-/issues/4774

👈 Follow-on from !7336 (merged)

Currently, we see boundary conditions affecting wilson scores:

  1. total == 0: in the original implementation, this is handled by returning a [0,1] interval for total = 0. Currently, we do not test for this condition, and the expression returns a NaN owing to division by zero. When total = 0, Apdex should be 100% (1) on the upper boundary, and Error Rate should be 0% (0) on the lower boundary. This change nows tests for this condition, and returns a correct value.

  2. Due to floating point maths rounding errors, values can sometimes be very, very close to 1 but slightly above, or very close to 0, but slightly below. The difference is 4e-9 or thereabouts, but this can have knock-on effects. For this reason, we now clamp explicitely to [0,1] range for output.

Edited by Andrew Newdigate

Merge request reports