New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #20607: Make possible to choose precision in compliance percent API #4127
Conversation
* (given that we have 14 categories, it means that at worst, if 13 are at 0.1 in place of ~0%; | ||
* the last one will be false by 0.13%, which is ok) | ||
* - always keeps at least 10e(-precision)% for any case | ||
* (given that we have 14 categories, it means that at worst, if 13 are at the mean in place of ~0%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* (given that we have 14 categories, it means that at worst, if 13 are at the mean in place of ~0%; | |
* (given that we have 14 categories, it means that at worst, if 13 are at the min in place of ~0%; |
type: integer | ||
example: 0 | ||
default: 2 | ||
description: Number of digits after comma in compliance percent figures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can maybe precise here that a low value will never be zero and that is it not a simple rounding.
OK, merging this PR |
This is a nice change. I'm indeed not sure of the impact of the lazy val - i did not notice anything significant in my tests - i'm still unsure if we can do better than that or not, but that will be for a next iteration, as perfs are satisfactory |
https://issues.rudder.io/issues/20607
Superseed #4115 and keep #4110 for correction of https://issues.rudder.io/issues/20573
The idea is to be able to specify what precision we want for compliance percent in the API calls, and let the backend compute compliance with that value. Most of the pr is passing the
precision
parameter around.Note that we can't specify
precision
value for thelazy val pc
attribute inComplianceLevel
instance, so a default value of2
is kept. Thatpc
value does not seems to be used in the compliance displaying for UI, so it makes me wonder if we really need an heavy lazy val in eachComplianceLevel
objects, perhaps we should only compute it when needed withCompliancePercent.fromLevels(c, precision)
- cc @ncharles for that.The 2nd commit totaly remove
lazy val
fromComplianceLevel
object. It will free 3 object alloc by compliance level object, which is not nothing given the number of short lived ones we have, and it seems that there is not many places where they are reused (and where it can't be computed before the different use place).