Skip to content

Commit

Permalink
fix(metrics-extraction): Allow overriding split decision (#66259)
Browse files Browse the repository at this point in the history
### Summary
If there are any problems with the split decision this will cause it to
always re-run the code and save the new decision,
  • Loading branch information
k-fish authored and aliu39 committed Mar 6, 2024
1 parent 69e2a34 commit 9d26087
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/sentry/api/endpoints/organization_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,13 @@ def fn(offset, limit) -> dict[str, Any]:
try:
widget = DashboardWidget.objects.get(id=dashboard_widget_id)
does_widget_have_split = widget.discover_widget_split is not None
has_override_feature = features.has(
"organizations:performance-discover-widget-split-override-save",
organization,
actor=request.user,
)

if does_widget_have_split:
if does_widget_have_split and not has_override_feature:
# This is essentially cached behaviour and we skip the check
split_query = scoped_query
if widget.discover_widget_split == DashboardWidgetTypes.ERROR_EVENTS:
Expand Down
7 changes: 6 additions & 1 deletion src/sentry/api/endpoints/organization_events_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,13 @@ def fn(
try:
widget = DashboardWidget.objects.get(id=dashboard_widget_id)
does_widget_have_split = widget.discover_widget_split is not None
has_override_feature = features.has(
"organizations:performance-discover-widget-split-override-save",
organization,
actor=request.user,
)

if does_widget_have_split:
if does_widget_have_split and not has_override_feature:
# This is essentially cached behaviour and we skip the check
split_query = query
if widget.discover_widget_split == DashboardWidgetTypes.ERROR_EVENTS:
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/conf/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,8 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
"organizations:performance-database-view-percentiles": False,
# Enable UI sending a discover split for widget
"organizations:performance-discover-widget-split-ui": False,
# Enable backend overriding and always making a fresh split decision
"organizations:performance-discover-widget-split-override-save": False,
# Enables updated all events tab in a performance issue
"organizations:performance-issues-all-events-tab": False,
# Enable compressed assets performance issue type
Expand Down
1 change: 1 addition & 0 deletions src/sentry/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
default_manager.add("organizations:performance-database-view", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
default_manager.add("organizations:performance-db-main-thread-detector", OrganizationFeature)
default_manager.add("organizations:performance-discover-widget-split-ui", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
default_manager.add("organizations:performance-discover-widget-split-override-save", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
default_manager.add("organizations:performance-file-io-main-thread-detector", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
default_manager.add("organizations:performance-issues-all-events-tab", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
default_manager.add("organizations:performance-issues-compressed-assets-detector", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
Expand Down

0 comments on commit 9d26087

Please sign in to comment.