Repository navigation
feat(metrics): Prometheus /actuator/prometheus with kview_* series - #6
Merged
Merged
Conversation
- 15-second in-process sampler (KVIEW_METRICS_INTERVAL_MS) keeps per-cluster health and consumer-group lag snapshots in memory, so a scrape never blocks on broker calls; series appear and disappear with the clusters and groups they describe. - Series: kview_cluster_topics, kview_cluster_partitions, kview_cluster_under_replicated_partitions, kview_cluster_offline_partitions, kview_cluster_consumer_groups, kview_cluster_reachable (tag: cluster) and kview_consumer_group_lag (tags: cluster, group). - kview_messages_produced_total counter (tags: cluster, topic) incremented by the produce path. - Endpoint follows the actuator auth rules: public in the default no-auth mode, any-role-required once authentication is on. - test: MetricsEndpointTest (note: Spring Boot test contexts disable metrics export by default — @AutoConfigureObservability re-enables it). Full suite 58/58.
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements F6 — Prometheus metrics from the deep analysis (the last of the low-effort roadmap items): Kview becomes part of the observability stack instead of only a viewer. Stacked on #5 — merge #1 → #2 → #3 → #4 → #5 → this.
Series exposed on
/actuator/prometheuskview_cluster_topics/kview_cluster_partitionsclusterkview_cluster_under_replicated_partitions/kview_cluster_offline_partitionsclusterkview_cluster_consumer_groupsclusterkview_cluster_reachableclusterkview_consumer_group_lagcluster,groupkview_messages_produced_totalcluster,topicDesign
A 15-second in-process sampler (
KVIEW_METRICS_INTERVAL_MS) computes the snapshots from the same services the dashboard uses and keeps them in memory — a scrape never blocks on broker calls. Gauges read the sampled values; series appear and disappear with the clusters and consumer groups they describe (stale meters are unregistered). Unreachable clusters reportkview_cluster_reachable 0with zeroed series.The endpoint follows the actuator auth rules from #2: public while
kview.auth.mode=none(loopback scraping works immediately), any-role-required once authentication is on — the scraper gets a read-only token or the path is permitted at the proxy (documented in SECURITY.md).Verification
MetricsEndpointTest: produces through the wrapper, runs a sample pass, asserts thekview_*series withcluster="default"appear on the endpoint, and that it is public in the default mode. One Boot gotcha solved along the way: Spring Boot test contexts disable metrics export by default (atestproperty source setsmanagement.defaults.metrics.export.enabled=false);@AutoConfigureObservabilityre-enables it.