-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(tasks) Enable taskworkers by default in self-hosted #99374
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
4 commits
Select commit
Hold shift + click to select a range
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
192 changes: 0 additions & 192 deletions
192
tests/sentry/api/endpoints/test_project_codeowners_details.py
This file was deleted.
Oops, something went wrong.
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,4 +1,3 @@ | ||
| from datetime import datetime, timezone | ||
| from unittest import mock | ||
| from unittest.mock import MagicMock, patch | ||
|
|
||
|
|
@@ -9,6 +8,7 @@ | |
| from sentry.models.projectcodeowners import ProjectCodeOwners | ||
| from sentry.testutils.cases import APITestCase | ||
| from sentry.testutils.helpers.analytics import assert_last_analytics_event | ||
| from sentry.testutils.helpers.datetime import freeze_time | ||
|
|
||
|
|
||
| class ProjectCodeOwnersDetailsEndpointTestCase(APITestCase): | ||
|
|
@@ -63,12 +63,10 @@ def test_basic_delete(self) -> None: | |
| assert response.status_code == 204 | ||
| assert not ProjectCodeOwners.objects.filter(id=str(self.codeowners.id)).exists() | ||
|
|
||
| @patch("django.utils.timezone.now") | ||
| def test_basic_update(self, mock_timezone_now: MagicMock) -> None: | ||
| @freeze_time("2023-10-03 00:00:00") | ||
| def test_basic_update(self) -> None: | ||
|
Member
Author
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. These tests were also duplicated in |
||
| self.create_external_team(external_name="@getsentry/frontend", integration=self.integration) | ||
| self.create_external_team(external_name="@getsentry/docs", integration=self.integration) | ||
| date = datetime(2023, 10, 3, tzinfo=timezone.utc) | ||
| mock_timezone_now.return_value = date | ||
| raw = "\n# cool stuff comment\n*.js @getsentry/frontend @NisanthanNanthakumar\n# good comment\n\n\n docs/* @getsentry/docs @getsentry/ecosystem\n\n" | ||
| data = { | ||
| "raw": raw, | ||
|
|
@@ -89,7 +87,7 @@ def test_basic_update(self, mock_timezone_now: MagicMock) -> None: | |
| assert response.data["id"] == str(self.codeowners.id) | ||
| assert response.data["raw"] == raw.strip() | ||
| codeowner = ProjectCodeOwners.objects.filter(id=self.codeowners.id)[0] | ||
| assert codeowner.date_updated == date | ||
| assert codeowner.date_updated.strftime("%Y-%m-%d %H:%M:%S") == "2023-10-03 00:00:00" | ||
|
|
||
| def test_wrong_codeowners_id(self) -> None: | ||
| self.url = reverse( | ||
|
|
||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential bug: Changing the default of
taskworker.enabledtoTruewill break self-hosted deployments, which lack the required Kafka infrastructure and will fail to process background tasks.Description: Changing the default for
taskworker.enabledtoTrueroutes background tasks to the taskworker system. This system relies on Kafka, as shown by topic definitions insrc/sentry/conf/types/kafka_definition.pyand producer logic insrc/sentry/taskworker/registry.py. Self-hosted deployments are configured with Redis/RabbitMQ for Celery and do not have Kafka infrastructure. The change lacks a corresponding override inself-hosted/sentry.conf.pyto keep taskworkers disabled. As a result, self-hosted instances will attempt to send tasks to non-existent Kafka brokers, causing background job processing to fail and breaking core Sentry functionality.Suggested fix: Add
SENTRY_OPTIONS["taskworker.enabled"] = Falsetoself-hosted/sentry.conf.py. This will maintain the existing Celery-based task processing for self-hosted instances and prevent breakages until they are prepared to migrate to the new taskworker system.severity: 0.92, confidence: 0.98
Did we get this right? 👍 / 👎 to inform future reviews.