-
Notifications
You must be signed in to change notification settings - Fork 836
Add ResourceMonitor module in Cortex, and add ResourceBasedLimiter in Ingesters and StoreGateways
#6674
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
yeya24
merged 30 commits into
cortexproject:master
from
justinjung04:resource-based-throttling
Apr 18, 2025
Merged
Add ResourceMonitor module in Cortex, and add ResourceBasedLimiter in Ingesters and StoreGateways
#6674
Changes from 10 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
80b2d5c
Add resource based throttling to ingesters and store gateways
justinjung04 2121845
doc
justinjung04 2b168fc
Add automaxprocs
justinjung04 56f8e57
nit
justinjung04 9efbbd9
Add test for monitor
justinjung04 30bbd3d
fix tests
justinjung04 fa56e65
changelog
justinjung04 a2ffcdd
Merge branch 'master' into resource-based-throttling
justinjung04 5cccd60
fix test
justinjung04 6e37330
remove interface
justinjung04 08a6adf
address comments
justinjung04 067478b
rename doc
justinjung04 18fdf37
Make monitor more generic + separate scanners
justinjung04 aa81155
fix tests
justinjung04 a528a7a
fix more tests
justinjung04 42e52b3
remove monitor_test.go
justinjung04 50993e1
move noop scanner to darwin scanner
justinjung04 e56431e
doc update
justinjung04 eae4df7
doc
justinjung04 fd19f5c
lint
justinjung04 f588d94
add debugging log on unsupported resource type
justinjung04 6138a9d
test
justinjung04 7bd7ab9
add more error handling + resource_based_limiter_limit metric
justinjung04 6da53e9
fix test
justinjung04 a8d4218
fix test
justinjung04 d6d3839
update changelog
justinjung04 c68bbd2
Move noopScanner to scanner.go and fix RegisterFlagsWithPrefix
justinjung04 025a93a
Add limit breached metric + wrap error with 429
justinjung04 6ffef63
Add more validation and test on instance_limits
justinjung04 7808940
Added _total to counter metric
justinjung04 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
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
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
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
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
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,26 @@ | ||
| package configs | ||
|
|
||
| import ( | ||
| "errors" | ||
| "flag" | ||
| ) | ||
|
|
||
| var ErrInvalidResourceThreshold = errors.New("invalid resource utilization threshold, it must be between 0 and 1") | ||
|
|
||
| type Resources struct { | ||
| CPU float64 `yaml:"cpu"` | ||
| Heap float64 `yaml:"heap"` | ||
| } | ||
|
|
||
| func (cfg *Resources) RegisterFlags(f *flag.FlagSet) { | ||
| f.Float64Var(&cfg.CPU, "resource-thresholds.cpu", 0, "Utilization threshold for CPU in percentage, between 0 and 1. 0 to disable.") | ||
| f.Float64Var(&cfg.Heap, "resource-thresholds.heap", 0, "Utilization threshold for heap in percentage, between 0 and 1. 0 to disable.") | ||
| } | ||
|
|
||
| func (cfg *Resources) Validate() error { | ||
| if cfg.CPU > 1 || cfg.CPU < 0 || cfg.Heap > 1 || cfg.Heap < 0 { | ||
| return ErrInvalidResourceThreshold | ||
| } | ||
|
|
||
| return nil | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.