Skip to content

Improve openTelemetry context propagation and user-land tracing in Vitest browser mode #9296

@hi-ogawa

Description

@hi-ogawa

Clear and concise description of the problem

Context

In browser mode, Vitest cannot automatically propagate openTelemetry async context due to lack of async_hooks. User-defined spans often lose parent context across async operations (promises, timers, events), leading to incomplete or flat tracing. Internal spans are manually linked, but user/test code loses context in deeply async code paths.

Suggested solution

Explore robust async context tracking for browsers (e.g. zone.js or context polyfills), expose helpers in Vitest to allow manual context handling for user code, and document current limitations and any recommended workarounds for reliable tracing.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions