Skip to content

Move frontend telemetry to the EDOT browser SDK 0.4.0 - #4643

Draft
akira28 wants to merge 1 commit into
mainfrom
feature/edot-browser-0.4
Draft

akira28 wants to merge 1 commit into
mainfrom
feature/edot-browser-0.4

Conversation

@akira28

@akira28 akira28 commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

The browser now starts telemetry with startBrowserSdk() from @elastic/opentelemetry-browser 0.4.0 instead of ten hand-wired @opentelemetry/* packages. The SDK posts to the standard /v1/traces and /v1/logs paths, so the ALB needs matching rules before this ships.

Affects: Site UI

Prompt summary: Migrate the frontend telemetry from raw OpenTelemetry packages to the Elastic EDOT browser SDK, as described in the earlier draft #4185. Rebase that work on current main and adapt it to the 0.4.0 release, which changed the configuration shape.

Why

The frontend assembles providers, exporters, propagators and instrumentations by hand across ten packages, while the backend already uses an Elastic distribution. #4185 stalled: it conflicted with main, and it re-added the in-app OTLP proxy that #3521 removed in favour of ALB routing. EDOT 0.4.0 also renamed its options, so that branch no longer matched the SDK.

What

SDK setup

instrumentation.ts makes one startBrowserSdk() call. exportConfig.url is an absolute URL built from apiBasePath, because the SDK validates it with new URL() and starts a no-op SDK when it fails. The synthetic-monitor check and environment detection stay.

Fetch instrumentation

The fetch option keeps trace propagation for same-origin requests. It ignores /v1/{traces,logs,metrics} and the API availability check, so telemetry does not trace itself.

Flushing

The custom visibilitychange flush is gone. The SDK exposes no forceFlush() any more, and the browser batch processors in sdk-trace and sdk-logs already flush when the page hides.

Dependencies and types

The ten @opentelemetry/* packages are replaced by @elastic/opentelemetry-browser. tsconfig.json now lists node in types; without it the pre-commit typescript-check fails on process, global and node:path.

Risk: the browser posts to /v1/traces, /v1/logs and /v1/metrics. Until the ALB and collector accept those paths, browser telemetry is dropped. Merge only after the infra change deploys. Opened as a draft for that reason.

Out of scope: the backend proxy from #4185 is not brought back. The old /v1/o/{t,l} routes keep serving already-cached pages.

Verify

cd src/Elastic.Documentation.Site
npm ci
npm run compile:check
npm run test
npm run build

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4643/

`startBrowserSdk()` from `@elastic/opentelemetry-browser` replaces ten hand-wired `@opentelemetry/*` packages. The SDK posts to `/v1/traces` and `/v1/logs` under `apiBasePath`, and its batch processors flush on page hide, so the custom auto-flush is gone.

`tsconfig.json` now lists `node` in `types`. Without it the pre-commit `typescript-check` fails on `process`, `global` and `node:path` in files that already used them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
assembler-preview — 6e66f0cf Deployed Nov 2, 2026 by github-actions[bot]
docs-preview — 6e66f0cf Deployed Nov 2, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant