Problem
getHealth returns latestLedger (the sequence of the most recently ingested ledger) but not the time at which that ledger closed.
To assess ledger freshness today, a client has to additionally call getLatestLedger, which always returns the full headerXdr + metadataXdr of the ledger (several MB on active ledgers, since metadataXdr is the entire LedgerCloseMeta). That is far too heavy for a lightweight health/monitoring probe that only needs a timestamp.
Proposal
Add a latestLedgerCloseTime field (unix timestamp, in seconds) to the getHealth response.
- The value is already loaded inside the handler — it's used for the existing
max-healthy-ledger-latency check (time.Unix(ledgerRange.LastLedger.CloseTime, 0)), so there is no additional cost.
- Naming and format mirror the existing top-level
latestLedgerCloseTime field already present in the getLedgers response (plain int64 unix seconds).
- Additive and backward-compatible (existing clients ignore the new field).
Use case
Health/monitoring tooling (e.g. load balancers, node-status pollers) can compute "time since last ledger" directly from the cheap getHealth endpoint, instead of polling getLatestLedger and transferring multi-MB ledger metadata on every cycle.
Implementation
Problem
getHealthreturnslatestLedger(the sequence of the most recently ingested ledger) but not the time at which that ledger closed.To assess ledger freshness today, a client has to additionally call
getLatestLedger, which always returns the fullheaderXdr+metadataXdrof the ledger (several MB on active ledgers, sincemetadataXdris the entireLedgerCloseMeta). That is far too heavy for a lightweight health/monitoring probe that only needs a timestamp.Proposal
Add a
latestLedgerCloseTimefield (unix timestamp, in seconds) to thegetHealthresponse.max-healthy-ledger-latencycheck (time.Unix(ledgerRange.LastLedger.CloseTime, 0)), so there is no additional cost.latestLedgerCloseTimefield already present in thegetLedgersresponse (plainint64unix seconds).Use case
Health/monitoring tooling (e.g. load balancers, node-status pollers) can compute "time since last ledger" directly from the cheap
getHealthendpoint, instead of pollinggetLatestLedgerand transferring multi-MB ledger metadata on every cycle.Implementation
LatestLedgerCloseTimetoGetHealthResponsegetHealthhandler