Skip to content

Adding rate limiting statistics api #11424

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

stevenwinship
Copy link
Contributor

What this PR does / why we need it: Dev/Dev Ops needs an API to see the current state that Rate Limiting is in. I.E. number of users being limited, number of available bucket tokens for a command, other info TBD.

Which issue(s) this PR closes:#11413

Special notes for your reviewer:

Suggestions on how to test this:

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: Included

Additional documentation: Admin api doc

@stevenwinship stevenwinship self-assigned this Apr 14, 2025
@github-actions github-actions bot added FY25 Sprint 21 FY25 Sprint 21 (2025-04-09 - 2025-04-23) Size: 20 A percentage of a sprint. 14 hours. Type: Feature a feature request labels Apr 14, 2025
@stevenwinship stevenwinship moved this to In Progress 💻 in IQSS Dataverse Project Apr 14, 2025
@coveralls
Copy link

coveralls commented Apr 14, 2025

Coverage Status

coverage: 22.998% (-0.009%) from 23.007%
when pulling 99581b1 on 11413-rate-limiting-statistics-api
into 72747c2 on develop.

This comment has been minimized.

@stevenwinship stevenwinship requested a review from landreev April 14, 2025 16:06

This comment has been minimized.

This comment has been minimized.

@landreev landreev self-assigned this Apr 14, 2025
@@ -0,0 +1,44 @@
Rate Limiting
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you removing this text from installation/config.rst? (or is it going to link here as well?)
... I don't have a preference personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it should be in both places but I can remove it if you think it's redundant. @pdurbin ?

CSV dump of Rate Limiting Cache

curl http://localhost:8080/api/admin/rateLimitStats
curl http://localhost:8080/api/admin/rateLimitStats?deltaMinutesFilter=10
Copy link
Contributor

Choose a reason for hiding this comment

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

I like it. The deltaMinutesFilter parameter will be useful, I think.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

Some quick feedback.

In order to monitor the rate limiting cache for investigative purposes there is a stats endpoint which returns CSV formatted text. The CSV contains multiple lists.
The first list contains the username:command, and number of tokens remaining. This list is sorted by the values and has the header "#<username>:<command>, <available tokens>".
The second list contains username:command, last updated timestamp in minutes, and delta minutes before now. The header for this list is "#<username>:<command>, <timestamp>, <delta minutes> ## deltaMinutesFilter=1".
This list can be filtered to show only the entries with updates within the deltaMinutesFilter requested. ("## deltaMinutesFilter=n" will be added to the header when the filter is included in the call.
Copy link
Member

Choose a reason for hiding this comment

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

The above is great content but it's a little smooshed together in the HTML version: https://dataverse-guide--11424.org.readthedocs.build/en/11424/admin/rate_limiting.html#statistics

Maybe add some newlines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reformatted

@landreev landreev removed their assignment Apr 15, 2025
Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11413-rate-limiting-statistics-api
ghcr.io/gdcc/configbaker:11413-rate-limiting-statistics-api

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 21 FY25 Sprint 21 (2025-04-09 - 2025-04-23) Size: 20 A percentage of a sprint. 14 hours. Type: Feature a feature request
Projects
Status: In Progress 💻
Development

Successfully merging this pull request may close these issues.

Feature Request: Rate Limiting API to return statistics
4 participants