diff --git a/crates/sui-indexer-alt/src/ingestion/broadcaster.rs b/crates/sui-indexer-alt/src/ingestion/broadcaster.rs index 4e68f65d38dc7..cd27476ce3e94 100644 --- a/crates/sui-indexer-alt/src/ingestion/broadcaster.rs +++ b/crates/sui-indexer-alt/src/ingestion/broadcaster.rs @@ -80,6 +80,10 @@ pub(super) fn broadcaster( let old_seq = latest_ingested_checkpoint.fetch_max(new_seq, Ordering::Relaxed); if new_seq > old_seq { metrics.latest_ingested_checkpoint.set(new_seq as i64); + metrics.latest_ingested_checkpoint_timestamp_lag_ms.set( + chrono::Utc::now().timestamp_millis() + - checkpoint.checkpoint_summary.timestamp_ms as i64, + ); } let futures = subscribers.iter().map(|s| s.send(checkpoint.clone())); diff --git a/crates/sui-indexer-alt/src/metrics.rs b/crates/sui-indexer-alt/src/metrics.rs index 4b944c6f9eef2..73efd2ab07375 100644 --- a/crates/sui-indexer-alt/src/metrics.rs +++ b/crates/sui-indexer-alt/src/metrics.rs @@ -62,6 +62,7 @@ pub struct IndexerMetrics { pub total_ingested_not_found_retries: IntCounter, pub latest_ingested_checkpoint: IntGauge, + pub latest_ingested_checkpoint_timestamp_lag_ms: IntGauge, pub ingested_checkpoint_latency: Histogram, @@ -208,6 +209,13 @@ impl IndexerMetrics { registry, ) .unwrap(), + latest_ingested_checkpoint_timestamp_lag_ms: register_int_gauge_with_registry!( + "latest_ingested_checkpoint_timestamp_lag_ms", + "Difference between the system timestamp when the latest checkpoint was fetched and the \ + timestamp in the checkpoint, in milliseconds", + registry, + ) + .unwrap(), ingested_checkpoint_latency: register_histogram_with_registry!( "indexer_ingested_checkpoint_latency", "Time taken to fetch a checkpoint from the remote store, including retries",