vitest-dev / vitest-dev/vitest

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

Open
#9,296 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feat: browser feat: open telemetry p2-nice-to-have
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the discussion in PR #9180 and trace how Vitest browser mode handles user-defined spans across promises, timers, and events. Compare browser context-tracking options such as zone.js or context polyfills, then determine whether helpers or documentation are needed. Done means user-land tracing has a documented, reliable context-handling path or clearly stated limitations and workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
observability, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.