Skip to content

Commit ccfecac

Browse files
wedamijaclaude
andcommitted
fix: Expect IncompatibleMetricsQuery for custom tags with default tags enabled
Since mep-use-default-tags is now always on, non-on-demand queries correctly reject custom tags not in DEFAULT_METRIC_TAGS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d61cb09 commit ccfecac

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

tests/sentry/search/events/builder/test_metrics.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,20 +2600,19 @@ def test_run_top_timeseries_query_with_on_demand_columns(self) -> None:
26002600
assert spec_map[field]
26012601
assert spec_map[field_two]
26022602

2603-
mep_query = TopMetricsQueryBuilder(
2604-
Dataset.PerformanceMetrics,
2605-
self.params,
2606-
3600 * 24,
2607-
[{"customtag1": "div > text"}, {"customtag2": "red"}],
2608-
query="",
2609-
selected_columns=groupbys,
2610-
timeseries_columns=[field, field_two],
2611-
config=QueryBuilderConfig(
2612-
on_demand_metrics_enabled=False,
2613-
),
2614-
)
2615-
2616-
assert not mep_query._on_demand_metric_spec_map
2603+
with pytest.raises(IncompatibleMetricsQuery):
2604+
TopMetricsQueryBuilder(
2605+
Dataset.PerformanceMetrics,
2606+
self.params,
2607+
3600 * 24,
2608+
[{"customtag1": "div > text"}, {"customtag2": "red"}],
2609+
query="",
2610+
selected_columns=groupbys,
2611+
timeseries_columns=[field, field_two],
2612+
config=QueryBuilderConfig(
2613+
on_demand_metrics_enabled=False,
2614+
),
2615+
)
26172616
result = query.run_query("test_query")
26182617

26192618
assert result["data"]

0 commit comments

Comments
 (0)