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

feat(auth): support rate limit per user for audit log #1493

Merged
merged 8 commits into from
Jun 21, 2021
Merged

Conversation

imbajin
Copy link
Member

@imbajin imbajin commented Jun 8, 2021

Now add 2 ways to limit log rate, keep method compatible with guava's RaterLimiter

TODO: move to common module & refact it

Now add 2 ways to limit log rate, keep method compatible with guava's LimitRater
@codecov
Copy link

codecov bot commented Jun 8, 2021

Codecov Report

Merging #1493 (fc05788) into master (bc9a5a8) will increase coverage by 2.31%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1493      +/-   ##
============================================
+ Coverage     58.51%   60.83%   +2.31%     
- Complexity      396      675     +279     
============================================
  Files           423      426       +3     
  Lines         35048    35096      +48     
  Branches       4967     4970       +3     
============================================
+ Hits          20510    21351     +841     
+ Misses        12453    11600     -853     
- Partials       2085     2145      +60     
Impacted Files Coverage Δ
...a/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java 56.90% <100.00%> (+0.95%) ⬆️
...n/java/com/baidu/hugegraph/config/CoreOptions.java 99.46% <100.00%> (+<0.01%) ⬆️
...du/hugegraph/util/FixedTimerWindowRateLimiter.java 100.00% <100.00%> (ø)
...du/hugegraph/util/FixedWatchWindowRateLimiter.java 100.00% <100.00%> (ø)
...ain/java/com/baidu/hugegraph/util/RateLimiter.java 100.00% <100.00%> (ø)
...om/baidu/hugegraph/task/StandardTaskScheduler.java 75.60% <0.00%> (-0.25%) ⬇️
...a/com/baidu/hugegraph/backend/query/Condition.java 78.46% <0.00%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bc9a5a8...fc05788. Read the comment docs.

// Count will be reset if exceeds limit (run once per 1000ms)
this.timer.schedule(new TimerTask() {
@Override
public void run() {
Copy link
Contributor

Choose a reason for hiding this comment

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

run method can simply as lamda statement?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, TimerTask is abstract class, we cannot use lambda on it (unless wrapper it outside)

@javeme javeme merged commit 0c51de5 into master Jun 21, 2021
@javeme javeme deleted the limit-audit-log branch June 21, 2021 13:46
jadepeng pushed a commit to jadepeng/hugegraph that referenced this pull request Jun 25, 2021
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.

None yet

3 participants