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

WIP: feat(discover): Query specific datasets in events-stats #75118

Closed
Changes from all 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
14 changes: 6 additions & 8 deletions src/sentry/api/endpoints/organization_events_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
metrics_performance,
spans_indexed,
spans_metrics,
transactions,
)
from sentry.snuba.metrics.extraction import MetricSpecType
from sentry.snuba.referrer import Referrer
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading