Skip to content

Commit 654b7c9

Browse files
authored
fix(anomaly-detection): Force using spans_eap and normal mode (#90536)
1 parent b0b3293 commit 654b7c9

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/sentry/search/eap/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
}
9393

9494
# https://github.com/getsentry/snuba/blob/master/snuba/web/rpc/v1/endpoint_time_series.py
95-
# The RPC limits us to 2016 points per timeseries
96-
MAX_ROLLUP_POINTS = 2016
95+
# The RPC limits us to 2688 points per timeseries
96+
MAX_ROLLUP_POINTS = 2688
9797
# Copied from snuba, a number of total seconds
9898
VALID_GRANULARITIES = frozenset(
9999
{

src/sentry/seer/anomaly_detection/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ def get_dataset_from_label(dataset_label: str):
219219
dataset = get_dataset(dataset_label)
220220
if dataset is None:
221221
raise ParseError(detail=f"dataset must be one of: {', '.join(DATASET_OPTIONS.keys())}")
222+
223+
if dataset == spans_eap:
224+
return spans_rpc
222225
return dataset
223226

224227

@@ -290,7 +293,7 @@ def fetch_historical_data(
290293
auto_fields=False,
291294
use_aggregate_conditions=False,
292295
),
293-
sampling_mode="BEST_EFFORT",
296+
sampling_mode="NORMAL",
294297
)
295298
return results
296299
else:

tests/sentry/seer/anomaly_detection/test_store_data.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,19 @@ def test_anomaly_detection_fetch_historical_data_eap_spans(self):
171171
)
172172

173173
result = fetch_historical_data(
174-
self.organization, snuba_query, ["count()"], self.project
174+
self.organization, snuba_query, ["count(span.duration)"], self.project
175175
)
176176
assert result
177-
assert {"time": int(expected_ts_1), "count()": 1} in result.data.get("data")
178-
assert {"time": int(expected_ts_2), "count()": 1} in result.data.get("data")
177+
assert {"time": int(expected_ts_1), "count(span.duration)": 1} in result.data.get(
178+
"data"
179+
)
180+
assert {"time": int(expected_ts_2), "count(span.duration)": 1} in result.data.get(
181+
"data"
182+
)
179183

180184
formatted_result = format_historical_data(
181185
data=result,
182-
query_columns=["count()"],
186+
query_columns=["count(span.duration)"],
183187
dataset=spans_rpc,
184188
organization=self.organization,
185189
)

0 commit comments

Comments
 (0)