brubeck icon indicating copy to clipboard operation
brubeck copied to clipboard

Statsd server uses \n as separator for multiple metrics

Open goir opened this issue 9 years ago • 4 comments

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 ?

goir avatar Jun 18 '15 18:06 goir

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. :)

vmg avatar Jun 22 '15 10:06 vmg

Works on my machine ;)

pmyjavec avatar Jun 24 '15 08:06 pmyjavec

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

loyd avatar Nov 21 '18 06:11 loyd

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

genuss avatar Nov 21 '18 21:11 genuss