Skip to content

feat: add committed field to RaftMetrics and RaftDataMetrics#1691

Merged
drmingdrmer merged 1 commit intodatabendlabs:mainfrom
drmingdrmer:2093-metrics-committed
Mar 20, 2026
Merged

feat: add committed field to RaftMetrics and RaftDataMetrics#1691
drmingdrmer merged 1 commit intodatabendlabs:mainfrom
drmingdrmer:2093-metrics-committed

Conversation

@drmingdrmer
Copy link
Copy Markdown
Member

@drmingdrmer drmingdrmer commented Mar 20, 2026

Changelog

feat: add committed field to RaftMetrics and RaftDataMetrics

RaftMetrics exposed log state fields (last_log_index, last_applied,
snapshot, purged) but was missing committed — the last log ID this
node knows to be safe for local application. This is the local
committed
value, which may lag behind the cluster-committed frontier
due to network delays or out-of-order RPC delivery. Internally,
committed was already tracked via RaftState::committed(); it just
was not surfaced in metrics.

Changes:

  • Add committed: Option<LogIdOf<C>> to RaftMetrics and RaftDataMetrics
  • Add Metric::Committed variant with PartialEq/PartialOrd support
  • Add set_committed_index() to MetricsRecorder trait and forward_metrics()
  • Add Wait::committed_index() and Wait::committed_index_at_least()
  • Add openraft.log.index.committed gauge in OpenTelemetry integration
  • Add unit tests for all new public items


This change is Reviewable

`RaftMetrics` exposed log state fields (`last_log_index`, `last_applied`,
`snapshot`, `purged`) but was missing `committed` — the last log ID this
node knows to be safe for local application. This is the **local
committed** value, which may lag behind the cluster-committed frontier
due to network delays or out-of-order RPC delivery. Internally,
`committed` was already tracked via `RaftState::committed()`; it just
was not surfaced in metrics.

Changes:
- Add `committed: Option<LogIdOf<C>>` to `RaftMetrics` and `RaftDataMetrics`
- Add `Metric::Committed` variant with `PartialEq`/`PartialOrd` support
- Add `set_committed_index()` to `MetricsRecorder` trait and `forward_metrics()`
- Add `Wait::committed_index()` and `Wait::committed_index_at_least()`
- Add `openraft.log.index.committed` gauge in OpenTelemetry integration
- Add unit tests for all new public items
Copy link
Copy Markdown
Collaborator

@xp-trumpet xp-trumpet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xp-trumpet reviewed 9 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on drmingdrmer).

@drmingdrmer drmingdrmer added this pull request to the merge queue Mar 20, 2026
Merged via the queue into databendlabs:main with commit c63b33a Mar 20, 2026
40 checks passed
@drmingdrmer drmingdrmer deleted the 2093-metrics-committed branch March 20, 2026 16:08
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