-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: profile events storage relatively to insertion timestamp #144
fix: profile events storage relatively to insertion timestamp #144
Conversation
// Log the time difference for each deposit event for profiling in datadog | ||
insertedDeposits.forEach((event) => { | ||
if (event.blockTimestamp === undefined) return; | ||
const timeDifference = | ||
event.createdAt.getTime() - event.blockTimestamp.getTime(); | ||
this.logger.debug({ | ||
at: "SpokePoolIndexerDataHandler#profileStoreEvents", | ||
message: "V3FundsDeposited event profile", | ||
depositId: event.depositId, | ||
originChainId: event.originChainId, | ||
timeDifference, | ||
createdAt: event.createdAt, | ||
blockTimestamp: event.blockTimestamp, | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OOC would it make sense to spot-check a few of these values? Since this is an O(N) operation, it could add noticeable milliseconds to the process, and it seems worth optimizing to shave down execution time as much as possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point we might reduce the number of logs, yes. I will introduce an ENV var to disable this while doing large backfills
@@ -114,7 +114,56 @@ export class SpokePoolIndexerDataHandler implements IndexerDataHandler { | |||
); | |||
await this.updateNewDepositsWithIntegratorId(newInsertedDeposits); | |||
await this.spokePoolProcessor.process(storedEvents); | |||
this.profileStoreEvents(storedEvents); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the two async functions above this be called in parallel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice changes
For more accurate profiling, we need to compute the time difference relatively to the time the event was inserted in the DB, not the current
now()
server timestamp at logging time.In addition, now we profile fill events storing too