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

DEBUG-2334 default token bucket allow? size to 1 #3882

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

p-datadog
Copy link
Contributor

What does this PR do?

The only usage of token bucket rate limiter currently in our code uses a size of 1 (to perform one action). Default the size parameter to 1 to simplify the API for using token bucket on the caller side.

Motivation:

Dynamic instrumentation will also use token bucket and will also call allow? with the size of 1.

Additional Notes:

How to test the change?

Unit tests

@p-datadog p-datadog requested review from a team as code owners September 3, 2024 12:51
@github-actions github-actions bot added core Involves Datadog core libraries tracing labels Sep 3, 2024
Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

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

👍 LGTM

The only usage of token bucket rate limiter currently in
our code uses a size of 1 (to perform one action).
Default the size parameter to 1 to simplify the API for
using token bucket on the caller side.

Dynamic instrumentation will also use token bucket and
will also call allow? with the size of 1.
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.87%. Comparing base (ae50107) to head (2d10912).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3882      +/-   ##
==========================================
+ Coverage   97.85%   97.87%   +0.01%     
==========================================
  Files        1277     1277              
  Lines       76392    76403      +11     
  Branches     3744     3744              
==========================================
+ Hits        74757    74779      +22     
+ Misses       1635     1624      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pr-commenter
Copy link

pr-commenter bot commented Sep 3, 2024

Benchmarks

Benchmark execution time: 2024-09-03 13:33:17

Comparing candidate commit 2d10912 in PR branch token-bucket-size-1 with baseline commit ae50107 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 23 metrics, 2 unstable metrics.

@p-datadog
Copy link
Contributor Author

I will merge this and it looks like #3886 is attempting to repair the ASM test failures.

@p-datadog p-datadog merged commit 298af84 into master Sep 5, 2024
190 of 192 checks passed
@p-datadog p-datadog deleted the token-bucket-size-1 branch September 5, 2024 17:27
p-datadog pushed a commit to p-datadog/dd-trace-rb that referenced this pull request Sep 6, 2024
* master:
  Add a check that ruleset file still exists to appsec:ruleset:update
  Add argument presence checks for appsec:ruleset:update
  Add Github Token as argument to appsec:ruleset:update task
  Add comments about deadlock risk
  Refactor with default level
  Refactor with Logger module
  DEBUG-2334 default token bucket allow? size to 1 (DataDog#3882)
  Fix system tests (DataDog#3883)
  Inject telemetry component
  Update gemfiles/*
  Add fiddle gem to Gemfile for Ruby >= 3.3
  Add ostruct to Gemfile for Ruby >= 3.3
@anmarchenko anmarchenko added this to the 2.4.0 milestone Sep 9, 2024
y9v pushed a commit that referenced this pull request Sep 13, 2024
The only usage of token bucket rate limiter currently in
our code uses a size of 1 (to perform one action).
Default the size parameter to 1 to simplify the API for
using token bucket on the caller side.

Dynamic instrumentation will also use token bucket and
will also call allow? with the size of 1.

Co-authored-by: Oleg Pudeyev <code@olegp.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants