Skip to content

feat: add kafka_consumergroup_group_state metric#51

Merged
softberries merged 2 commits intosoftwaremill:mainfrom
pincher95:feat/consumer-group-state-metric
Mar 13, 2026
Merged

feat: add kafka_consumergroup_group_state metric#51
softberries merged 2 commits intosoftwaremill:mainfrom
pincher95:feat/consumer-group-state-metric

Conversation

@pincher95
Copy link
Copy Markdown
Contributor

@pincher95 pincher95 commented Mar 8, 2026

Summary

  • Add new kafka_consumergroup_group_state gauge metric exposing consumer group state as an integer (0=Unknown through 7=Reconciling)
  • Support both classic protocol states (PreparingRebalance, CompletingRebalance) and KIP-848 states (Assigning, Reconciling)
  • Export via both Prometheus and OpenTelemetry pipelines

Closes #50

Test plan

  • Unit tests for encode_group_state covering classic, KIP-848, and unknown states
  • Unit test verifying LagCalculator propagates group state to metrics
  • Registry test asserting the metric appears in Prometheus output
  • Manual verification with a live Kafka cluster

pincher95 and others added 2 commits March 8, 2026 08:55
Expose consumer group state as a gauge metric encoded as an integer.
This allows monitoring and alerting on group state transitions
(e.g. rebalancing, dead groups).

Mapping: Unknown=0, PreparingRebalance=1, CompletingRebalance=2,
Stable=3, Dead=4, Empty=5, Assigning=6 (KIP-848), Reconciling=7 (KIP-848)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pincher95
Copy link
Copy Markdown
Contributor Author

@softberries, any chance to review it this PR

@softberries softberries merged commit 8d5f953 into softwaremill:main Mar 13, 2026
5 checks passed
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.

Add kafka_consumergroup_group_state metric

2 participants