[Bug] [UI] Fix NaN display in job detail Overview table when tablePaths does not match metrics keys#10965
[Bug] [UI] Fix NaN display in job detail Overview table when tablePaths does not match metrics keys#1096577amyfly wants to merge 2 commits into
Conversation
… and sinkCell Add unit test to verify no NaN is displayed when tablePaths does not match metrics keys
DanielLeens
left a comment
There was a problem hiding this comment.
Thanks for working on this. I went through the full current diff and traced the actual metric path from the engine backend into the UI table rendering.
What this PR fixes
- User pain: the Job Detail Overview table can render
NaNwhen the table path shown on a vertex does not exactly match the metric map key produced by the backend. - Fix approach: the UI now falls back from exact lookup to suffix matching, so
fakecan match a backend key likeSource[0].fake. - One-line value: this removes the
NaNsymptom for the simple single-vertex case.
Runtime path I checked
Engine metric aggregation
-> BaseService.processMetric(...) [BaseService.java:441-586]
-> for single vertex: key can become "Source[0].table" / "Sink[0].table" [BaseService.java:463-472]
-> for tagged array metrics: key becomes "identifier.table" [BaseService.java:494-523]
UI Overview table
-> detail.tsx sourceCell/sinkCell [detail.tsx:94-128]
-> iterate row.tablePaths
-> find first metric key where key.endsWith(path) [detail.tsx:103-106, 121-124]
-> sum that value into the displayed cell
Review findings
Problem 1: Wrong metric attribution when multiple vertices share the same table path
- Location:
seatunnel-engine/seatunnel-engine-ui/src/views/jobs/detail.tsx:103-106,seatunnel-engine/seatunnel-engine-ui/src/views/jobs/detail.tsx:121-124 - Severity: High
- Raised before by others: No
- Why this is a real bug:
The backend intentionally emits per-vertex metric keys such asSource[0].fakeandSink[0].fakeinstead of the bare table path when there is vertex-level attribution on the same table [BaseService.java:463-472, 494-523]. The new UI code picks the first key whose suffix matchesfake. That works only if there is exactly one matching vertex. As soon as two sources or two sinks share the sametablePathsentry, the first suffix match can belong to the wrong vertex, so the Overview table silently shows another vertex's numbers. - Risk:
This is not just a cosmetic mismatch. On normal multi-source or fan-out jobs, the per-row metrics in Overview become incorrect while still looking valid, which is worse thanNaNbecause it hides the attribution error. - Better fix:
Match on the current vertex identifier as well, not only on the suffix. The UI already hasvertexName, so it can deriveSource[0]/Sink[0]and preferidentifier + "." + path. An even cleaner option would be to expose a backend map keyed by vertex id or vertex identifier directly so the UI does not need to reverse-engineer the key shape.
Problem 2: The new regression test only covers the single-match happy path
- Location:
seatunnel-engine/seatunnel-engine-ui/src/tests/detail.spec.ts:49-111 - Severity: Medium
- Raised before by others: No
- Why this matters:
The new test uses one source and one sink, both onfake, so there is only one possible suffix match for each metric group. That verifies theNaNsymptom is gone, but it does not protect against the real ambiguity introduced byendsWith(path)when multiple vertices share the same table path. - Risk:
The current implementation can regress into wrong attribution without any test failure. - Better fix:
Add a regression case with at least two source vertices or two sink vertices sharing the same table path and assert each row reads its own metric bucket.
Test stability
- Rating: Stable
- Why:
The new frontend test is deterministic, uses mocked service data, and does not depend on timing, ports, or external state.
Merge conclusion
Conclusion: fix required before merge
Blocking items:
- Problem 1
Non-blocking suggestions:
- Problem 2
The current direction is good for the original NaN symptom, but I would not merge it until the per-vertex attribution stays correct on the real multi-vertex path as well.
|
+1 good job |
|
Thanks for taking a look here as well. On my side, the current blocker is still the same one from the latest Daniel review: on the current head Since there is still no new commit after that reviewable head, I am keeping this as a reply-only follow-up rather than starting another full re-review in this batch. Once a code update lands for that attribution path, please ping me again and I will recheck the new head from scratch. |
davidzollo
left a comment
There was a problem hiding this comment.
Good job.
+1 if CI passes
|
Thanks @davidzollo. I saw the approval, but on my side the blocker from the latest Daniel review still stands on the unchanged head |
Purpose of this pull request
Fix #10547
Fix NaN display in the job detail Overview table. The
sourceCellandsinkCellfunctions usetablePathsto look up values in metrics, but thetablePathsformat does not match the metrics keys returned by the backend. For example:tablePathsreturns:["fake"]"Source[0].fake"This mismatch causes
Number(undefined)to be evaluated asNaN. Fixed by usingendsWithto matchtablePathsagainst metrics keys instead of direct lookup.Does this PR introduce any user-facing change?
Yes. The job detail Overview table now correctly displays metrics values (Received Bytes, Write Bytes, Received Count, Write Count, etc.) instead of NaN when


tablePathsdoes not match metrics keys.before fix:
after fix:
How was this patch tested?
seatunnel-engine-ui/src/tests/detail.spec.tsto verify that no NaN is displayed whentablePathsdoes not match metrics keys.Check list
incompatible-changes.mdto describe the incompatibility caused by this PR.