Skip to content

Commit

Permalink
Fix how mean deals with floats
Browse files Browse the repository at this point in the history
  • Loading branch information
rymo4 committed Jul 16, 2013
1 parent 45b7f50 commit f7f0680
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion statsdaemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func processTimers(buffer *bytes.Buffer, numStats *int, now int64) {
var z Uint64Slice
timers[u] = z

fmt.Fprintf(buffer, "%s.mean %d %d\n", u, mean, now)
fmt.Fprintf(buffer, "%s.mean %f %d\n", u, mean, now)
fmt.Fprintf(buffer, "%s.upper %d %d\n", u, max, now)
fmt.Fprintf(buffer, "%s.lower %d %d\n", u, min, now)
fmt.Fprintf(buffer, "%s.count %d %d\n", u, count, now)
Expand Down
2 changes: 1 addition & 1 deletion statsdaemon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func TestMean(t *testing.T) {
processTimers(buff, &numStats, time.Now().Unix())
assert.Equal(t, numStats, 1)
dataForGraphite := buff.String()
meanRegexp := regexp.MustCompile("response_time.mean.*float64=20")
meanRegexp := regexp.MustCompile("response_time.mean.*20")

matched := meanRegexp.MatchString(dataForGraphite)
assert.Equal(t, matched, true)
Expand Down

0 comments on commit f7f0680

Please sign in to comment.