Skip to content

getHealth: expose latest ledger close time (latestLedgerCloseTime) #798

@felixl256

Description

@felixl256

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions