scwhittle commented on code in PR #34413: URL: https://github.com/apache/beam/pull/34413#discussion_r2011787084
########## runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/GetWorkTimingInfosTracker.java: ########## @@ -103,12 +104,24 @@ void addTimingInfo(Collection<GetWorkStreamTimingInfo> infos) { }); } - // Record the latency of each chunk between send on dispatcher and arrival on worker. + // Record the latency of each chunk between send on dispatcher or windmill worker and arrival on + // the user worker. + @Nullable Instant forwardedByDispatcherTiming = getWorkStreamTimings.get(Event.GET_WORK_FORWARDED_BY_DISPATCHER); Instant now = Instant.ofEpochMilli(clock.getMillis()); - if (forwardedByDispatcherTiming != null && now.isAfter(forwardedByDispatcherTiming)) { - Duration newDuration = new Duration(forwardedByDispatcherTiming, now); + if (forwardedByDispatcherTiming != null) { + trackTransitTimeToUserWorker(forwardedByDispatcherTiming, now); + } else if (workItemCreationEnd != null) { + trackTransitTimeToUserWorker(workItemCreationEnd, now); Review Comment: can you add a test case for this too? ########## runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/windmill/client/grpc/GetWorkTimingInfosTracker.java: ########## @@ -103,12 +104,24 @@ void addTimingInfo(Collection<GetWorkStreamTimingInfo> infos) { }); } - // Record the latency of each chunk between send on dispatcher and arrival on worker. + // Record the latency of each chunk between send on dispatcher or windmill worker and arrival on + // the user worker. + @Nullable Instant forwardedByDispatcherTiming = getWorkStreamTimings.get(Event.GET_WORK_FORWARDED_BY_DISPATCHER); Instant now = Instant.ofEpochMilli(clock.getMillis()); - if (forwardedByDispatcherTiming != null && now.isAfter(forwardedByDispatcherTiming)) { - Duration newDuration = new Duration(forwardedByDispatcherTiming, now); + if (forwardedByDispatcherTiming != null) { + trackTransitTimeToUserWorker(forwardedByDispatcherTiming, now); + } else if (workItemCreationEnd != null) { + trackTransitTimeToUserWorker(workItemCreationEnd, now); + } + + workItemLastChunkReceivedByWorkerTime = now; + } + + private void trackTransitTimeToUserWorker(@Nullable Instant sourceSendTiming, Instant now) { Review Comment: could remove the nullable and null check here, it's done at call-sites above -- 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: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org