Skip to content

Commit cc5c803

Browse files
committed
Merge pull request #6 from rymo4/fix_floats_in_mean
Fix How Mean Deals With Floats
2 parents 45b7f50 + f7f0680 commit cc5c803

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

statsdaemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func processTimers(buffer *bytes.Buffer, numStats *int, now int64) {
209209
var z Uint64Slice
210210
timers[u] = z
211211

212-
fmt.Fprintf(buffer, "%s.mean %d %d\n", u, mean, now)
212+
fmt.Fprintf(buffer, "%s.mean %f %d\n", u, mean, now)
213213
fmt.Fprintf(buffer, "%s.upper %d %d\n", u, max, now)
214214
fmt.Fprintf(buffer, "%s.lower %d %d\n", u, min, now)
215215
fmt.Fprintf(buffer, "%s.count %d %d\n", u, count, now)

statsdaemon_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestMean(t *testing.T) {
102102
processTimers(buff, &numStats, time.Now().Unix())
103103
assert.Equal(t, numStats, 1)
104104
dataForGraphite := buff.String()
105-
meanRegexp := regexp.MustCompile("response_time.mean.*float64=20")
105+
meanRegexp := regexp.MustCompile("response_time.mean.*20")
106106

107107
matched := meanRegexp.MatchString(dataForGraphite)
108108
assert.Equal(t, matched, true)

0 commit comments

Comments
 (0)