Fix the appending of unit suffix for histogram metrics in Prometheus exporter. #553
Labels
C-exporter
Component: exporters such as Prometheus, TCP, etc.
E-simple
Effort: simple.
T-bug
Type: bug.
In #535, support was added to
metrics-exporter-prometheus
for suffixing metrics based on their configured unit. This was applied uniformly to counters, gauges, and histograms, and relied on a change to one of the core functions used to write out a metric line in the exposition format.#552 was raised to highlight a bug with how that change was gated, which made me realize that we're likely suffixing histograms wrong when the feature is enabled. For counters and gauges, the suffixing we do is fine:
my_counter
turns into something likemy_counter_seconds
, and so on. For histograms, however, lines likemy_histogram_sum
turn intomy_histogram_sum_seconds
.As I understand it, at least, this is wrong, since the intent is that Prometheus would expect the base metric name to be turned into
<base>_bucket
,<base>_sum
, and<base>_count
... whereas we would be doing something like<base>_bucket_seconds
,<base>_sum_seconds
, and<base>_count_seconds
. While the suffixing is uniform, Prometheus wants (again, as I understand it) a histogram metric to have the_bucket
/_sum
/_count
suffixes so that it knows how to transforms queries against<base>
into the right parts when doing histogram-y things.Looking at the code, this should be as simple as reordering how the unit suffix and the generic suffix (the parameter we use to add
_bucket
/_sum
/_count
in the first place) are applied.The text was updated successfully, but these errors were encountered: