Skip to content

ratelimits: Fix latency calculations#7627

Merged
beautifulentropy merged 4 commits into
mainfrom
ratelimits-fix-latency
Jul 25, 2024
Merged

ratelimits: Fix latency calculations#7627
beautifulentropy merged 4 commits into
mainfrom
ratelimits-fix-latency

Conversation

@beautifulentropy

@beautifulentropy beautifulentropy commented Jul 24, 2024

Copy link
Copy Markdown
Member

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
Comment thread ratelimits/source_redis.go Outdated
Comment thread ratelimits/source_redis.go Outdated
aarongable
aarongable previously approved these changes Jul 24, 2024
@beautifulentropy beautifulentropy merged commit a6e0fdc into main Jul 25, 2024
@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