-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Ensure rate sinks with no samples are formatted as 0% #2542
Conversation
7d59319
to
18d6d36
Compare
Tests are currently failing because of chromium/badssl.com#504 |
func (r RateSink) Format(t time.Duration) map[string]float64 { | ||
return map[string]float64{"rate": float64(r.Trues) / float64(r.Total)} | ||
var rate float64 | ||
if r.Total > 0 { | ||
rate = float64(r.Trues) / float64(r.Total) | ||
} | ||
|
||
return map[string]float64{"rate": rate} |
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.
This is also used for the API calls which likely is fine. But I kind of feel it might be better instead of this small fix to write bigger one where we actually remove Format and just write the logical for each of those 2 cases
see #2320
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.
I am approving this and pushing #2320 for this milestone in hopes someone finds time to work on it
Addresses #2540