Skip to content

feat: implement browser APIs that the published types declare - #7140

Merged
overbalance merged 4 commits into
open-telemetry:mainfrom
embrace-io:overbalance/platform-surface-parity
Oct 8, 2026
Merged

overbalance merged 4 commits into
open-telemetry:mainfrom
embrace-io:overbalance/platform-surface-parity

Conversation

@overbalance

@overbalance overbalance commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Each platform package publishes one set of type declarations, generated from the Node.js barrel. Browser consumers compile against those types, which disagreed with the browser implementation in two places:

  • instrumentation: the types declare isEnabled(), but the browser InstrumentationBase did not implement it, so a call threw a TypeError. The browser base now tracks enable() and disable() calls. FetchInstrumentation and XMLHttpRequestInstrumentation override it with their _isEnabled flag, which stays false when patching throws.
  • sdk-trace, sdk-logs: disableAutoFlushOnDocumentHide existed only on Batch*ProcessorBrowserOptions, which the published constructor type does not accept, so an object literal that set it failed to compile. The option moves to BatchSpanProcessorOptions and BatchLogRecordProcessorOptions, and the *BrowserOptions types become deprecated aliases.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • npm run compile
  • npm test for instrumentation, fetch, xhr, sdk-trace and sdk-logs.
  • npm run test:browser: the new isEnabled() browser tests pass.

overbalance added a commit to embrace-io/opentelemetry-js that referenced this pull request Sep 29, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-09 00:20 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.95238% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.02%. Comparing base (47f3858) to head (82ca3be).

Files with missing lines Patch % Lines
...s/opentelemetry-instrumentation-fetch/src/fetch.ts 0.00% 2 Missing ⚠️
...emetry-instrumentation-xml-http-request/src/xhr.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7140      +/-   ##
==========================================
- Coverage   95.05%   95.02%   -0.03%     
==========================================
  Files         382      382              
  Lines       13517    13532      +15     
  Branches     3126     3126              
==========================================
+ Hits        12848    12859      +11     
- Misses        669      673       +4     
Files with missing lines Coverage Δ
...umentation/src/platform/browser/instrumentation.ts 100.00% <100.00%> (ø)
...platform/browser/export/BatchLogRecordProcessor.ts 100.00% <100.00%> (ø)
.../src/platform/browser/export/BatchSpanProcessor.ts 100.00% <100.00%> (ø)
...s/opentelemetry-instrumentation-fetch/src/fetch.ts 82.40% <0.00%> (-0.78%) ⬇️
...emetry-instrumentation-xml-http-request/src/xhr.ts 92.43% <0.00%> (-0.79%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

overbalance added a commit to embrace-io/opentelemetry-js that referenced this pull request Oct 5, 2026
@overbalance
overbalance force-pushed the overbalance/platform-surface-parity branch from d903082 to cbdf165 Compare October 5, 2026 20:45
@overbalance overbalance added this to the SDK 3.0 milestone Oct 7, 2026
@overbalance overbalance changed the title fix!: align the browser platform barrels with the published types fix: implement browser APIs that the published types declare Oct 7, 2026
@overbalance
overbalance force-pushed the overbalance/platform-surface-parity branch from e72d93c to ad108fe Compare October 7, 2026 18:09
@overbalance overbalance changed the title fix: implement browser APIs that the published types declare feat: implement browser APIs that the published types declare Oct 7, 2026
@overbalance
overbalance force-pushed the overbalance/platform-surface-parity branch from ad108fe to ca4cdc1 Compare October 7, 2026 18:11
@overbalance
overbalance marked this pull request as ready for review October 7, 2026 19:05
@overbalance
overbalance requested review from a team as code owners October 7, 2026 19:05

@pichlermarc pichlermarc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good, thank you!

@overbalance
overbalance enabled auto-merge October 8, 2026 23:45
@overbalance
overbalance added this pull request to the merge queue Oct 8, 2026
Merged via the queue into open-telemetry:main with commit a38a5f7 Oct 8, 2026
25 checks passed
@overbalance
overbalance deleted the overbalance/platform-surface-parity branch October 8, 2026 23:54
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