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

ratelimits: Fix latency calculations #7627

Merged
merged 4 commits into from
Jul 25, 2024
Merged

Conversation

beautifulentropy
Copy link
Member

@beautifulentropy beautifulentropy commented Jul 24, 2024

BatchSpend:

  • Do not attempt to SET 0 new TATs, this is an edge-case which only impacted testing and triggers a divide-by-zero panic in "ratelimits_latency" metric calculation.

Metric "ratelimits_latency":

  • Correct an issue where a single non-existent key in a "batchget" operation incorrectly emits both a status="notFound" and an additional status="success" metric for the same operation.
  • Emit status="mixedSuccess" status for "batchget" operations where some entries are not found
  • Emit a "batchget_entry" for each entry in a "batchget"
  • Emit a "batchset_entry" for each entry in a "batchset"
  • Calculate latency using r.clk.Since() instead of time.Since(), this should only matter for tests.

Metric "ratelimits_spend_latency":

  • Include BatchGet latency in the overall "ratelimits_spend_latency", this was omitted accidentally.
  • Emit latency and outcome per transaction. We're going to need this to compare apples-to-oranges with each of the legacy rate limits.

Fixes #7597

@beautifulentropy beautifulentropy marked this pull request as ready for review July 24, 2024 20:50
@beautifulentropy beautifulentropy requested a review from a team as a code owner July 24, 2024 20:50
@beautifulentropy beautifulentropy changed the title ratelimits: Fix operation latency calculation ratelimits: Fix latency calculations Jul 24, 2024
ratelimits/source_redis.go Outdated Show resolved Hide resolved
ratelimits/source_redis.go Outdated Show resolved Hide resolved
aarongable
aarongable previously approved these changes Jul 24, 2024
@beautifulentropy beautifulentropy merged commit a6e0fdc into main Jul 25, 2024
12 checks passed
@beautifulentropy beautifulentropy deleted the ratelimits-fix-latency branch July 25, 2024 02:07
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.

Investigate the unreasonably fast denial latency metrics
2 participants