feat(frontend): capture per-operator performance metrics#5834
Conversation
|
/request-review @Yicong-Huang |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5834 +/- ##
============================================
- Coverage 54.39% 53.88% -0.51%
+ Complexity 2859 2722 -137
============================================
Files 1107 1104 -3
Lines 42767 42641 -126
Branches 4599 4591 -8
============================================
- Hits 23263 22978 -285
- Misses 18152 18328 +176
+ Partials 1352 1335 -17
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@Yicong-Huang This PR introduces performance as a cleanly separated concept on WorkflowStatusService. As per your point in #5216 about separating state vs statistics as sub-concepts, I kept that out of this PR to avoid adding unused API, since nothing consumes a standalone state stream yet. Happy to do that separation here or as a follow-up, which would you prefer? |
|
@PG1204 this sounds like a feature? if so please update title and description. |
There was a problem hiding this comment.
Pull request overview
This PR lays the frontend data foundation for a future workflow runtime performance heat-map by typing all per-operator metrics already sent over the websocket and deriving a normalized, overlay-ready performance model in WorkflowStatusService (no UI changes).
Changes:
- Extend
OperatorStatisticswith the missing optional timing and byte-size fields so they deserialize from the existing websocket payload. - Add a framework-free
performance-metrics.tshelper (model + view selector + normalization utilities). - Enhance
WorkflowStatusServiceto publish a derived performance-metrics stream (BehaviorSubject-backed) and accept externally-provided status snapshots; add new Vitest coverage for both the helper and service.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/app/workspace/types/execute-workflow.interface.ts | Adds missing optional per-operator timing/size fields to match websocket payload. |
| frontend/src/app/workspace/service/workflow-status/workflow-status.service.ts | Derives and exposes per-operator performance metrics from status updates; adds external ingestion path. |
| frontend/src/app/workspace/service/workflow-status/workflow-status.service.spec.ts | New unit tests for status forwarding and derived performance metrics behavior. |
| frontend/src/app/workspace/service/workflow-status/performance-metrics.ts | New pure helper for mapping, view-specific raw metrics, and normalization into [0,1]. |
| frontend/src/app/workspace/service/workflow-status/performance-metrics.spec.ts | New unit tests covering mapping, per-view formulas, and normalization edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Yicong-Huang
left a comment
There was a problem hiding this comment.
I think throughput is calculated wrongly.
Automated Reviewer SuggestionsBased on the
|
@Yicong-Huang i feel a separate PR would be better, would appreciate your input as well on this |
yeah let's do it separately. |
What changes were proposed in this PR?
Foundation for the workflow runtime performance heat-map (umbrella #5772).
This PR captures all per-operator execution metrics as ground truth, with no UI change.
The backend streams 11 statistics per operator, but the frontend
OperatorStatisticstype only declared 6, the timing and byte-size fields arrived over the websocket andwere silently dropped. This PR:OperatorStatisticswith the 5 missing optional fields (input/output size, data/control processing time, idle time); they deserialize straight from the existing websocket payload, so no backend or websocket change is needed.performance-metrics.ts: anOperatorPerformanceMetricsmodel, aHeatmapViewenum,toPerformanceMetrics,rawMetricForView(bottleneck-oriented per-view cost), andnormalizeScores(log1p + min-max into[0,1]).WorkflowStatusServicewith a derived,BehaviorSubject-backed performance-metrics stream (getPerformanceMetricsStream/getCurrentPerformanceMetrics) and asetExternalStatusingestion point for later restoring historical stats. The existing status pass-through API is unchanged.All values arriving over the wire are coerced to finite, non-negative numbers, so missing /
NaN/Infinity/ negative inputs cannot leak into the scoring math.Any related issues, documentation, discussions?
Closes #5773. Part of umbrella #5772. Follows RFC discussion #5216.
How was this PR tested?
New Vitest specs, run with:
cd frontend && ng test --watch=false --include "/performance-metrics.spec.ts" --include "/workflow-status.service.spec.ts"
performance-metrics.spec.ts(19 tests): field mapping, missing/zero/NaN/Infinitydefaults, per-view formulas, andnormalizeScoresedge cases (empty, single, all-equal, heavy-tail, unicode ids).workflow-status.service.spec.ts(8 tests, new, the service had none): event forwarding, ignoring other event types, derived-metrics emission,setExternalStatus, reset/clear.Also verified:
tsc --noEmit(strict) clean,eslint ./srcclean, Prettier clean, and the existingWorkflowStatusServiceconsumer specs still pass (67 tests).Was this PR authored or co-authored using generative AI tooling?
This PR was co-authored by Claude Opus 4.7, in compliance with ASF.