-
Notifications
You must be signed in to change notification settings - Fork 480
Request Cost accounting - adding a cost for various api request actions. #32890
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
Merged
+3,073
−231
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…adding a cost for various api request actions. ref: #32886
jdotcms
reviewed
Aug 11, 2025
dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java
Outdated
Show resolved
Hide resolved
jdotcms
reviewed
Aug 11, 2025
jdotcms
approved these changes
Aug 11, 2025
Implementing request costing. - Adding annotation for @RequestCost(increment=2) - RequestCostAPI - Adding appropriate annotations - Adding cost reporting ref: #32890
Implementing request costing. - Adding Tests ref: #32890
Implementing request costing. - Adding Tests ref: #32890
Implementing request costing. fixing annotations ref: #32890
Implementing request costing. fixing reporting ref: #32890
Using an Enum to centralize pricing ref: #32890
Using an Enum to centralize pricing ref: #32890
Using an Enum to centralize pricing ref: #32890
spbolton
reviewed
Dec 17, 2025
…appens in real time, not after a request has finished. ref: #32886
…appens in real time, not after a request has finished. ref: #32886
…appens in real time, not after a request has finished. ref: #32886
…appens in real time, not after a request has finished. ref: #32886
…appens in real time, not after a request has finished. ref: #32886
…appens in real time, not after a request has finished. ref: #32886
spbolton
approved these changes
Jan 7, 2026
sfreudenthaler
approved these changes
Jan 7, 2026
Member
sfreudenthaler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my friend Claude and I agree that this is good to go 🥇 🤖
dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java
Show resolved
Hide resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR Implements a request cost accounting system that tracks API usage and provides optional rate limiting using a leaky token bucket algorithm.
Key Features
Request Cost Tracking
x-dotrequest-costresponse header showing request costOptional Rate Limiting
x-dotratelimit-toks-maxresponse header showing how many tokens remain in bucket and the max bucket value.RATE_LIMIT_ENABLED,RATE_LIMIT_REFILL_PER_SECOND,RATE_LIMIT_MAX_BUCKET_SIZERATE_LIMIT_REFILL_PER_SECOND. If the bucket is empty, the rate limiter will reject requests with a429orTo Many Requesterror when tokens are exhausted.Accounting Modes
If you are logged in, you can add a query parameter
dotAccountingto any request to get an accounting of its cost, e.g.Configuration with defaults
Tests
To Do
ref: #32886
This PR fixes: #32886