@@ -450,6 +450,7 @@ func TestPacketHandlerGauge(t *testing.T) {
450450
451451func TestPacketHandlerTimer (t * testing.T ) {
452452 timers = make (map [string ]Float64Slice )
453+ counters = make (map [string ]float64 )
453454
454455 p := & Packet {
455456 Bucket : "glork" ,
@@ -460,11 +461,13 @@ func TestPacketHandlerTimer(t *testing.T) {
460461 packetHandler (p )
461462 assert .Equal (t , len (timers ["glork" ]), 1 )
462463 assert .Equal (t , timers ["glork" ][0 ], float64 (320 ))
464+ assert .Equal (t , counters ["glork.count" ], 1.0 )
463465
464466 p .ValFlt = float64 (100 )
465467 packetHandler (p )
466468 assert .Equal (t , len (timers ["glork" ]), 2 )
467469 assert .Equal (t , timers ["glork" ][1 ], float64 (100 ))
470+ assert .Equal (t , counters ["glork.count" ], 2.0 )
468471}
469472
470473func TestPacketHandlerSet (t * testing.T ) {
@@ -558,7 +561,7 @@ func TestProcessTimers(t *testing.T) {
558561 assert .Equal (t , string (lines [0 ]), "response_time.mean 20 1418052649" )
559562 assert .Equal (t , string (lines [1 ]), "response_time.upper 30 1418052649" )
560563 assert .Equal (t , string (lines [2 ]), "response_time.lower 0 1418052649" )
561- assert . Equal ( t , string ( lines [ 3 ]), " response_time.count 3 1418052649" )
564+ // response_time.count handled by processCounters, not processTimers
562565
563566 num = processTimers (& buffer , now , Percentiles {})
564567 assert .Equal (t , num , int64 (0 ))
@@ -769,7 +772,11 @@ func TestMultipleUDPSends(t *testing.T) {
769772}
770773
771774func BenchmarkManyDifferentSensors (t * testing.B ) {
775+ counters = make (map [string ]float64 )
776+ gauges = make (map [string ]float64 )
777+ timers = make (map [string ]Float64Slice )
772778 r := rand .New (rand .NewSource (438 ))
779+
773780 for i := 0 ; i < 1000 ; i ++ {
774781 bucket := "response_time" + strconv .Itoa (i )
775782 for i := 0 ; i < 10000 ; i ++ {
@@ -925,6 +932,7 @@ func BenchmarkPacketHandlerTimer(b *testing.B) {
925932 d1 := parseLine ([]byte ("glork.some.keyspace:3.7211|ms" ))
926933 d2 := parseLine ([]byte ("glork.some.keyspace:11223|ms" ))
927934 timers = make (map [string ]Float64Slice )
935+ counters = make (map [string ]float64 )
928936
929937 for i := 0 ; i < b .N ; i ++ {
930938 packetHandler (d1 )
0 commit comments