Shopify / statsd-instrument

A StatsD client for Ruby apps. Provides metaprogramming methods to inject StatsD instrumentation into your code.
http://shopify.github.io/statsd-instrument
MIT License
570 stars 94 forks source link

Add support for parsing service check and event datagrams. #234

Closed wvanbergen closed 4 years ago

wvanbergen commented 4 years ago

We currently do not support parsing the custom datagrams that DogStatsD support, i.e. service checks and events. Note that we are perfectly able to send them. But if we capture them, we cannot parse them. This is mostly a problem for test suites that want to run assertions on properties of the datagrams.

This PR implements parsing the datagrams by subclassing Datagram, add regular expressions for those datagram types, and use Regexp.union to construct a parser that supports all of the datagrams.

Note: we only support parsing datagrams as generated by this library, not necessarily every datagram out there. Given the use case, that is fine I think.