Skip to content

refactor(sandbox): migrate SDK setup to official startBrowserSdk#346

Merged
joaquin-diaz merged 7 commits into
open-telemetry:mainfrom
mquentin:mquentin/migrate_sandbox_start_browser_sdk
Jul 16, 2026
Merged

refactor(sandbox): migrate SDK setup to official startBrowserSdk#346
joaquin-diaz merged 7 commits into
open-telemetry:mainfrom
mquentin:mquentin/migrate_sandbox_start_browser_sdk

Conversation

@mquentin

@mquentin mquentin commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

Replace the hand-wired WebTracerProvider/LoggerProvider setup in the
sandbox with the official @opentelemetry/browser-sdk startBrowserSdk
entry point, keeping the instrumented behavior identical:

  • session processors run first, then console + optional UI-mirror
    exporters, via traces.processors / logs.processors
  • batching OTLP export preserved through exportConfig +
    batchProcessorConfig (maxExportBatchSize 10, scheduledDelayMillis 1000)
  • StackContextManager + W3C trace-context/baggage propagators passed
    explicitly to reproduce WebTracerProvider.register() defaults, so
    fetch/XHR context propagation and header injection keep working
  • registerInstrumentations block unchanged

QA

npm run dev is still showcasing that the SDK is still loaded properly and reporting the starting the same instrumentations.

github.io deployment of the sandbox under https://open-telemetry.github.io/opentelemetry-browser/ will be the followup to QA the change

Screenshot 2026-07-10 at 15 03 05

Decorative code snippet has also been updated but with the goal of not being exhaustive.

Screenshot 2026-07-10 at 15 25 16

Follow up PR

I plan to work on a small Mock Service Worker like https://www.npmjs.com/package/msw to showcase how payloads are sent to intake. I will however discuss about it with the SIG to see if there is traction about this.

@mquentin
mquentin requested a review from a team as a code owner July 10, 2026 12:50
Comment thread sandbox/package.json Outdated
Comment thread sandbox/src/otel.ts Outdated
// Batch processor settings shared by the traces and logs exporters. Passing
// this alongside `exportConfig` makes the SDK append a batching OTLP exporter
// after our custom processors below.
const BATCH_PROCESSOR_CONFIG = {

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.

Do we have a type for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed there is TracesConfig['batchProcessorConfig']

Comment thread sandbox/src/otel.ts Outdated
Comment thread sandbox/src/otel.ts
Comment thread sandbox/src/otel.ts Outdated
@mquentin
mquentin requested a review from overbalance July 15, 2026 13:42
@joaquin-diaz
joaquin-diaz merged commit 97a2c79 into open-telemetry:main Jul 16, 2026
9 checks passed
@mquentin
mquentin deleted the mquentin/migrate_sandbox_start_browser_sdk branch July 16, 2026 12:26
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.

3 participants