Skip to content
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

spike(aci): update and serialize project options attached to ErrorDetector #81388

Closed
wants to merge 2 commits into from

Conversation

cathteng
Copy link
Member

Leave the underlying usage of project options for grouping and auto-resolve. But collect them for serializing an error detector and updating an error detector via the API.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 27, 2024
@cathteng cathteng requested a review from a team November 27, 2024 20:34
Copy link

codecov bot commented Nov 27, 2024

❌ 899 Tests Failed:

Tests completed Failed Passed Skipped
23233 899 22334 213
View the top 3 failed tests by shortest run time
tests.sentry.utils.test_eventuser.EventUserTestCase::test_tag_value_primary_is_email
Stack Traces | 0.006s run time
No failure message available
tests.snuba.search.test_backend.EventsSnubaSearchTest::test_sort
Stack Traces | 0.006s run time
No failure message available
tests.snuba.search.test_backend.EventsSnubaSearchTest::test_tags
Stack Traces | 0.006s run time
No failure message available

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@cathteng cathteng requested a review from wedamija November 27, 2024 20:44
Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

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

i feel like this generally makes sense at a high level, but we'll probably want to relocate some code.

return attrs

def serialize(self, obj: Detector, attrs: Mapping[str, Any], user, **kwargs) -> dict[str, Any]:
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi - it might be nice to call the parent serialize here so we can reuse the data shape in the API. ideally we have a standardized detector serialized model as well for consistency in the UI.

return self.project.get_option(key, default=default, validate=validate)


class ErrorDetector(Detector):
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: i think we'd want to move this class out of this file, my guess is we're eventually going to have a lot of detectors.


@property
def CONFIG_SCHEMA(self) -> dict[str, Any]:
return {}
Copy link
Contributor

Choose a reason for hiding this comment

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

plz fill out for real pr :)

@@ -105,3 +106,28 @@ def detector_handler(self) -> DetectorHandler | None:
def get_audit_log_data(self) -> dict[str, Any]:
# TODO: Create proper audit log data for the detector, group and conditions
return {}

def get_option(
Copy link
Contributor

Choose a reason for hiding this comment

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

this method should probably only live on ErrorDetector (or just make the query wherever it's being used)

organization_id=self.context["project"].organization_id,
name=validated_data["name"],
# no workflow_condition_group
type=validated_data["group_type"].slug,
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a proxy, and we'll need to re-lookup error detectors based on this field later, i think this would need to be the enum value for error detector (Rather than the group_type slug)

(when processing the workflows, i lookup error detectors by type + project id, since the event won't be able to include the detector id)

Copy link
Member Author

Choose a reason for hiding this comment

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

i think this is a leftover from the metric alert detector, but we can change it for all of them if necessary

@@ -67,14 +68,18 @@ class GroupingConfigLoader:

cache_prefix: str # Set in subclasses

def get_config_dict(self, project: Project) -> GroupingConfig:
def get_config_dict(self, project: Project, detector: Detector | None = None) -> GroupingConfig:
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems like we're passing around the detector a bit here - is there anything we can do to reduce the blast radius (diff size)? Do we need to pass it to both get_config_id and get enhancements? could we add another method that takes the detector info an handles all this?

@getsantry
Copy link
Contributor

getsantry bot commented Jan 1, 2025

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Jan 1, 2025
@cathteng
Copy link
Member Author

cathteng commented Jan 2, 2025

Replaced by #82533

@cathteng cathteng closed this Jan 2, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants