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

fix: refactor metrics durable object #1112

Merged
merged 3 commits into from
Jan 19, 2022

Conversation

vasco-santos
Copy link
Contributor

As part of #1091 , this PR handles:

Having a separate metrics instance per gateway

Previous metrics durable object was responsible for tracking the metrics of all the gateways, as well as generic metrics (total sum of winner response times). As a result, this PR creates two new Durable Objects. A GatewayMetrics DO, which will have an instance per gateway and a GenericMetrics DO, which will keep generic metrics agnostic to specific gateways.

An implementation detail worth mentioning is when metrics per gateway are updated. The winner gateway metrics is updated right away (after the winner request finishes), while all the other gateways will be updated in parallel once the remaining requests end. We could store every single request as soon as it finishes, but it would add complexity to the codebase for having the metrics a bit later updated. The extra complexity is likely not worth for having the metrics sooner updated. I am still considering wether adding the winner first is worth it, but given we need to update the generic metrics I added it earlier on.

@vasco-santos vasco-santos force-pushed the fix/refactor-metrics-durable-object branch from 205be5d to a9ebc4e Compare January 18, 2022 18:06
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 18, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4f0a57f
Status: ✅  Deploy successful!
Preview URL: https://f91ef2c4.nft-storage-1at.pages.dev

View logs

@vasco-santos vasco-santos force-pushed the fix/refactor-metrics-durable-object branch from a9ebc4e to c31e31c Compare January 18, 2022 18:13
@vasco-santos vasco-santos requested a review from alanshaw January 18, 2022 18:18
@vasco-santos vasco-santos force-pushed the fix/refactor-metrics-durable-object branch from d8d6a9c to beaa37b Compare January 19, 2022 10:37
vasco-santos and others added 2 commits January 19, 2022 11:39
@vasco-santos vasco-santos force-pushed the fix/refactor-metrics-durable-object branch from beaa37b to 4f0a57f Compare January 19, 2022 10:39
@vasco-santos vasco-santos merged commit 4eee871 into main Jan 19, 2022
@vasco-santos vasco-santos deleted the fix/refactor-metrics-durable-object branch January 19, 2022 10:57
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.

2 participants