diff --git a/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs b/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs index ba90245a5..8b6a358c9 100644 --- a/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs +++ b/apps/api/libs/handlers/src/metrics/get_metric_data_handler.rs @@ -204,9 +204,10 @@ pub async fn get_metric_data_handler( let has_more_records = query_result.data.len() > 5000; // Truncate to 5000 records if we got more - let data = if has_more_records { - query_result.data.into_iter().take(5000).collect() - } else { + let mut data = query_result.data; + if has_more_records { + data.truncate(5000); + } query_result.data };