Skip to content


Simplify threshold calculation #177

merged 1 commit into from

2 participants


This is in reference to pull 63
Has been updated to the new code in that section.
Change is also being committed to my branch that moves calculations back out of the backend.

Etsy, Inc. member

I'm confused about this. Is this also in pull request 167 or not? And if it is why did you resubmit it here?


Sorry for the confusion. This is an updated patch for the pull request #63.
Figured this was a simple patch that could be applied while waiting for pull request 167 was pending review.

I was looking through the pull requests to see if any were related to the graphite.js metric calculation code in case i needed to apply them to the processed_metrics.js file.

I've added this patch to that pull request as well so its not lost in the transition:

Etsy, Inc. member


@mrtazz mrtazz merged commit 3edcf08 into etsy:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 19, 2012
  1. @draco2003
Showing with 1 addition and 2 deletions.
  1. +1 −2 backends/graphite.js
3 backends/graphite.js
@@ -95,8 +95,7 @@ var flush_stats = function graphite_flush(ts, metrics) {
for (key2 in pctThreshold) {
var pct = pctThreshold[key2];
if (count > 1) {
- var thresholdIndex = Math.round(((100 - pct) / 100) * count);
- var numInThreshold = count - thresholdIndex;
+ var numInThreshold = Math.round(pct / 100 * count);
maxAtThreshold = values[numInThreshold - 1];
sum = cumulativeValues[numInThreshold - 1];
Something went wrong with that request. Please try again.