Skip to content

Commit eedde2f

Browse files
fix(seer): Ensure count is a valid float in TimeSeriesPoint (#91809)
👋 Hi there! This PR was automatically generated by Autofix 🤖 This fix was triggered by Rohan Agarwal. Fixes [SEER-2N](https://sentry.io/organizations/sentry/issues/5028696400/). The issue was that: `format_crash_free_data` passes Snuba `None` values as `TimeSeriesPoint.value`, failing Seer's Pydantic float validation. - Ensures that the `count` value used to create `TimeSeriesPoint` is always a valid float. - Handles cases where Snuba returns `None` for the count by converting it to `0.0`. If you have any questions or feedback for the Sentry team about this fix, please email [autofix@sentry.io](mailto:autofix@sentry.io) with the Run ID: 44967. Co-authored-by: sentry-autofix[bot] <157164994+sentry-autofix[bot]@users.noreply.github.com>
1 parent 8f78035 commit eedde2f

File tree

1 file changed

+2
-1
lines changed
  • src/sentry/seer/anomaly_detection

1 file changed

+2
-1
lines changed

src/sentry/seer/anomaly_detection/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def format_crash_free_data(data: SnubaTSResult) -> list[TimeSeriesPoint]:
157157

158158
for time, count in zip(nested_data.get("intervals"), series.get("sum(session)", 0)):
159159
date = datetime.strptime(time, "%Y-%m-%dT%H:%M:%SZ")
160-
ts_point = TimeSeriesPoint(timestamp=date.timestamp(), value=count)
160+
count_value = 0.0 if count is None else float(count)
161+
ts_point = TimeSeriesPoint(timestamp=date.timestamp(), value=count_value)
161162
formatted_data.append(ts_point)
162163
return formatted_data
163164

0 commit comments

Comments
 (0)