Skip to content
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

Merged
merged 1 commit into from
May 18, 2022

Conversation

oleiade
Copy link
Member

@oleiade oleiade commented May 17, 2022

Addresses #2540

@oleiade oleiade added the bug label May 17, 2022
@oleiade oleiade added this to the v0.39.0 milestone May 17, 2022
@oleiade oleiade self-assigned this May 17, 2022
@oleiade oleiade requested review from mstoykov and removed request for na-- May 17, 2022 13:42
@oleiade oleiade force-pushed the fix/nan_on_rate_thresholds branch from 7d59319 to 18d6d36 Compare May 17, 2022 13:45
@oleiade
Copy link
Member Author

oleiade commented May 17, 2022

Tests are currently failing because of chromium/badssl.com#504

Comment on lines 189 to +195
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}
Copy link
Contributor

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

Copy link
Contributor

@mstoykov mstoykov left a 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

@oleiade
Copy link
Member Author

oleiade commented May 18, 2022

Cheers @mstoykov I'll work on #2320 for v0.39.0

@oleiade oleiade merged commit 5f16f6d into master May 18, 2022
@oleiade oleiade deleted the fix/nan_on_rate_thresholds branch May 18, 2022 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants