Skip to content

Commit

Permalink
[indexer-alt] Add ingested_checkpoint_timestamp_lag_ms metric
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind committed Nov 6, 2024
1 parent 61381eb commit dcff15a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/sui-indexer-alt/src/ingestion/broadcaster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down
8 changes: 8 additions & 0 deletions crates/sui-indexer-alt/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit dcff15a

Please sign in to comment.