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

Fix StatsD p100 calculation #3230

Merged
merged 2 commits into from
Sep 14, 2017
Merged

Fix StatsD p100 calculation #3230

merged 2 commits into from
Sep 14, 2017

Conversation

tpounds
Copy link
Contributor

@tpounds tpounds commented Sep 14, 2017

Fixes an index out of range panic when calculating p100. The following line evaluates to the length of the array when n = 100.

i := int(float64(len(rs.perc)) * float64(n) / float64(100))

I've updated the existing tests to check p0 and p100 boundary conditions.

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated. (N/A)
  • Has appropriate unit tests.

@danielnelson danielnelson added bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf labels Sep 14, 2017
@danielnelson danielnelson added this to the 1.4.1 milestone Sep 14, 2017
@tpounds
Copy link
Contributor Author

tpounds commented Sep 14, 2017

@danielnelson Looks like CircleCI failures are unrelated. LMK if there is something I should address.

@danielnelson
Copy link
Contributor

Yeah, AWS is having some issues I think, I'll try to re-run the tests later today.

@danielnelson danielnelson changed the base branch from release-1.4 to master September 14, 2017 21:30
@danielnelson
Copy link
Contributor

I changed the destination branch to master, you will need to rebase with -i and remove the unrelated changes and force push.

Fixes index out of range panic by clamping
index to valid min/max range.
@tpounds
Copy link
Contributor Author

tpounds commented Sep 14, 2017

Rebased. CircleCI failure still appears to be unrelated.

@danielnelson danielnelson merged commit 7337287 into influxdata:master Sep 14, 2017
danielnelson pushed a commit that referenced this pull request Sep 14, 2017
maxunt pushed a commit that referenced this pull request Jun 26, 2018
@tpounds tpounds deleted the fix-statsd-p0-p100 branch October 20, 2018 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants