Skip to content

fix(collector): use gauge type for data stream metrics - #1237

Open
locker95 wants to merge 1 commit into
prometheus-community:masterfrom
locker95:fix-data-stream-gauge
Open

fix(collector): use gauge type for data stream metrics#1237
locker95 wants to merge 1 commit into
prometheus-community:masterfrom
locker95:fix-data-stream-gauge

Conversation

@locker95

@locker95 locker95 commented Sep 1, 2026

Copy link
Copy Markdown

The data stream collector emits elasticsearch_data_stream_store_size_bytes and elasticsearch_data_stream_backing_indices_total as counters, but neither value is monotonic: store size shrinks when segments merge or documents are deleted, and the backing index count drops when ILM deletes or shrinks rolled-over indices. This was reported in #797.

This changes both to gauges. Metric names are unchanged, and metrics.md already documents both as gauge, so this also brings the code in line with the docs.

Probably worth a line in the changelog: dashboards applying rate()/increase() to these series were getting misleading results already, but tooling that keys off the exposed TYPE will see it change from counter to gauge.

Fixes #797

elasticsearch_data_stream_store_size_bytes and
elasticsearch_data_stream_backing_indices_total were emitted as
counters, but both values can decrease (store size shrinks on merges
and deletes; backing index count drops on ILM delete/shrink after
rollover). Emit them as gauges, matching the types already documented
in metrics.md. Metric names are unchanged.

Fixes prometheus-community#797

Signed-off-by: Dean Chen <862469039@qq.com>
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.

Incorrect Metric Type for elasticsearch_data_stream_store_size_bytes

1 participant