Skip to content

Support custom metric types (e.g. datadog "distributions") #46

@bforchhammer

Description

@bforchhammer

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions