-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(symbolicator): Add the ability to manipulate the automatic killswitch for the LPQ #28757
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
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
208736a
feat(symbolicator): Add the ability to manipulate the automatic kills…
relaxolotl f9c51b5
style(lint): Auto commit lint changes
getsantry[bot] 9c61ac6
forgot to update tests
relaxolotl ed1b4ac
fix types
relaxolotl 9887140
TODO answered
relaxolotl 2cabcf9
better name
relaxolotl 60091a4
fix up docs
relaxolotl 7926d03
fix types once again
relaxolotl 181a661
partial updates aren't a thing so they don't need to be handled
relaxolotl f817e9b
types
relaxolotl a881179
inner was renamed to cluster
relaxolotl 94c3be2
fix tests
relaxolotl 3ffba2e
remove parts of docstrings that aren't implemented by the function it…
relaxolotl 307bb51
axe _to_int because it hides a problem we want visible
relaxolotl 8bf11bc
missed a detail
relaxolotl c131716
style(lint): Auto commit lint changes
getsantry[bot] 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,14 @@ | ||
| import datetime | ||
| from typing import Set | ||
|
|
||
| from sentry.exceptions import InvalidConfiguration | ||
| from sentry.utils import redis | ||
|
|
||
| from . import base | ||
|
|
||
| # redis key for entry storing current list of LPQ members | ||
| LPQ_MEMBERS_KEY = "store.symbolicate-event-lpq-selected" | ||
|
|
||
|
|
||
| class RedisRealtimeMetricsStore(base.RealtimeMetricsStore): | ||
| """An implementation of RealtimeMetricsStore based on a Redis backend.""" | ||
|
|
@@ -80,3 +84,41 @@ def increment_project_duration_counter( | |
| pipeline.hincrby(key, duration, 1) | ||
| pipeline.pexpire(key, self._histogram_ttl) | ||
| pipeline.execute() | ||
|
|
||
| def get_lpq_projects(self) -> Set[int]: | ||
| """ | ||
| Fetches the list of projects that are currently using the low priority queue. | ||
|
|
||
| Returns a list of project IDs. | ||
| """ | ||
| return {int(project_id) for project_id in self.cluster.smembers(LPQ_MEMBERS_KEY)} | ||
|
|
||
| def add_project_to_lpq(self, project_id: int) -> None: | ||
| """ | ||
| Assigns a project to the low priority queue. | ||
|
|
||
| This registers an intent to redirect all symbolication events triggered by the specified | ||
| project to be redirected to the low priority queue. | ||
|
|
||
| This may throw an exception if there is some sort of issue registering the project with the | ||
| queue. | ||
| """ | ||
|
|
||
| # This returns 0 if project_id was already in the set, 1 if it was added, and throws an | ||
| # exception if there's a problem so it's fine if we just ignore the return value of this as | ||
| # the project is always added if this successfully completes. | ||
| self.cluster.sadd(LPQ_MEMBERS_KEY, project_id) | ||
|
|
||
| def remove_projects_from_lpq(self, project_ids: Set[int]) -> None: | ||
| """ | ||
| Removes projects from the low priority queue. | ||
|
|
||
| This registers an intent to restore all specified projects back to the regular queue. | ||
|
|
||
| This may throw an exception if there is some sort of issue deregistering the projects from | ||
| the queue. | ||
| """ | ||
| if len(project_ids) == 0: | ||
| return | ||
|
|
||
| self.cluster.srem(LPQ_MEMBERS_KEY, *project_ids) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i had no idea the |
||
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
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.