Skip to content

feat: add replication info to /metrics endpoint#7069

Merged
romange merged 1 commit intodragonflydb:mainfrom
EricHayter:expose-metrics
Apr 18, 2026
Merged

feat: add replication info to /metrics endpoint#7069
romange merged 1 commit intodragonflydb:mainfrom
EricHayter:expose-metrics

Conversation

@EricHayter
Copy link
Copy Markdown
Contributor

Exposes 4 new fields to the /metrics endpoint relating to replication info:

  • master_link_status
  • master_last_io_seconds_ago
  • master_sync_in_progress
  • slave_repl_offset

This commit also adds integration testing to validate the new functionality.

Fixes #6183

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 5, 2026

🤖 Augment PR Summary

Summary: This PR exposes replica-side replication state in the Prometheus /metrics endpoint.

Changes:

  • Adds four new metrics derived from ReplicaSummary: master link status, seconds since last master IO, full-sync-in-progress flag, and replica offset.
  • Emits these metrics only when the server is operating in replica mode (m.replica_side_info is present).
  • Exports slave_repl_offset only after a full sync has completed (or after a completed full sync when the link is currently down), matching existing INFO behavior.
  • Adds an integration test that verifies the new metrics appear on a replica and do not appear on a master.

Technical Notes: The implementation reuses the existing replication summary fields already used by the INFO replication output, keeping metrics consistent with runtime replication state.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread src/server/server_family.cc Outdated
Comment thread tests/dragonfly/server_family_test.py Outdated
@romange
Copy link
Copy Markdown
Collaborator

romange commented Apr 5, 2026

@EricHayter thanks for working on it.

Comment thread tests/dragonfly/server_family_test.py Outdated
romange
romange previously approved these changes Apr 9, 2026
@romange
Copy link
Copy Markdown
Collaborator

romange commented Apr 9, 2026

Please sign your commits @EricHayter

@EricHayter
Copy link
Copy Markdown
Contributor Author

Please sign your commits @EricHayter

I believe my commits already include a sign-off, but the PR description does not. Should I also add the sign-off to the PR message?

@romange
Copy link
Copy Markdown
Collaborator

romange commented Apr 12, 2026

I meant with sign with gpg key, see #7122 for details.

Exposes 4 new fields to the `/metrics` endpoint relating to replication info:
- `master_link_status`
- `master_last_io_seconds_ago`
- `master_sync_in_progress`
- `slave_repl_offset`

This commit also adds integration testing to validate the new functionality.

Fixes dragonflydb#6183

Signed-off-by: Eric <hayter.eric@gmail.com>
@EricHayter
Copy link
Copy Markdown
Contributor Author

Sorry for the delay on getting this signed. I initially amended the commit locally, but didn’t realize I also needed to add my public key to GitHub for the signature to be recognized. It should be properly signed now.

@EricHayter EricHayter requested a review from romange April 18, 2026 11:47
@romange
Copy link
Copy Markdown
Collaborator

romange commented Apr 18, 2026

Thank you, Eric!

@romange romange merged commit 0eb38c8 into dragonflydb:main Apr 18, 2026
13 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.

Expose replication status on the /metrics endpoint

2 participants