diff --git a/src/sentry/api/endpoints/organization_events_stats.py b/src/sentry/api/endpoints/organization_events_stats.py index cb38407cce3ad..70d26aedce89d 100644 --- a/src/sentry/api/endpoints/organization_events_stats.py +++ b/src/sentry/api/endpoints/organization_events_stats.py @@ -22,6 +22,7 @@ metrics_performance, spans_indexed, spans_metrics, + transactions, ) from sentry.snuba.metrics.extraction import MetricSpecType from sentry.snuba.referrer import Referrer @@ -348,8 +349,7 @@ def fn( # This is essentially cached behaviour and we skip the check split_query = query if widget.discover_widget_split == DashboardWidgetTypes.ERROR_EVENTS: - split_dataset = discover - split_query = f"({query}) AND !event.type:transaction" + split_dataset = errors elif widget.discover_widget_split == DashboardWidgetTypes.TRANSACTION_LIKE: # We can't add event.type:transaction for now because of on-demand. split_dataset = scoped_dataset @@ -368,13 +368,12 @@ def fn( ) # Widget has not split the discover dataset yet, so we need to check if there are errors etc. - errors_only_query = f"({query}) AND !event.type:transaction" error_results = None try: error_results = _get_event_stats( - discover, + errors, query_columns, - errors_only_query, + query, params, rollup, zerofill_results, @@ -411,11 +410,10 @@ def fn( if has_errors and has_other_data and not using_metrics: # In the case that the original request was not using the metrics dataset, we cannot be certain that other data is solely transactions. sentry_sdk.set_tag("third_split_query", True) - transactions_only_query = f"({query}) AND event.type:transaction" transaction_results = _get_event_stats( - discover, + transactions, query_columns, - transactions_only_query, + query, params, rollup, zerofill_results,