open-telemetry/opentelemetry-browser
open-telemetry/opentelemetry-browser has 72 GitHub stars and 47 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-16 22:17 UTC. Last push 2026-11-13.
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
OpenTelemetry Browser SDK and instrumentation
Web & AppsREADME.md
Original
OpenTelemetry Browser
About
This repository is the home of OpenTelemetry Browser instrumentations and the future home of the OpenTelemetry Browser SDK.
This repo provides event-based instrumentations that emit events (structured
log records) for browser performance and user interactions. It also provides
span-based instrumentations for fetch and XMLHttpRequest. Use the
instrumentations from this repository. Do not mix them with the classic
instrumentations from
opentelemetry-js or
opentelemetry-js-contrib
for the same API, because both would record every call.
The classic browser instrumentations in other OpenTelemetry JS repositories are deprecated or will be deprecated soon. See Migrate from classic browser instrumentations to move to this repository.
See the Browser Packages section below for a full list of browser-related packages across all repositories.
Quick Start
Installation
npm install @opentelemetry/browser-instrumentation \
@opentelemetry/api \
@opentelemetry/api-logs \
@opentelemetry/sdk-logs
Basic example
import { logs } from '@opentelemetry/api-logs';
import {
ConsoleLogRecordExporter,
LoggerProvider,
SimpleLogRecordProcessor,
} from '@opentelemetry/sdk-logs';
import { NavigationTimingInstrumentation } from '@opentelemetry/browser-instrumentation/experimental/navigation-timing';
import { ResourceTimingInstrumentation } from '@opentelemetry/browser-instrumentation/experimental/resource-timing';
import { UserActionInstrumentation } from '@opentelemetry/browser-instrumentation/experimental/user-action';
import { WebVitalsInstrumentation } from '@opentelemetry/browser-instrumentation/experimental/web-vitals';
import { ConsoleInstrumentation } from '@opentelemetry/browser-instrumentation/experimental/console';
const logProvider = new LoggerProvider({
processors: [
new SimpleLogRecordProcessor({ exporter: new ConsoleLogRecordExporter() }),
],
});
logs.setGlobalLoggerProvider(logProvider);
const instrumentations = [
new NavigationTimingInstrumentation(),
new ResourceTimingInstrumentation(),
new UserActionInstrumentation(),
new WebVitalsInstrumentation(),
new ConsoleInstrumentation(),
];
// An instrumentation does nothing until enable(). Without deps, it uses the global providers.
for (const instrumentation of instrumentations) {
instrumentation.enable();
}
The Browser SDK can also enable the instrumentations for you, with its own providers.
For detailed configuration options, see the instrumentation package README.
More examples
For a more complete setup that combines the event-based and span-based instrumentations from this repository, see the examples directory.
Sandbox
Interactive playground for testing OpenTelemetry browser instrumentations. Configure the SDK, trigger actions (fetch, XHR, errors, navigation…), and inspect exported spans and logs in real time.
Run locally
npm install
npm run dev
This starts the sandbox with hot-reload via Vite at http://localhost:5173.
GitHub Pages
The sandbox is automatically deployed to GitHub Pages on every push to main
via the deploy-sandbox.yml workflow. The live site is available at
open-telemetry.github.io/opentelemetry-browser.
Documentation
- Migration guide — moving from the browser
packages in
opentelemetry-jsandopentelemetry-js-contrib. - Session Management — configuring and using the SDK's built-in session support.
- Browser Events — catalog of browser telemetry events.
- Navigation event — deep dive on the
browser.navigationevent.
Browser Packages
The following tables list browser-related packages across all OpenTelemetry JS repositories.
Packages in this repository
| Package | Description | Status |
|---|---|---|
| @opentelemetry/browser-api | The contract between browser SDKs and instrumentations: Instrumentation, InstrumentationDeps and InstrumentationBase. |
experimental |
| @opentelemetry/browser-instrumentation | Browser instrumentations: event-based (console, errors, navigation, navigation timing, resource timing, element timing, user actions, web vitals) and span-based (fetch, XHR). | experimental |
| @opentelemetry/browser-sdk | Browser SDK components, including browser resource detection, document context, and session management. | experimental |
Migrate from classic browser instrumentations
The browser instrumentations in opentelemetry-js and opentelemetry-js-contrib are deprecated or will be deprecated soon. Move to the instrumentations in this repository as soon as possible. The tables below show the replacement for each classic package.
When you migrate:
- Remove the classic instrumentation when you add its replacement. A classic instrumentation cannot detect our patches, so if you use both for the same API, every call is recorded twice.
- Some replacements emit events (log records), not spans. For example,
instrumentation-document-loadandinstrumentation-user-interactioncreate spans, but their replacements create events. Set up aLoggerProviderfor them. - The instrumentations in this repository do nothing when you create them. Call
enable()on each one, or pass them to the Browser SDK. Do not useregisterInstrumentations()from@opentelemetry/instrumentationwith them. See Differences from classic instrumentations. auto-instrumentations-webturns on the classic instrumentations. Replace it with the instrumentations from this repository, passed to the Browser SDK.
Event-based instrumentations (other repositories)
| Package | Location | Description | Status | Replacement in this repository |
|---|---|---|---|---|
| instrumentation-browser-navigation | opentelemetry-js-contrib | Capture browser navigation events (SPA route changes). | experimental | Navigation |
| instrumentation-web-exception | opentelemetry-js-contrib | Capture unhandled exceptions and promise rejections. | experimental | Errors |
Span-based instrumentations (other repositories)
| Package | Location | Description | Status | Replacement in this repository |
|---|---|---|---|---|
| opentelemetry-instrumentation-fetch | opentelemetry-js | Instrumentation for the Fetch API. | deprecated | Fetch |
| opentelemetry-instrumentation-xml-http-request | opentelemetry-js | Instrumentation for XMLHttpRequest. | deprecated | XHR |
| instrumentation-document-load | opentelemetry-js-contrib | Capture document load/navigation timing spans. | experimental | Navigation Timing and Resource Timing (events) |
| instrumentation-long-task | opentelemetry-js-contrib | Capture Long Tasks API entries as spans. | experimental | No replacement planned |
| instrumentation-user-interaction | opentelemetry-js-contrib | Trace user interactions (e.g., clicks). | experimental | User Action (events) |
SDK and Utilities (other repositories)
| Package | Location | Description | Status |
|---|---|---|---|
| web-common | opentelemetry-js | Shared utilities for browser/web instrumentations. | experimental |
| opentelemetry-context-zone | opentelemetry-js | Zone.js-based context manager for maintaining trace context in browsers. | stable |
| auto-instrumentations-web | opentelemetry-js-contrib | Bundle that auto-enables common web instrumentations. | experimental |
Contributing
See CONTRIBUTING.md
Maintainers
- David Luna, Elastic
- Jared Freeze, Embrace
- Joaquín Díaz, Embrace
- Martin Kuba, Grafana Labs
- Wolfgang Therrien, Honeycomb
For more information about the maintainer role, see the community repository.
Approvers
- Aditya Reddy, Independent
- Maxime Quentin, Datadog
For more information about the approver role, see the community repository.
Emeritus
- Benoît Zugmeyer, Approver
- Ted Young, Maintainer
For more information about the emeritus role, see the community repository.