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

Bucket level metric #542

Merged
merged 13 commits into from
May 29, 2024
Merged

Bucket level metric #542

merged 13 commits into from
May 29, 2024

Conversation

dmanc
Copy link
Contributor

@dmanc dmanc commented May 3, 2024

Why are these changes needed?

Adds bucket level metrics to the rate limiter library. Currently I'm making an assumption that if the RequesterName is not empty then we've authenticated the request is some way.

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

Copy link
Collaborator

@mooselumph mooselumph left a comment

Choose a reason for hiding this comment

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

Looks good. Just one comment.

common/ratelimit/limiter.go Outdated Show resolved Hide resolved
@dmanc dmanc force-pushed the rate-limit-metrics branch from dcc1a0e to d183791 Compare May 8, 2024 05:55
@mooselumph mooselumph requested a review from ian-shim May 8, 2024 23:27
Copy link
Contributor

@ian-shim ian-shim left a comment

Choose a reason for hiding this comment

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

lgtm overall, left one comment

BlobSize: encodedSize,
Rate: globalRates.TotalUnauthThroughput,
RequesterID: key,
RequesterName: systemAccountKey,
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't these be requesterName?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I see how it's confusing but in this case we are calculating the system rate limit metric so we want to make sure the metric that is being updated corresponds to the name "system".

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think to Ian's point, this might be a good reason to name these something like MetricsId and MetricsFlag, so that the intended usage is clear to the library user. Not super critical though.

Copy link
Collaborator

@mooselumph mooselumph left a comment

Choose a reason for hiding this comment

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

Lgtm

@dmanc dmanc force-pushed the rate-limit-metrics branch from 5e88752 to 532c574 Compare May 28, 2024 19:04
@dmanc dmanc marked this pull request as ready for review May 29, 2024 17:39
@dmanc dmanc merged commit a04abd5 into Layr-Labs:master May 29, 2024
5 checks passed
pschork pushed a commit that referenced this pull request May 30, 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