From e85763065cac63ddb0bec4c96a7d2b802eab8e13 Mon Sep 17 00:00:00 2001 From: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com> Date: Thu, 8 Dec 2022 15:20:27 -0600 Subject: [PATCH] Prometheus: Exemplar optimization (#60055) replace inefficient forEach --- .../app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx b/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx index 91d3647cae8..8f15fae1e88 100644 --- a/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx @@ -181,7 +181,7 @@ const showExemplarMarker = ( if (visibleSeries.labels.length === visibleSeries.totalSeriesCount) { showMarker = true; } else { - visibleSeries.labels.forEach((visibleLabel) => { + visibleSeries.labels.some((visibleLabel) => { // Get the label names const labelKeys = Object.keys(visibleLabel.labels); @@ -204,6 +204,7 @@ const showExemplarMarker = ( }); } } + return showMarker; }); } return showMarker;