Skip to content

feat(workflow): Adding project slugs to Rule and AlertRule serializer#20075

Closed
iProgramStuff wants to merge 3 commits intomasterfrom
feat/projectsinruleserializer
Closed

feat(workflow): Adding project slugs to Rule and AlertRule serializer#20075
iProgramStuff wants to merge 3 commits intomasterfrom
feat/projectsinruleserializer

Conversation

@iProgramStuff
Copy link
Copy Markdown
Contributor

@iProgramStuff iProgramStuff commented Jul 28, 2020

Adding project slugs to the api response so the frontend can display them in the rule listing.

Copy link
Copy Markdown
Member

@scttcper scttcper left a comment

Choose a reason for hiding this comment

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

lgtm 👍

Comment on lines +39 to +43
for alert_rule_id, project_slug in AlertRuleExcludedProjects.objects.filter(
alert_rule__in=item_list
).values_list("alert_rule_id", "project__slug"):
exclusions = result[alert_rules[alert_rule_id]].setdefault("excludedProjects", [])
exclusions.append(project_slug)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need the excluded projects here? I'd leave them in the detailed serializer otherwise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, doesn't it seem appropriate? We could use the info to know which projects to display in the list (probably more useful once we have multi project alerts?).

Could put it back into the detailed serializer, but bringing it in here also makes the details serializer redundant (I was able to remove it)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have a general problem where we start putting more and more things into a serializer, and at some point our endpoints end up slow due to extra serialization + db queries. Unless we actually need this data now I'd say it should remain in the detailed serializer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gotcha. Will put it back into the detailed serializer until we have an explicit need.

@evanpurkhiser evanpurkhiser deleted the feat/projectsinruleserializer branch October 13, 2020 22:09
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants