-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
chore(dashboards): Discover split for self hosted dashboard discover widgets #92135
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #92135 +/- ##
==========================================
- Coverage 87.93% 87.89% -0.04%
==========================================
Files 10174 10191 +17
Lines 583385 583680 +295
Branches 22596 22606 +10
==========================================
+ Hits 512992 513042 +50
- Misses 69941 70186 +245
Partials 452 452 |
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
) -> None: | ||
DashboardWidgetQuery = apps.get_model("sentry", "DashboardWidgetQuery") | ||
catch_all_unsplit_widgets = Q( | ||
widget__widget_type=DashboardWidgetTypes.DISCOVER, |
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.
Let's copy over all the enums into the migration file- it's a good practice to not reference application code in the migration. In case someone changes the enums in the application code, we know it's not going to break the migration if it's copied over here
queryset = DashboardWidgetQuery.objects.filter( | ||
widget__widget_type=DashboardWidgetTypes.ERROR_EVENTS, | ||
widget__dataset_source=DatasetSourcesTypes.UNKNOWN.value, | ||
).select_related("widget__dashboard__organization") |
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.
Don't need the select related here. Also, this revert is missing transaction widgets:
queryset = DashboardWidgetQuery.objects.filter(
widget__discover_widget_split__in=[DashboardWidgetTypes.ERROR_EVENTS, DashboardWidgetTypes.TRANSACTION_LIKE],
)
try: | ||
_get_and_save_split_decision_for_dashboard_widget(widget_query, dry_run=False) | ||
except Exception: | ||
widget_query.widget.widget_type = DashboardWidgetTypes.ERROR_EVENTS |
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.
_get_and_save_split_decision_for_dashboard_widget
only updates discover_widget_split
and dataset_source
, so that's what we should do here also. Let's not update widget_type here.
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
The discover split for dashboards has been done for all users except self-hosted users. This migration converts all
Discover
widget types to eitherTransaction
orError
using the_get_and_save_split_decision_for_dashboard_widget
function. This function will try to appropriately categorize a widget query asTransaction
orError
and will default toError
if a decision cannot be made. This uses the same logic of the original discover split job.