unbridled-41 opened a new pull request, #4570:
URL: https://github.com/apache/rocketmq-dashboard/pull/4570
Fixes #4569.
## Problem / Evidence
The Metrics Explorer chart assigns polyline colors with two different slot
formulas: a series mixing scalar and native-histogram samples is split into two
lines at slots `index*2 + {0,1}`, while a pure series takes slot `index` — both
modulo the 6-entry palette (`web/src/components/MetricsExplorer.tsx:133-135` on
master `d50ffecc`), with no de-duplication. A **mixed series followed by any
further series** therefore deterministically collides: series[0] mixed → scalar
slot 0, histogram slot 1; series[1] pure → slot 1, identical to series[0]'s
histogram line. Two polylines in one chart draw with the same stroke and their
legend swatches are indistinguishable.
Red (this PR's new regression, master + test): series[0] carrying both a
scalar value and a native histogram plus series[1] scalar-only → 3 polylines
are drawn but only **2 distinct strokes** (`Expected 3, Received 2`; `#52c41a`
appears twice).
## Root cause / Fix
Keep the existing slot arithmetic (it preserves the current colors for the
common cases) and, after the lines are filtered to those that actually have
samples, reassign any duplicate stroke to the first free palette color in
order. Series order and labels are untouched; only the duplicate's color
changes.
- `web/src/components/MetricsExplorer.tsx`: +13/−1 (duplicate-stroke
reassignment pass).
- `web/src/components/__tests__/MetricsExplorer.test.tsx`: +34/−0 (`gives a
mixed series and the following pure series distinct colors`).
## Priority & scoring
PRIORITY 71 = impact 27 (a chart legend that cannot be matched to its lines
is the core reading path of the explorer; deterministic for any PromQL
returning a native-histogram series next to a scalar series — the exact case
#4358's split targets) + scope 11 (single component, palette-size bounded) +
reproducibility 18 (two-series fixture reproduces the collision
deterministically) + maintenance value 15 (restores the one-to-one color/line
contract the split feature relies on). FIX_CONFIDENCE 97: pure
presentation-branch change, one deterministic regression, no data or API
changes.
## Tests
- `npx vitest run src/components/__tests__/MetricsExplorer.test.tsx`
- Red (master + new test): `gives a mixed series and the following pure
series distinct colors` failed — `Expected 3, Received 2` distinct strokes.
- Green: **28/28 passed** (all existing tests unchanged and passing — the
reassignment only affects colliding colors).
- `npx tsc -b` clean; `npx eslint` on both changed files clean; `npm run
build` ✓ (9.5s).
- Full web suite on this branch: results in the verification comment below.
## Risk
Low. Presentation-only: non-colliding charts keep byte-identical colors;
only a colliding series is re-colored to the first free palette entry. Charts
with more series than palette entries (already `MAX_SERIES`-capped) still wrap
modulo the palette as before — the pass only eliminates collisions while a free
color exists, and the legend already labels split lines explicitly.
Upstream CI note: the repository's CI workflow fails at startup for every
branch and PR (infrastructure-level, also on maintainer branches), so local
verification substitutes for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]