Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Attempt to fix realm quota alert #743

Merged
merged 1 commit into from
Oct 2, 2020

Conversation

sethvargo
Copy link
Member

@sethvargo sethvargo commented Oct 2, 2020

  • Display the currently configured limit and remaining tokens on the realm settings page.
  • Only create the metrics for realms that have abuse prevention enabled.

Fixes #735

Release Note

Display the currently configured limit and remaining tokens on the realm settings page

- Display the currently configured limit and remaining tokens on the
  realm settings page.
- Only create the metrics for realms that have abuse prevention enabled.
return
}
key := fmt.Sprintf("realm:quota:%s", dig)
limit, remaining, reset, ok, err := c.limiter.Take(ctx, key)
c.recordCapacity(ctx, limit, remaining)
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved this up - we were only recording capacity later, which I think would cause us to miss some data points.

if !realm.AbusePreventionEnabled {
return
}
func (c *Controller) recordCapacity(ctx context.Context, limit, remaining uint64) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this to rely on the value that comes from the limiter, not the value on the realm. The enforcement happens based on what's in the limiter, so we should alert and record off of that.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jeremyfaller, sethvargo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [jeremyfaller,sethvargo]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot google-oss-robot merged commit 0db80f9 into main Oct 2, 2020
@google-oss-robot google-oss-robot deleted the sethvargo/ratelimiting_question_mark branch October 2, 2020 19:00
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Auto: added by CLA bot when all committers have signed a CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add page to see current realm quotas
3 participants