Skip to content

Add utask waiting time metric - #5545

Merged
brun0-matheus merged 4 commits into
masterfrom
bruno.add-utask-waiting-time-metric
Oct 28, 2026
Merged

brun0-matheus merged 4 commits into
masterfrom
bruno.add-utask-waiting-time-metric

Conversation

@brun0-matheus

@brun0-matheus brun0-matheus commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Bug: b/573118558

Overview

Creates a new metric called UTASK_SUBTASK_WAIT_DURATION_SECS, which keeps track of time spent between one subtask finishing and the next one starting. This PR only implements it for the main subtask (so it tracks time between preprocess and main).

Changes

  • Add the metric UTASK_SUBTASK_WAIT_DURATION_SECS and instrument the code to emit it in the main subtask.
  • Add preprocess_end_time to uworker_msg.Input protobuf.
  • Split serialize_and_upload_uworker_input in two parts, moving all URLs generation/signing to prepare_uworker_io_urls in order to precisely track the time preprocess finishes.
  • Change unit tests related to serialize_and_upload_uworker_input: now they actually test the underlying behavior of the function instead of how its code is written.
  • Add the time_ns method to helpers.MockTime.

Tests

Add additional checks in UworkerMainTest and TworkerPreprocessTest to check if preprocess_end_time is set correctly and if UTASK_SUBTASK_WAIT_DURATION_SECS is emitted.

I deployed in the dev environment and it's working as intended. Evidence in the bug comments.

Define the metric in `monitoring_metrics.py` and instrument the code to
emmit it.
Improve unittests that used serialize_and_upload_uworker_input, now they
actually test the behaviour and not how the code is written.

Add some tests to check for preprocess_end_time being set and for the
metric emmission.
@brun0-matheus brun0-matheus self-assigned this Oct 19, 2026
@brun0-matheus
brun0-matheus requested a review from a team as a code owner October 19, 2026 12:22
@brun0-matheus
brun0-matheus merged commit 35d6e34 into master Oct 28, 2026
15 checks passed
@brun0-matheus
brun0-matheus deleted the bruno.add-utask-waiting-time-metric branch October 28, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants