Skip to content

Commit 79ece7d

Browse files
committed
feat(webapp): recolor the concurrency line warning at the limit
The Concurrency chart's tooltip promised 'yellow when at the limit' but nothing was recolored. Add an at-or-above warningOverlay variant (running >= limit) and wire it up, so the line turns warning where the queue is saturated.
1 parent 7049763 commit 79ece7d

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

apps/webapp/app/components/primitives/charts/ChartLine.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export type ChartLineRendererProps = {
134134
*/
135135
warningOverlay?:
136136
| { threshold: number; color?: string }
137-
| { series: string; below: string; color?: string };
137+
| { series: string; below: string; color?: string }
138+
| { series: string; atOrAbove: string; color?: string };
138139
/** Width injected by ResponsiveContainer */
139140
width?: number;
140141
/** Height injected by ResponsiveContainer */
@@ -320,6 +321,11 @@ export function ChartLineRenderer({
320321
const b = Number(r[warningOverlay.below]);
321322
return Number.isFinite(b) && v < b;
322323
}
324+
if ("atOrAbove" in warningOverlay!) {
325+
// "At the limit": the series reaches or exceeds its companion (e.g. running >= limit).
326+
const b = Number(r[warningOverlay.atOrAbove]);
327+
return Number.isFinite(b) && b > 0 && v >= b;
328+
}
323329
return v > warningOverlay!.threshold;
324330
};
325331
const inOverlay = isOver(data[i - 1]) || isOver(row) || isOver(data[i + 1]);

apps/webapp/app/components/queues/QueueMetricCards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type QueueMetricChartProps = {
9494
fillGaps?: boolean;
9595
defaultPeriod?: string;
9696
/** Recolor a series warning where it drops below another (e.g. started below enqueued). */
97-
warningOverlay?: { series: string; below: string };
97+
warningOverlay?: { series: string; below: string } | { series: string; atOrAbove: string };
9898
/**
9999
* Series whose leading zeros should be back-filled with the first real value. Gauge series that
100100
* are only emitted while the queue is active (e.g. the concurrency `limit`) read as 0 before the

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues_.$queueParam/route.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ function OverviewCharts({
367367
{ key: "limit", label: "Limit", color: COLORS.limit },
368368
{ key: "running", label: "Running", color: COLORS.running },
369369
]}
370+
// Recolour Running warning where it reaches the limit (saturated), matching the tooltip.
371+
warningOverlay={{ series: "running", atOrAbove: "limit" }}
370372
// The limit is a config value emitted only while the queue is active; back-fill its
371373
// leading zeros so the reference line doesn't start with a false 0→limit step.
372374
carryBackfill={["limit"]}

0 commit comments

Comments
 (0)