github / brubeck

A Statsd-compatible metrics aggregator
MIT License
1.19k stars 94 forks source link

Gauge overflow #57

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi Seems like brubeck got overflow, when handling gauge-value more, than 2^32 (4294967296).

(I did not find in statsd specification max values for gauge: https://github.com/etsy/statsd/blob/master/docs/metric_types.md, and in my production envs we often sent values more than 2^32)

How to reproduce:

  1. Send metric to brubeck and watch network packets (I use ngrep): echo "complex.delete_me.mem:4294967296|g" | nc -u -q1 127.0.0.1 8126 ... U 127.0.0.1:38487 -> 127.0.0.1:8126 complex.delete_me.mem:4294967296|g.

  2. Watch network traffic from brubeck to storage: T 10.0.2.9:53546 -> 10.9.192.2:2003 [AP] complex.delete_me.mem 0 1493135074. # brubeck send 0 instead of 4294967296

My investigation lead me to this function. https://github.com/github/brubeck/blob/master/src/utils.c#L137

May you provide fix for that case? Thanks in advance!

ccl0326 commented 7 years ago

37 I think this patch can fix this.