Skip to content

fix(trace): align library and runner clocks by wall time#41329

Open
SebTardif wants to merge 1 commit into
microsoft:mainfrom
SebTardif:fix-40068
Open

fix(trace): align library and runner clocks by wall time#41329
SebTardif wants to merge 1 commit into
microsoft:mainfrom
SebTardif:fix-40068

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Summary

  • Align each library trace context with the test runner using the wallTime/monotonicTime pair recorded at chunk start
  • Fall back to stepId matching for older traces without wall times
  • Add a unit test simulating unrelated monotonic clocks across processes

Fixes #40068

Problem

When APIRequestContext runs in a different process (e.g. remote run-server in Docker), its monotonic clock is unrelated to the test runner's. The trace merger only aligned clocks via a shared stepId, which does not exist for API fixture setup in beforeAll. The timeline then spanned the gap between process uptimes (often hours).

Prior art

Same approach as #40089 (approved by yury-s, not merged). Clock alignment logic introduced in #33935 (2024-05-09).

Verification

Red step (without fix): model.endTime = 5001000 (~83 minutes on timeline)
Green step (with fix): model.endTime = 6100 (1.1s span)

npm run ctest tests/library/trace-model.spec.ts

When APIRequestContext runs in a different process (e.g. remote
run-server in Docker), its monotonic clock is unrelated to the test
runner's. Align each library context by the wallTime/monotonicTime pair
recorded at chunk start, falling back to stepId matching for older
traces.

Fixes microsoft#40068
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.

[Bug]: Trace timeline Showing Hours when using APIRequestContext in fixture

1 participant