Skip to content

Fix #2093: add _total suffix to CHI/host/pod counter metrics - #2097

Open
mehrdadbn9 wants to merge 1 commit into
Altinity:0.27.4from
mehrdadbn9:contrib-2093-counter-total-suffix
Open

mehrdadbn9 wants to merge 1 commit into
Altinity:0.27.4from
mehrdadbn9:contrib-2093-counter-total-suffix

Conversation

@mehrdadbn9

Copy link
Copy Markdown

Fixes #2093.

promtool check metrics flags our counters: the exporter is built with
prometheus.WithoutCounterSuffixes(), so OTel emits names verbatim and all 12
Int64Counter instruments in chi/metrics shipped without _total. This
renames them to *_total, including pod_update/pod_delete_events which were
absent from the original endpoint scrape and thus escaped #2093 but carry the
same latent defect. Histograms and the clickhouse_operator_chi UpDownCounter
intentionally unchanged.

Adds TestAllCountersCarryTotalSuffix and TestNonCounterShapesHaveNoTotalSuffix
as a regression guard using the OTel ManualReader. go vet and go test pass;
full pkg/controller/... builds clean.

Heads-up: metric rename is user-visible. Dashboards and recording rules
referencing the old names, for example
clickhouse_operator_chi_reconciles_started, need a one-line update to the
_total twin.

promtool check metrics flags any counter exposed without the conventional _total suffix. The operator ships its OTel Prometheus exporter with WithoutCounterSuffixes(), so names are emitted verbatim and the 12 Int64Counter instruments in chi/metrics carried non-compliant names. This renames all of them (including pod_update/pod_delete, which were absent from the original scrape and thus escaped Altinity#2093 but fail the same lint once emitted). Histograms and the UpDownCounter are intentionally untouched. Adds a regression test asserting monotonic counters carry _total and non-counters do not.

Signed-off-by: Mehrdad Biukian Naeini <mehrdadbiukian@gmail.com>
@mehrdadbn9
mehrdadbn9 marked this pull request as ready for review October 9, 2026 04:40
@mehrdadbn9 mehrdadbn9 changed the title Fix-2093-add-total-suffix Fix #2093: add _total suffix to CHI/host/pod counter metrics Oct 9, 2026
@alex-zaitsev

Copy link
Copy Markdown
Member

This will break existing dashboards.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants