From 1e6f3486146e8eac616903c2c4b90a08e214d37c Mon Sep 17 00:00:00 2001 From: Riya Chakraborty Date: Wed, 3 Jul 2024 17:05:01 -0700 Subject: [PATCH] wip --- src/sentry/snuba/tasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sentry/snuba/tasks.py b/src/sentry/snuba/tasks.py index 030c990c59e4f..d4035761be15b 100644 --- a/src/sentry/snuba/tasks.py +++ b/src/sentry/snuba/tasks.py @@ -197,12 +197,18 @@ def _create_in_snuba(subscription: QuerySubscription) -> str: ) span.set_tag("dataset", subscription.snuba_query.dataset) - snuba_query = subscription.snuba_query + snuba_query: SnubaQuery = subscription.snuba_query entity_subscription = get_entity_subscription_from_snuba_query( snuba_query, subscription.project.organization_id, ) query_string = build_query_strings(subscription, snuba_query).query_string + + if "transaction.duration" in snuba_query.aggregate: + snuba_query.aggregate + f"{{{query_string}}}" + # timestamp start and end conditions + # project_id, org_id, use_case_id filters + snql_query = entity_subscription.build_query_builder( query=query_string, project_ids=[subscription.project_id],