{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
2
Question by sgilson · Nov 09, 2015 at 02:17 PM · 341 Views quotaresetquota

Cannot get ResetQuota to reset the quota count

I have a simple Quota policy that I want to reset by using the ResetQuota policy, but I cannot get ResetQuota to work. My Quota policy:

<Quota async="false" continueOnError="false" enabled="true" name="Quota-PreFlow">
    <DisplayName>Quota-PreFlow</DisplayName>
    <Interval>1</Interval>
    <TimeUnit>hour</TimeUnit>
    <Allow count="100"/>
    <Synchronous>true</Synchronous>
    <Distributed>true</Distributed>
</Quota> 

If I call ResetQuota with no Identifier, current count is unchanged meaning ResetQuota did nothing. Shouldn't it be reset to 100?:

<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Preflow-Quota">
    <DisplayName>Reset Preflow Quota</DisplayName>
    <Quota name="Quota-PreFlow">
    </Quota>
</ResetQuota> 

I then added an Identifier in the Quota policy:

<Quota async="false" continueOnError="false" enabled="true" name="Quota-PreFlow">
    <DisplayName>Quota-PreFlow</DisplayName>
    <Interval>1</Interval>
    <TimeUnit>hour</TimeUnit>
    <Allow count="100"/>
    <Synchronous>true</Synchronous>
    <Distributed>true</Distributed>
    <Identifier ref="request.queryparam.id"/>
</Quota> 

Before ResetQuota policy, the count for the id="smg" was 96. After the ResetQuota it was 196, meaning the value in ResetQuota was added to current count - it was not reset to 100.

<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Preflow-Quota">
    <DisplayName>Reset Preflow Quota</DisplayName>
    <Quota name="Quota-PreFlow">
        <Identifier name="identifierName" ref="request.queryparam.id">
            <Allow>100</Allow>
        </Identifier>
    </Quota>
</ResetQuota> 

If I take <Allow> out of ResetQuota, then it does nothing. After the call, the current count for the Quota is unchanged:

<ResetQuota async="false" continueOnError="false" enabled="true" name="Reset-Preflow-Quota">
    <DisplayName>Reset Preflow Quota</DisplayName>
    <Quota name="Quota-PreFlow">
        <Identifier name="identifierName" ref="request.queryparam.id">
        </Identifier>
    </Quota>
</ResetQuota>
Comment
Add comment Show 3
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sgilson ♦♦ · Nov 09, 2015 at 05:09 PM 0
Link

Some more info. For the first scenario with no identifier, here are the flow vars.

Before:

ratelimit.Quota-PreFlow.allowed.count 100
ratelimit.Quota-PreFlow.available.count 97
ratelimit.Quota-PreFlow.identifier _default
ratelimit.Quota-PreFlow.total.exceed.count 0
ratelimit.Quota-PreFlow.used.count 3 

After:

ratelimit.Quota-PreFlow.allowed.count 100
ratelimit.Quota-PreFlow.available.count 96
ratelimit.Quota-PreFlow.identifier _default
ratelimit.Quota-PreFlow.total.exceed.count 0
ratelimit.Quota-PreFlow.used.count 4 

With the identifier "smg".

Before:

ratelimit.Quota-PreFlow.allowed.count 100
ratelimit.Quota-PreFlow.available.count 95
ratelimit.Quota-PreFlow.identifier smg
ratelimit.Quota-PreFlow.total.exceed.count 0
ratelimit.Quota-PreFlow.used.count 5

After:

ratelimit.Quota-PreFlow.allowed.count 100
ratelimit.Quota-PreFlow.available.count 194
ratelimit.Quota-PreFlow.identifier smg
ratelimit.Quota-PreFlow.total.exceed.count 0
ratelimit.Quota-PreFlow.used.count -94
avatar image Anil Sagar @ Google ♦♦ sgilson ♦♦   · Nov 11, 2015 at 05:41 AM 0
Link

@sgilson , I can able to reproduce same, Policy name is misleading in this case. Ideally it should reset to original counter value instead of adding the count to existing available count. Yes, It doesn't work on global identifier.

avatar image sgilson ♦♦ Anil Sagar @ Google ♦♦ · Nov 11, 2015 at 12:47 PM 2
Link

Thanks @Anil Sagar, based on how it seems to work, the ResetQuota policy should really be called "IncreaseQuota" or "TempIncreaseQuota" because the way it works is:

- Add a value to available.count

- Subtract that same value from used.count

- Discard the changes when the Quota policy next resets

Close

1 Answer

  • Sort: 
avatar image
0
Best Answer

Answer by sgilson · Nov 12, 2015 at 04:07 PM

I updated the ResetQuota doc with this info.

Stephen

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to use Reset Quota correctly? 1 Answer

Is there any management API available to get current quota usage of a developer app? 3 Answers

What are the Advantages / Disadvantages of Rolling window in Quota Policy compared to Fixed window of interval ? 1 Answer

Is there way to assign a quota to a specific ApiKey as an attribute that overrides the quota on the API Product? 1 Answer

Quota based on Developer Id 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges