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

Datadog formatter - Convert tag value of list to multiple tag values with same key #90

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

davidnsimplifi
Copy link

@davidnsimplifi davidnsimplifi commented Nov 8, 2023

To give some context, datadog supports receiving multiple tag values with the same key, so you could have a dogstatsd datagram such as:

application_name.metric_name.event.amount:1|c|#type:failed,reason:reason1,reason:reason2

There's some work that I'm involved with on migrating an elixir application from https://hexdocs.pm/statix/Statix.html to use the telemetry module and this library for recording telemetry, and sending them to datadog. statix supported a list of tags, which could be ["tag1:value", "tag1:secondvalue", "tag2"].

With the telemetry module and telemetry_metrics_statsd, we can send a telemetry metric with metadata such as:

%{type: failed, reason: [reason1, reason2]}

The reason list is being converted to a string by the datadog formatter, and then the datagram looks like:

application_name.metric_name.event.amount:1|c|#type:failed,reason:reason1reason2

The main downside of that is that in datadog dashboards, the reason field is one string, so it's not as clean looking. When you have multiple tag values, you can do queries on reason:reason1, compared to now doing a string search of reason:reason1. As well, when displaying a table of the tag, it will show up as reason1, reason2 automatically if there's multiple tag values.

The changes in this pull request detect a list and then take each item in the list as a new tag value so the datagram looks like the first example of

application_name.metric_name.event.amount:1|c|#type:failed,reason:reason1,reason:reason2

If these changes shouldn't be the default, it could also be put behind a config parameter when setting up TelemetryMetricsStatsd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant