Hide Dashboard metric percentages when a state count is capped#67664
Hide Dashboard metric percentages when a state count is capped#67664wilmerdooley wants to merge 1 commit into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
Quick note on the CI status: the only failing check is the Firefox UI e2e job, and the failure is in tests/e2e/specs/dag-calendar-tab.spec.ts (a tooltip visibility timeout on the Dag Calendar tab). That spec is unrelated to this change, which only affects the Dashboard metric percentage rendering. The same spec passed on the Chromium and WebKit e2e runs, so this looks like Firefox-specific flakiness rather than a regression from this PR. Happy to rebase onto latest main to retrigger CI if that would be helpful. |
bbovenzi
left a comment
There was a problem hiding this comment.
lgtm, let's just fix the variable name
de6e476 to
4280afe
Compare
pierrejeambrun
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Can you add screenshot too please.
| capped={taskInstanceStates[state] >= stateCountLimit} | ||
| endDate={endDate} | ||
| isCapped={isCapped} |
There was a problem hiding this comment.
Why do we have 'capped' and 'isCapped' seems duplicated. Same above.
There was a problem hiding this comment.
This one started out as totalCapped, and I changed it to isCapped from @bbovenzi's earlier suggestion (#67664 (comment)). Happy to switch it back to totalCapped, which keeps it visibly distinct from the per state capped and matches the wording in the description.
They are two different values: capped is per state (this state's own count is at the limit, which drives the N+ badge and the full width bar), while the group flag is true when any state is at the limit, so the summed total is unreliable and the percentages are hidden for the whole group.
Let me know which name you both prefer and I will update.
There was a problem hiding this comment.
Oh I see. This is my misunderstanding.
How about isTotalTruncated?
There was a problem hiding this comment.
Rename to something that convey the information that this is a group/global capped.
const hidePercent = capped || isCapped; // capped || isCapped === isCapped
Remove the capped. (if state is capped, then isCapped is True, the group is capped)
There was a problem hiding this comment.
Done. Renamed the group-level flag to isTotalTruncated (the name @bbovenzi suggested) across MetricSection, TaskInstanceMetrics, and DagRunMetrics, and simplified the suppression to const hidePercent = isTotalTruncated, dropping the redundant capped || since a capped state already implies the group total is truncated. The per-state capped prop is unchanged.
Signed-off-by: wilmerdooley <wilmerdooley1@gmail.com>
4280afe to
24d61a9
Compare



What
The Dashboard "Historical Metrics" percentages are computed in the frontend as count / total, where total is the sum of the per-state counts. The
/ui/dashboard/historical_metrics_dataendpoint caps each state count atSTATE_COUNT_CAP(1000) for performance, so when any state exceeds the cap the summed total is only a lower bound and every per-state percentage is wrong. Example from the issue: success has 2500 runs but the API returns 1000, so failure (7) shows 7/1007 instead of 7/2507.Fix
This takes option 2 from the issue: hide the percentages for a metric group when any of its states is capped, rather than display a wrong number.
MetricSectionalready hid the percentage for a state that is itself capped; this adds a group-leveltotalCappedflag (true when any state is at or above the limit) so the percentage is hidden for all states in the group when the total is unreliable. The per-state "N+" label and the API cap stay as they are.I kept the cap and fixed this in the frontend rather than returning real counts (option 1), because the cap on this endpoint is a deliberate performance bound that has been optimized for large installations (e.g. #62152, #63166); returning unbounded counts would reintroduce that cost.
closes: #67336
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code