Skip to content

CLOUDP-472112: mongocli om standby-clusters lag — report standby replication lag - #147

Merged
tonyclarkemonogodb merged 4 commits into
mainfrom
CLOUDP-472112
Nov 10, 2026
Merged

tonyclarkemonogodb merged 4 commits into
mainfrom
CLOUDP-472112

Conversation

@tonyclarkemonogodb

Copy link
Copy Markdown
Contributor

Ticket

CLOUDP-472112

Description

New subcommand mongocli om standby-clusters lag: reports the standby cluster's replication lag by reading the Cluster Status Object (cluster_status_v1.bson, the contract from CLOUDP-471131) directly from the object store — no Ops Manager API — so it stays available when OM is down.

$ mongocli om standby-clusters lag --shards
estimated data loss: 7.3s
rs0: 10s of oplog pending apply
standby lag: 17.3s
  • estimated data loss — ops committed since the safe point, not yet shipped; lost in an unplanned failover (real elapsed time).
  • per-shard lines (--shards) — received-but-unapplied oplog relayed from the object's lagSeconds (never recomputed client-side); the drain work promotion completes.
  • standby lag — the sum (≡ now − MCTS): the standby's freshest applied op was committed that many seconds ago.

-o json prints the full contract document (unchanged field names). The three-line shape is constant across healthy / partially-published / uninitialized objects (NA / not available yet fill-ins).

Notes

  • The status object is decoded with a mirrored wire-contract struct (schemaVersion enforced; json+bson tags single-sourced). No dependency on the monarch module.
  • Requires a relay build that publishes the status object (monarch CLOUDP-471131; PR #1232/#1234). On older relays the command reports the object as not found, with the actionable message.
  • S3-level tests run against an in-process fake; integration tests (testcontainers MinIO + the real binary); verified live against a rig running a locally-built monarch.
  • Includes .gitignore *.iml addition.

@tonyclarkemonogodb
tonyclarkemonogodb requested a review from a team as a code owner November 9, 2026 20:37
@tonyclarkemonogodb
tonyclarkemonogodb requested review from danielblanco96 and removed request for a team November 9, 2026 20:37
_, err := fmt.Fprintf(o.OutWriter, "%s: NA\n", o.componentID())
return err
}
for _, s := range status.ShardStatus {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we can sort these by the lag values, for convenience.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

On the fence about this. For now I am inclined to leave it in the same order as the json. But we can always update this later if it feels better sorted.

@tonyclarkemonogodb
tonyclarkemonogodb merged commit 67c4931 into main Nov 10, 2026
21 checks passed
@tonyclarkemonogodb
tonyclarkemonogodb deleted the CLOUDP-472112 branch November 10, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants