-
Notifications
You must be signed in to change notification settings - Fork 834
Add proposal for user overrides API #6818
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
friedrichg
merged 7 commits into
cortexproject:master
from
bogdan-st:limits-api-proposal
Jul 11, 2025
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ecf77c0
Add proposal for tenant limits API
bogdan-st 2bdb6e5
Change endpoints
bogdan-st d79f421
suggestions
bogdan-st 4f12163
support only block storage
bogdan-st 1e9f61c
overrides not limits
bogdan-st bd2ca17
grammar
bogdan-st e789985
move hard limits to open questions
bogdan-st File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| title: "User Overrides API" | ||
| linkTitle: "User Overrides API" | ||
| weight: 1 | ||
| slug: overrides-api | ||
| --- | ||
|
|
||
| - Author: Bogdan Stancu | ||
| - Date: June 2025 | ||
| - Status: Proposed | ||
|
|
||
| ## Overview | ||
|
|
||
| This proposal outlines the design for a new API endpoint that will allow users to modify their current limits in Cortex. Currently, overrides can only be changed by administrators modifying the runtime configuration file and waiting for it to be reloaded. | ||
|
|
||
| ## Problem | ||
|
|
||
| Currently, when users need limit adjustments, they must: | ||
| 1. Manually editing the runtime configuration file | ||
| 2. Coordinate with users to verify the changes | ||
| 3. Potentially repeating this process multiple times to find the right balance | ||
|
|
||
| This manual process is time-consuming, error-prone, and doesn't scale well with a large number of users. By offering a self-service API, users can adjust their own limits within predefined boundaries, reducing the administrative overhead and improving the user experience. | ||
|
|
||
| ## Proposed API Design | ||
|
|
||
| ### Endpoints | ||
|
|
||
| #### 1. GET /api/v1/user-overrides | ||
| Returns the current overrides configuration for a specific tenant. | ||
|
|
||
| Response format: | ||
| ```json | ||
| { | ||
| "ingestion_rate": 10000, | ||
| "ingestion_burst_size": 20000, | ||
| "max_global_series_per_user": 1000000, | ||
| "max_global_series_per_metric": 200000, | ||
| ... | ||
| } | ||
| ``` | ||
|
|
||
| #### 2. PUT /api/v1/user-overrides | ||
| Updates overrides for a specific tenant. The request body should contain only the overrides that need to be updated. | ||
|
|
||
| Request body: | ||
| ```json | ||
| { | ||
| "ingestion_rate": 10000, | ||
| "max_series_per_metric": 100000 | ||
| } | ||
| ``` | ||
|
|
||
| #### 3. DELETE /api/v1/user-overrides | ||
| Removes tenant-specific overrides, reverting to default overrides. | ||
|
|
||
| ### Implementation Details | ||
|
|
||
| 1. The API will be integrated into the cortex-overrides component to: | ||
| - Read the current runtime config from the configured storage backend | ||
| - Persist changes back to the storage backend | ||
| - The API will only work with configurations stored in block storage backends. | ||
|
|
||
| 2. Security: | ||
| - Rate limiting will be implemented to prevent abuse | ||
| - Changes will be validated before being applied | ||
friedrichg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - A hard limit configuration will be implemented | ||
| Hard limits will not be changable through the API | ||
| Example: | ||
| ```yaml | ||
| # file: runtime.yaml | ||
| # In this example, we're overriding ingestion limits for a single tenant. | ||
| overrides: | ||
| "user1": | ||
| ingestion_burst_size: 350000 | ||
| ingestion_rate: 350000 | ||
| max_global_series_per_metric: 300000 | ||
| max_global_series_per_user: 300000 | ||
| max_series_per_metric: 0 | ||
| max_series_per_user: 0 | ||
| max_samples_per_query: 100000 | ||
| max_series_per_query: 100000 | ||
| configurable-overrides: # still not sure about the naming for this section | ||
|
||
| "user1": | ||
| ingestion_rate: 700000 | ||
| max_global_series_per_user: 700000 | ||
| ``` | ||
|
|
||
| 3. Error Handling: | ||
| - Invalid limit values will return 400 Bad Request | ||
| - Storage backend errors will return 500 Internal Server Error | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.