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

Throttle api #184

Merged
merged 32 commits into from
Nov 29, 2024
Merged

Throttle api #184

merged 32 commits into from
Nov 29, 2024

Conversation

NelsonVides
Copy link
Collaborator

@NelsonVides NelsonVides commented Jun 2, 2024

Making the API for throttle more friendly to use

@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2024

Codecov Report

Attention: Patch coverage is 90.52632% with 18 lines in your changes missing coverage. Please review.

Project coverage is 75.83%. Comparing base (360c3a3) to head (92ef315).

Files with missing lines Patch % Lines
src/throttle/amoc_throttle_process.erl 61.90% 8 Missing ⚠️
src/throttle/amoc_throttle.erl 66.66% 4 Missing ⚠️
src/throttle/amoc_throttle_controller.erl 95.29% 4 Missing ⚠️
src/throttle/amoc_throttle_config.erl 96.82% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #184      +/-   ##
==========================================
+ Coverage   74.78%   75.83%   +1.04%     
==========================================
  Files          31       32       +1     
  Lines        1170     1200      +30     
==========================================
+ Hits          875      910      +35     
+ Misses        295      290       -5     

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

@NelsonVides NelsonVides force-pushed the throttle_api branch 4 times, most recently from 176d6b9 to 5f883d9 Compare June 6, 2024 14:51
@NelsonVides NelsonVides force-pushed the throttle_api branch 10 times, most recently from 572f130 to cbe472d Compare June 14, 2024 09:27
@NelsonVides NelsonVides changed the base branch from master to cosmetics June 14, 2024 09:27
@NelsonVides NelsonVides changed the title Throttle api and interarrival as throttle Throttle api Jun 14, 2024
@NelsonVides NelsonVides force-pushed the throttle_api branch 3 times, most recently from 6fdad6c to 84bfb08 Compare June 14, 2024 20:39
Base automatically changed from cosmetics to master June 17, 2024 11:45
case {RatePerMinutePerProcess < NoOfProcesses, R} of
{true, 0} ->
Config = #{max_n => RatePerMinutePerProcess,
delay => DelayPerProcess + 1,
Copy link
Collaborator

@DenysGonchar DenysGonchar Nov 28, 2024

Choose a reason for hiding this comment

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

why 1 is added to delay but not max_n

Copy link
Collaborator

Choose a reason for hiding this comment

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

I really don't get this function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let me try to add some comments with explanations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I've added a property-based test to check that the aggregated delays given to all processes don't differ from the actually requested rate by more than 1%, and I cannot get it to pass 😱

Please have a look at throttle_SUITE:pool_config_property_tests/1 @DenysGonchar

Not only this simplifies how the gradual config is triggered, but it
also makes the gradual config transparent to the controller: the
controller just applies a new rate every so much time. This not just
makes the controller much simpler, but also, makes it possible to give
it rate changes that are not necessarily only linear, but that could
have more interesting shapes.
@NelsonVides NelsonVides force-pushed the throttle_api branch 6 times, most recently from d462b4c to 3141f00 Compare November 28, 2024 14:23
@NelsonVides NelsonVides force-pushed the throttle_api branch 4 times, most recently from 5d7edbe to 671e25e Compare November 29, 2024 14:42
@DenysGonchar DenysGonchar merged commit d842d1f into master Nov 29, 2024
6 checks passed
@DenysGonchar DenysGonchar deleted the throttle_api branch November 29, 2024 15:28
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