Skip to content

Commit

Permalink
Merge pull request quasor#3 from redterror/master
Browse files Browse the repository at this point in the history
Move the 'mean' calculation to before the pct_threshold adjustments
  • Loading branch information
quasor committed Apr 27, 2012
2 parents 9d1c55e + 1d726bd commit ca10606
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/statsd/graphite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def flush_stats
max_at_threshold = max

if (count > 1)
# average all the timing data
sum = values.inject( 0 ) { |s,x| s+x }
mean = sum / values.count

# strip off the top 100-threshold
threshold_index = (((100 - pct_threshold) / 100.0) * count).round
values = values[0..-threshold_index]
max_at_threshold = values.last

# average the remaining timings
sum = values.inject( 0 ) { |s,x| s+x }
mean = sum / values.count
end

message = ""
Expand Down

0 comments on commit ca10606

Please sign in to comment.