diff --git a/web/ui/mantine-ui/src/pages/service-discovery/ServiceDiscoveryPoolsList.tsx b/web/ui/mantine-ui/src/pages/service-discovery/ServiceDiscoveryPoolsList.tsx index 0501fd6788..8bfbebf698 100644 --- a/web/ui/mantine-ui/src/pages/service-discovery/ServiceDiscoveryPoolsList.tsx +++ b/web/ui/mantine-ui/src/pages/service-discovery/ServiceDiscoveryPoolsList.tsx @@ -39,6 +39,9 @@ type ScrapePool = { targets: TargetLabels[]; active: number; total: number; + // Can be different from "total" if the "keep_dropped_targets" setting is used + // to limit the number of dropped targets for which the server keeps details. + serverTotal: number; }; type ScrapePools = { @@ -62,11 +65,11 @@ const droppedTargetKVSearch = new KVSearch({ const buildPoolsData = ( poolNames: string[], - activeTargets: Target[], - droppedTargets: DroppedTarget[], + targetsData: TargetsResult, search: string, stateFilter: (string | null)[] ): ScrapePools => { + const { activeTargets, droppedTargets, droppedTargetCounts } = targetsData; const pools: ScrapePools = {}; for (const pn of poolNames) { @@ -74,6 +77,7 @@ const buildPoolsData = ( targets: [], active: 0, total: 0, + serverTotal: droppedTargetCounts[pn] || 0, }; } @@ -88,6 +92,7 @@ const buildPoolsData = ( pool.active++; pool.total++; + pool.serverTotal++; } const filteredActiveTargets = @@ -160,9 +165,7 @@ const ScrapePoolList: FC = ({ // Based on the selected pool (if any), load the list of targets. const { - data: { - data: { activeTargets, droppedTargets }, - }, + data: { data: targetsData }, } = useSuspenseAPIQuery({ path: `/targets`, params: { @@ -180,19 +183,11 @@ const ScrapePoolList: FC = ({ () => buildPoolsData( selectedPool ? [selectedPool] : poolNames, - activeTargets, - droppedTargets, + targetsData, debouncedSearch, stateFilter ), - [ - selectedPool, - poolNames, - activeTargets, - droppedTargets, - debouncedSearch, - stateFilter, - ] + [selectedPool, poolNames, targetsData, debouncedSearch, stateFilter] ); const allPoolNames = Object.keys(allPools); const shownPoolNames = showEmptyPools @@ -250,22 +245,23 @@ const ScrapePoolList: FC = ({ {poolName} - {pool.active} / {pool.total} + {pool.active} / {pool.serverTotal} = ({ + {pool.total !== pool.serverTotal && ( + } + color="yellow" + mb="sm" + > + {pool.serverTotal - pool.total} further dropped targets are + not shown here because the server only kept details on a + maximum of {pool.total - pool.active} dropped targets ( + keep_dropped_targets configuration setting). + + )} {pool.total === 0 ? ( }> No targets in this scrape pool.