PG1204 commented on code in PR #5834: URL: https://github.com/apache/texera/pull/5834#discussion_r3502228881
########## frontend/src/app/workspace/service/workflow-status/performance-metrics.ts: ########## @@ -0,0 +1,69 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { OperatorStatistics } from "../../types/execute-workflow.interface"; + +/** + * Derived per-operator performance metrics. + * + * This is the ground-truth model captured by {@link WorkflowStatusService}. It is + * a flat, defensively-defaulted projection of the raw {@link OperatorStatistics} + * the backend streams over the websocket — every field is a finite, non-negative + * number, so downstream consumers never have to re-validate. + */ +export interface OperatorPerformanceMetrics + extends Readonly<{ + operatorId: string; + dataProcessingTimeNs: number; + controlProcessingTimeNs: number; + idleTimeNs: number; + inputRows: number; + outputRows: number; + inputSize: number; + outputSize: number; + numWorkers: number; + }> {} + +/** + * Coerce an untrusted numeric field (it arrives over the websocket) into a + * finite, non-negative number. Anything missing, non-numeric, NaN, infinite, or + * negative collapses to 0 so no NaN/Infinity can leak into downstream consumers. + */ Review Comment: fair question but no, the backend doesn't send malformed data (typed Long/Int -> JSON, so no NaN/Infinity, and counts/times are non-negative). The only real case is missing optional fields, which come from the frontend's own partial objects (e.g. resetStatus) and the optional typing, not from the backend. So I've dropped the NaN/Infinity/negative coercion and kept simple nullish defaults (?? 0, and ?? 1 for the worker count). If the historical-stats restore path needs validation later, I'll add it at that boundary. addressed in https://github.com/apache/texera/commit/4356278b8e7557d9134c692423c5f32efd666968 -- 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]
