github / brubeck

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

Statsd server uses \n as separator for multiple metrics #16

Open goir opened 9 years ago

goir commented 9 years ago

The official statsd node client uses \n as separator for multiple metrics in a single packet.

https://github.com/etsy/statsd/blob/master/docs/server.md "Multiple metrics can be received in a single packet if separated by the \n character."

Update: A simple python script to test this:

import socket
addr = (socket.gethostbyname('localhost'), 8126)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
print sock.sendto('foo.baz:1|c\nfoo.def:1|c\n', addr)

This gives me instance=brubeck_debug sampler=statsd event=bad_key key='foo.baz:1|c foo.def:1|c ' from=127.0.0.1

If I use "\0" or "\n\0" as the separator I don't the the error but just the first metric is send to carbon.

Is it possible to support multiple metrics in one package ?

vmg commented 9 years ago

Hi @goir! Multiple metrics in one package can be supported, but these are one of the features we didn't implement because we don't use them in production. Pull requests are always welcome. :)

pmyjavec commented 9 years ago

Works on my machine ;)

loyd commented 5 years ago

So, it's already implemented, am I right?

genuss commented 5 years ago

Looks like so, but beware enabling recvmmsg it can cause issues.