Exporting replication_target_status metric to use in prometheus alert#9385
Merged
aayushchouhan09 merged 1 commit intonoobaa:masterfrom Jan 23, 2026
Merged
Exporting replication_target_status metric to use in prometheus alert#9385aayushchouhan09 merged 1 commit intonoobaa:masterfrom
aayushchouhan09 merged 1 commit intonoobaa:masterfrom
Conversation
📝 WalkthroughWalkthroughAdds a Prometheus Gauge Changes
Sequence Diagram(s)sequenceDiagram
participant Scanner as Replication Scanner
participant Utils as Replication Utils
participant Report as NooBaa Core Report
participant Prometheus as Prometheus
Scanner->>Scanner: Resolve source/destination buckets
alt Destination bucket missing
Scanner->>Utils: update_replication_target_status(source, dest_id, false)
Utils->>Report: set_replication_target_status(source, dest_id, 0)
Report->>Prometheus: Gauge.set(0)
else Perform diff / head-objects
Scanner->>Report: attempt bucket-diff / head-objects
alt Ops succeed
Scanner->>Utils: update_replication_target_status(source, dest, true)
Utils->>Report: set_replication_target_status(source, dest, 1)
Report->>Prometheus: Gauge.set(1)
else Ops fail
Scanner->>Utils: update_replication_target_status(source, dest, false)
Utils->>Report: set_replication_target_status(source, dest, 0)
Report->>Prometheus: Gauge.set(0)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2 tasks
alphaprinz
approved these changes
Jan 20, 2026
Contributor
alphaprinz
left a comment
There was a problem hiding this comment.
One comment about a swallowed exception, otherwise LGTM.
c433773 to
8d06cad
Compare
Signed-off-by: Aayush Chouhan <achouhan@redhat.com>
8d06cad to
5be2dce
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/server/bg_services/log_replication_scanner.js`:
- Around line 168-194: The code currently marks the target reachable after
iterating candidates regardless of whether bucketDiff.get_buckets_diff was ever
called; introduce a boolean flag (e.g., diffTried or diffAttempted) before the
for-loop, set it to true right before/when bucketDiff.get_buckets_diff is
invoked inside the loop (the block that produces keys_diff_map and merges into
diff_keys), and only call
replication_utils.update_replication_target_status(src_bucket.name,
dst_bucket.name, true) after the loop if that flag is true; keep the existing
catch behavior (marking unreachable and rethrowing) unchanged so an exception
during get_buckets_diff still marks the target unreachable.
This was referenced Jan 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.
Describe the Problem
Currently, we don't have a metric which shows the status of target bucket reachability.
Explain the Changes
NooBaa_replication_target_statuswhich can be used by Prometheus alert.Issues: Fixed #xxx / Gap #xxx
Testing Instructions:
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.