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

feat(processing): add electron symbol server to default for electron projects #81118

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/sentry/api/endpoints/team_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,10 @@ def post(self, request: Request, team: Team) -> Response:
if project_is_seer_eligible(project):
project.update_option("sentry:similarity_backfill_completed", int(time.time()))

# Add electron symbol server by default to both electron and javascript-electron projects
if project.platform and project.platform in ["electron", "javascript-electron"]:
project.update_option(
"sentry:builtin_symbol_sources", ["ios", "microsoft", "electron"]
)

Copy link
Member

Choose a reason for hiding this comment

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

This does a very similar thing as set_default_inbound_filters above. Two suggestions

  • Move it up so both of these are placed together. Going forward, this is a good place to add new, similar functionality.
  • Create a helper function that you can also call from the DatabaseBackedProjectService.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I was pondering that, but then we set the seer project option sentry:similarity_backfill_completed below, so I followed that lead. But good points, rearranged and pulled it into a helper function.

return Response(serialize(project, request.user), status=201)
5 changes: 5 additions & 0 deletions src/sentry/projects/services/project/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def create_project_for_organization(
sender=self.create_project_for_organization,
user_id=user_id,
)
# Add electron symbol server by default to both electron and javascript-electron projects
if project.platform and project.platform in ["electron", "javascript-electron"]:
project.update_option(
"sentry:builtin_symbol_sources", ["ios", "microsoft", "electron"]
)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the project_created signal is intentionally sent at the very end just before returning the project. Could you reorder this accordingly?


return serialize_project(project)

Expand Down
41 changes: 41 additions & 0 deletions tests/sentry/api/endpoints/test_team_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,44 @@ def test_similarity_project_option_invalid(self):
)
is None
)

def test_builtin_symbol_sources_electron(self):
"""
Test that project option for builtin symbol sources contains ["electron"] when creating
an Electron project, but uses defaults for other platforms.
"""
# Test Electron project
response = self.get_success_response(
self.organization.slug,
self.team.slug,
name="electron-app",
slug="electron-app",
platform="electron",
status_code=201,
)

electron_project = Project.objects.get(id=response.data["id"])
assert electron_project.platform == "electron"
symbol_sources = ProjectOption.objects.get_value(
project=electron_project, key="sentry:builtin_symbol_sources"
)
assert symbol_sources == ["ios", "microsoft", "electron"]

def test_builtin_symbol_sources_not_electron(self):
# Test non-Electron project (e.g. Python)
response = self.get_success_response(
self.organization.slug,
self.team.slug,
name="python-app",
slug="python-app",
platform="python",
status_code=201,
)

python_project = Project.objects.get(id=response.data["id"])
assert python_project.platform == "python"
# Should use default value, not ["electron"]
symbol_sources = ProjectOption.objects.get_value(
project=python_project, key="sentry:builtin_symbol_sources"
)
assert "electron" not in symbol_sources
Loading