feat: add committed field to RaftMetrics and RaftDataMetrics#1691
Merged
drmingdrmer merged 1 commit intodatabendlabs:mainfrom Mar 20, 2026
Merged
feat: add committed field to RaftMetrics and RaftDataMetrics#1691drmingdrmer merged 1 commit intodatabendlabs:mainfrom
committed field to RaftMetrics and RaftDataMetrics#1691drmingdrmer merged 1 commit intodatabendlabs:mainfrom
Conversation
`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
xp-trumpet
approved these changes
Mar 20, 2026
Collaborator
xp-trumpet
left a comment
There was a problem hiding this comment.
@xp-trumpet reviewed 9 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on drmingdrmer).
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.
Changelog
feat: add
committedfield toRaftMetricsandRaftDataMetricsRaftMetricsexposed log state fields (last_log_index,last_applied,snapshot,purged) but was missingcommitted— the last log ID thisnode 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,
committedwas already tracked viaRaftState::committed(); it justwas not surfaced in metrics.
Changes:
committed: Option<LogIdOf<C>>toRaftMetricsandRaftDataMetricsMetric::Committedvariant withPartialEq/PartialOrdsupportset_committed_index()toMetricsRecordertrait andforward_metrics()Wait::committed_index()andWait::committed_index_at_least()openraft.log.index.committedgauge in OpenTelemetry integrationThis change is