Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bforchhammer opened this issue Dec 19, 2019 · 3 comments · Fixed by SalesLoft/statix#3 · May be fixed by #54
Open

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

bforchhammer opened this issue Dec 19, 2019 · 3 comments · Fixed by SalesLoft/statix#3 · May be fixed by #54

Comments

@bforchhammer
Copy link

bforchhammer commented Dec 19, 2019

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!

@dcaixinha
Copy link

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?

@dnlserrano
Copy link

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 added a commit to dnlserrano/statix that referenced this issue Jun 28, 2020
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
@dnlserrano dnlserrano linked a pull request Jun 28, 2020 that will close this issue
dnlserrano added a commit to dnlserrano/statix that referenced this issue Jun 28, 2020
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
@bforchhammer
Copy link
Author

@dnlserrano Well, looks like you found some time over the weekend! Awesome, thanks for the PR! ❤️

dustinfarris pushed a commit to pepsico-ecommerce/statix that referenced this issue Apr 25, 2024
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
dustinfarris pushed a commit to pepsico-ecommerce/statix that referenced this issue Apr 25, 2024
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
dustinfarris pushed a commit to pepsico-ecommerce/statix that referenced this issue Apr 25, 2024
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
urmastalimaa pushed a commit to salemove/statix that referenced this issue May 23, 2024
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
jodyrodd added a commit to SalesLoft/statix that referenced this issue Jun 10, 2024
Example of usage follows:

    iex> MyApp.Statix.distribution("rendering", 12, [])
    :ok

From the Datadog documentation:

> Unlike the HISTOGRAM metric type, which aggregates on the Agent during
a given time interval, a DISTRIBUTION metric sends all the raw data
during a time interval to Datadog, and aggregations occur server-side.
Because the underlying data structure represents raw, unaggregated data,
distributions provide two major features:
>
>  - Calculation of percentile aggregations
>  - Customization of tagging

https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#definition

Closes lexmag#46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants