From 5cf7648b9ac74a3ce70481ae2ce9d924f3e7cd27 Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Mon, 24 Jul 2023 16:19:25 -0400 Subject: [PATCH] fix(functions): Ensure functions timeseries is non empty (#53462) It's possible that the timeseries is an empty array which will error when we try to use the first 20% as historical data. Make sure to handle this. Fixes SENTRY-1402 --- src/sentry/api/endpoints/organization_profiling_functions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sentry/api/endpoints/organization_profiling_functions.py b/src/sentry/api/endpoints/organization_profiling_functions.py index 752aedb2142558..9447eef1269124 100644 --- a/src/sentry/api/endpoints/organization_profiling_functions.py +++ b/src/sentry/api/endpoints/organization_profiling_functions.py @@ -178,6 +178,7 @@ def get_trends_data(stats_data): "request_end": v[data["function"]]["end"], } for k, v in stats_data.items() + if v[data["function"]]["data"] }, "sort": data["trend"].as_sort(), "trendFunction": data["function"],