Skip to content

Commit

Permalink
Track lag for block time to ingestion time
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher-Li committed Nov 29, 2023
1 parent d6fa5fd commit 0a38535
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions indexer/services/ender/src/lib/on-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
KafkaMessage,
} from 'kafkajs';
import _ from 'lodash';
import { DateTime } from 'luxon';

import {
shouldSkipBlock,
Expand Down Expand Up @@ -55,6 +56,11 @@ export async function onMessage(message: KafkaMessage): Promise<void> {
if (indexerTendermintBlock === undefined) {
return;
}
stats.timing(
`${config.SERVICE_NAME}.block_time_lag.timing`,
DateTime.now().diff(dateToDateTime(indexerTendermintBlock.time!)).toMillis(),
STATS_NO_SAMPLING,
);

const offset = message.offset;
const blockHeight: string = indexerTendermintBlock.height.toString();
Expand Down

0 comments on commit 0a38535

Please sign in to comment.