Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,6 @@ def register_temporary_features(manager: FeatureManager) -> None:
# Enable Conversation focused views in AI Insights
manager.add("organizations:gen-ai-conversations", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
manager.add("organizations:on-demand-gen-metrics-deprecation-prefill", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
manager.add("organizations:on-demand-gen-metrics-deprecation-query-prefill", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
# Enables Conduit demo endpoint and UI
manager.add("organizations:conduit-demo", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable hard timeout alarm for webhooks
Expand Down
7 changes: 0 additions & 7 deletions src/sentry/snuba/metrics/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,6 @@ def should_use_on_demand_metrics_for_querying(organization: Organization, **kwar
logger.error("Add the feature flag to create the spec for this function.")
return False

supported_by = _query_supported_by(**kwargs)
if (
features.has("organizations:on-demand-gen-metrics-deprecation-query-prefill", organization)
and supported_by.on_demand_metrics
):
return True

return should_use_on_demand_metrics(**kwargs)


Expand Down
65 changes: 0 additions & 65 deletions tests/sentry/search/events/builder/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3520,71 +3520,6 @@ def test_run_query_with_spm_and_time_range_not_required_and_not_supplied(self) -
snql_query.select,
)

def test_run_query_with_on_demand_deprecation_flag_enabled(self) -> None:
field = "count()"
query_s = ""
spec = OnDemandMetricSpec(field=field, query=query_s, spec_type=MetricSpecType.SIMPLE_QUERY)

self.store_transaction_metric(
value=1,
metric=TransactionMetricKey.COUNT_ON_DEMAND.value,
internal_metric=TransactionMRI.COUNT_ON_DEMAND.value,
entity="metrics_counters",
tags={"query_hash": spec.query_hash},
timestamp=self.start,
)

with Feature("organizations:on-demand-gen-metrics-deprecation-query-prefill"):
query = AlertMetricsQueryBuilder(
self.params,
granularity=3600,
time_range_window=3600,
query=query_s,
dataset=Dataset.PerformanceMetrics,
selected_columns=[field],
config=QueryBuilderConfig(
on_demand_metrics_enabled=True,
on_demand_metrics_type=MetricSpecType.SIMPLE_QUERY,
skip_time_conditions=False,
),
)

# Verify the SNQL query structure uses on-demand metrics
snql_request = query.get_snql_query()
assert snql_request.dataset == "generic_metrics"
snql_query = snql_request.query

self.assertEqual(
[
Function(
"sumIf",
[
Column("value"),
Function(
"equals",
[
Column("metric_id"),
indexer.resolve(
UseCaseID.TRANSACTIONS,
1,
"c:transactions/on_demand@none",
),
],
),
],
"c:transactions/on_demand@none",
)
],
snql_query.select,
)

result = query.run_query("test_query")

assert result["data"] == [{"c:transactions/on_demand@none": 1.0}]
meta = result["meta"]
assert len(meta) == 1
assert meta[0]["name"] == "c:transactions/on_demand@none"

def test_run_query_with_on_demand_deprecation_flag_disabled(self) -> None:
field = "count()"
query_s = ""
Expand Down
9 changes: 0 additions & 9 deletions tests/snuba/api/endpoints/test_organization_events_mep.py
Original file line number Diff line number Diff line change
Expand Up @@ -3866,15 +3866,6 @@ def test_on_demand_count_unique(self) -> None:
self._assert_on_demand_response(response, expected_on_demand_query=True)
assert response.data["data"] == [{"count_unique(user)": 2}]

def test_on_demand_for_metrics_deprecation(self) -> None:
params = {"field": ["count()"], "query": "", "yAxis": "count()"}
specs = self._create_specs(params)
for spec in specs:
self.store_on_demand_metric(1, spec=spec)
with self.feature("organizations:on-demand-gen-metrics-deprecation-query-prefill"):
response = self._make_on_demand_request(params)
self._assert_on_demand_response(response)

def test_split_decision_for_errors_widget(self) -> None:
error_data = load_data("python", timestamp=before_now(minutes=1))
self.store_event(
Expand Down
Loading