Skip to content

Add a browser events conformance scenario - #258

Open
adityareddy-dev wants to merge 3 commits into
open-telemetry:mainfrom
adityareddy-dev:browser-events-poc
Open

adityareddy-dev wants to merge 3 commits into
open-telemetry:mainfrom
adityareddy-dev:browser-events-poc

Conversation

@adityareddy-dev

@adityareddy-dev adityareddy-dev commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

This is a proof of concept. Jay suggested trying browser instrumentation here while I was researching it for the ecosystem explorer (open-telemetry/opentelemetry-ecosystem-explorer#1187). It adds a browser domain with three scenarios for @opentelemetry/browser-instrumentation 0.8.1 (errors, console, web-vitals). Each one opens a page in the Chrome already on the machine, and the page's OTLP exports go through its own origin to the runner's HTTP bridge, since the bridge doesn't answer CORS.

It covers events only and sits beside #162 and #163, which cover the older fetch and XHR span packages with their own browser runner. The earlier Windows and fork Ubuntu runs produced the committed data.json. On October 15 I reran all three scenarios on macOS with Weaver 0.26.1 and registry v1.44.0, and the coverage matched again. Each scenario reports warnings, including the missing browser.console event and method attribute in that registry. The web-vitals scenario waits for one event, it does not establish coverage of every web vital.

Validation on October 15: npm ci, the six launcher unit tests, browser workspace formatting, and all three otel-conformance ... --report-only scenarios passed. This remains a proof of concept with an unpinned browser and the HTTP runner registry.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 02:33
@adityareddy-dev
adityareddy-dev requested a review from a team as a code owner October 2, 2026 02:34
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-10-17 01:49 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The launcher, scenarios, generated coverage, tests, documentation, and CI integration are consistent and complete.

Review effort: Balanced
Findings: None

What changed in this PR

Adds browser event conformance coverage using headless Chrome and an OTLP/HTTP relay.

Changes:

  • Adds reusable browser launching, event synchronization, and OTLP relay support.
  • Adds errors, console, and web-vitals scenarios.
  • Integrates browser scenarios into CI and documentation.
File Description
README.md Lists the browser domain.
.github/​workflows/​runner.yml Builds and tests browser scenarios.
tools/​js/​README.md Documents browser scenario support.
tools/​js/​browser-launcher/​index.js Implements browser execution and OTLP relay.
tools/​js/​browser-launcher/​page.js Configures browser log collection.
tools/​js/​browser-launcher/​package.json Declares launcher dependencies.
tools/​js/​browser-launcher/​test/​index.test.js Tests page serving and relaying.
scenarios/​browser/​README.md Documents browser coverage.
scenarios/​browser/​js/​README.md Documents JavaScript scenarios.
scenarios/​browser/​js/​package.json Defines the browser workspace.
scenarios/​browser/​js/​package-lock.json Locks browser dependencies.
scenarios/​browser/​js/​.npmrc Configures local package installation.
scenarios/​browser/​js/​.prettierignore Excludes generated artifacts.
scenarios/​browser/​js/​chromium/​scenarios/​package.json Defines workload package metadata.
scenarios/​browser/​js/​chromium/​scenarios/​errors.js Generates unhandled errors.
scenarios/​browser/​js/​chromium/​scenarios/​console.js Generates console events.
scenarios/​browser/​js/​chromium/​scenarios/​web-vitals.js Generates page content for web vitals.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​package.json Declares instrumentation dependencies.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​run.js Selects and launches scenario pages.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​pages/​errors.js Configures errors instrumentation.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​pages/​console.js Configures console instrumentation.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​pages/​web-vitals.js Configures web-vitals instrumentation.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​conformance.yaml Declares conformance scenarios.
scenarios/​browser/​js/​chromium/​opentelemetry-browser-instrumentation/​data.json Records generated coverage.
Files not reviewed (1)
  • scenarios/browser/js/package-lock.json: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@adityareddy-dev

Copy link
Copy Markdown
Member Author

A few things I wasn't sure about and would change if you prefer.

The scenarios declare runner: http-conformance. No runner package covers browser conventions yet, and that one pins the upstream registry at v1.44.0, which is where exception and browser.web_vital are defined. Its span classifier only acts on spans with http.request.method, and these scenarios emit no spans. The report files the target under browser cause it goes by path. If you'd rather have a small browser runner package I can add one.

The path is scenarios/browser/js/chromium/opentelemetry-browser-instrumentation, with chromium in the slot where the HTTP scenarios put the instrumented library. Not sure that's the right word for it.

The browser isn't pinned. playwright-core drives the Chrome that's already installed, on CI the one in the ubuntu-latest image, so nothing is downloaded. Installing a pinned Chromium in the workflow is the alternative.

#162 adds tools/js/browser-runner and this adds tools/js/browser-launcher. They overlap a lot. Both bundle a page with esbuild, serve it from 127.0.0.1 and take its exports on the same origin. 162's sends traces to the collector over gRPC itself and proxies every other path to the HTTP mock server, mine posts /v1/* on to the runner's OTLP/HTTP bridge. One launcher is probably the right end state. We also both add a line to tools/js/README.md at the same spot, so whichever lands second has a one-line conflict.

What it reports right now:

==== instrumented: chromium, instrumentation: @opentelemetry/browser-instrumentation, package: opentelemetry-browser-instrumentation
! scenario: errors, status: WARN
! Violations:
  - [instrumentation_scope_schema_url_missing] Instrumentation scope '@opentelemetry/browser-instrumentation/errors' does not have schema_url
! scenario: console, status: WARN
! Violations:
  - [instrumentation_scope_schema_url_missing] Instrumentation scope '@opentelemetry/browser-instrumentation/console' does not have schema_url
  - [missing_attribute] Attribute 'browser.console.method' does not exist in the registry
  - [missing_event] Event 'browser.console' does not exist in the registry
! scenario: web_vitals, status: WARN
! Violations:
  - [instrumentation_scope_schema_url_missing] Instrumentation scope '@opentelemetry/browser-instrumentation/web-vitals' does not have schema_url

browser.console isn't in the registry at v1.44.0, so its findings are recorded and its attributes aren't.

The workflows here are waiting on approval to run. The same commit ran green in my fork, adityareddy-dev#1

@adityareddy-dev

Copy link
Copy Markdown
Member Author

Nudge on this one, it adds the browser events scenarios and every upstream check passed on ffdf6a1eb on 2026-10-03.
It's ready for a look.

@adityareddy-dev

Copy link
Copy Markdown
Member Author

@jaydeluca could you take a look at the browser events scenarios? Checks and CLA passed. The main question is whether to share the launcher with the Fetch scenarios.

This branch has not been deployed

No deployments
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.

2 participants