prometheus / statsd_exporter

StatsD to Prometheus metrics exporter
Apache License 2.0
921 stars 231 forks source link

Add DogStatsD extended aggregation support #558

Closed GrgDev closed 2 months ago

GrgDev commented 5 months ago

This PR aims to add the ability for statsd exporter to receive DogStatsD extended aggregation metrics. It is a feature I requested in Issue #557 and I wanted to try to implement it myself following the in-issue commented advice from @glightfoot.

Summary of Implementation

When DogStatsD has extended aggregation enabled, instead of sending:

my_distribution_metric:21|d|#all,my,tags
my_distribution_metric:43.2|d|#all,my,tags
my_distribution_metric:1657|d|#all,my,tags

it sends

my_distribution_metric:21:43.2:1657|d|#all,my,tags

This PR updates the LineToEvents function in the specific case of more than one : left of the initial |. If so, assume it is an extended aggregation line, convert it back into its multi-line non-aggregated form, then pass it onto the rest of the function as the samples. The logic enforces that this form of aggregation metrics must be only of the types of distribution, histogram, or timing.

GrgDev commented 4 months ago

@glightfoot Friendly nudge