Skip to content
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

feat(benchmark): add very basic benchmarking #95

Closed
wants to merge 1 commit into from

Conversation

daywiss
Copy link
Collaborator

@daywiss daywiss commented Nov 6, 2024

motivation

we want to know how long it takes to process deposit events

changes

  1. This adds a couple things, a benchmarking class where we can start/stop unique ids
  2. an independent contract listener, listening to deposit events, to kick off benchmark start
  3. Within the webhook callback, we stop any benchmarks for particular deposits
  4. Logs duration whenever a deposit id is found

@daywiss daywiss requested a review from amateima November 6, 2024 16:48
Copy link

linear bot commented Nov 6, 2024

@daywiss daywiss force-pushed the david/acx-3196-track-deposit-indexing-time branch from a6feb83 to fc3c0fd Compare November 6, 2024 16:54
Copy link
Contributor

@james-a-morris james-a-morris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OOC do these changes intersect with the code we're adding here? If so - should we colocate it in the SDK?

@daywiss daywiss force-pushed the david/acx-3196-track-deposit-indexing-time branch 2 times, most recently from 3a90559 to f5feb13 Compare November 12, 2024 16:19
@daywiss
Copy link
Collaborator Author

daywiss commented Nov 12, 2024

OOC do these changes intersect with the code we're adding here? If so - should we colocate it in the SDK?

looks like theres overlap. didnt know anything about this, will leave up to alex to decide how to proceed with this

@daywiss daywiss force-pushed the david/acx-3196-track-deposit-indexing-time branch 4 times, most recently from 0c524f5 to 7d72436 Compare December 3, 2024 17:32
@@ -95,7 +113,32 @@ export async function Main(config: parseEnv.Config, logger: winston.Logger) {
new SpokePoolRepository(postgres, logger),
redisCache,
indexerQueuesService,
write,
(params: { type: WebhookTypes; event: JSONValue }) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are repurposing the webhook callback to also stop any deposit benchmarks

@@ -117,6 +160,11 @@ export async function Main(config: parseEnv.Config, logger: winston.Logger) {
retryProvidersFactory,
);

const stopDepositListener = listenForDeposits(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a separate listener that listens straight on the contract for new deposits, given providers on various chains

chainId: number;
};

export function listenForDeposits(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function takes providers and listens to specific events on the spoke pool. it does this to start profiling a deposit. it will end when indexer finds and updates it

const uniqueId = `${depositStatusEvent.originChainId}-${depositStatusEvent.depositId}`;
try {
const duration = depositBenchmark.end(uniqueId);
logger.debug({
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heres where we log the time. duration is in MS since start was called

@daywiss daywiss force-pushed the david/acx-3196-track-deposit-indexing-time branch 2 times, most recently from acaad39 to 032d92b Compare December 3, 2024 17:46
// ignore errors, but it can happen if we are ending before starting
}
}
write(params);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still call the write callback to webhook

@daywiss daywiss force-pushed the david/acx-3196-track-deposit-indexing-time branch from 032d92b to bfeb627 Compare December 3, 2024 17:50
@daywiss
Copy link
Collaborator Author

daywiss commented Dec 6, 2024

closing this in favor of #129

@daywiss daywiss closed this Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants