Support custom metric types (e.g. datadog "distributions")
bforchhammer opened this issue · comments
Hi,
We've been happily using statix for our statsd needs (thanks!), and I'd like to play around with the distributions type, which datadog introduced a little while ago. To my understanding, it works by sending metrics with type d
to the datadog statsd agent.
I looked at the code and currently the metric types are hard coded and rather difficult to extend without replacing both Conn
and Packet
...
Maybe something like the following could be supported?
defmodule MyApp.Statix do
use Statix, custom_metrics_types: %{dd_distribution: "d"}
def distribution(key, val \\ 1, options \\ []) when is_number(val) do
Statix.transmit(current_conn(), :dd_distribution, key, val, options)
end
end
Let me know if this sounds like a reasonable approach; I'd be happy to work on it and provide a pull request!
Would really love to have Distribution metrics too! 😍
Unfortunately the maintainer hasn't been very responsive in this repo, e.g. no reply in this issue from a year ago. Not blaming at all, life happens and no one is obliged to support this library. @lexmag do you think this is something that could be added to Statix?
Will you open the MR @bforchhammer or shall I give it a try? Really keen on having this available. Thanks all for your contributions and push for this. ❤️
@dnlserrano Well, looks like you found some time over the weekend! Awesome, thanks for the PR! ❤️