@sophonz/instrumentation-browser-longtask
v0.0.9
Published
Readme
@sophonz/instrumentation-browser-longtask
Observes the Performance Observer Longtask API to track long-running tasks that block the main thread in the browser.
Part of the Sophonz OpenTelemetry suite.
Install
bun add @sophonz/instrumentation-browser-longtask
# or
pnpm add @sophonz/instrumentation-browser-longtask
# or
npm install @sophonz/instrumentation-browser-longtaskUsage
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { SophonzLongTaskInstrumentation } from '@sophonz/instrumentation-browser-longtask';
registerInstrumentations({
instrumentations: [
new SophonzLongTaskInstrumentation({
screenNameOption: 'full', // optional
}),
],
});The instrumentation auto-registers when enabled and listens for longtask performance entries.
API
| Export | Purpose |
|--------|---------|
| SophonzLongTaskInstrumentation | Main instrumentation class. Observes long tasks via Performance Observer. |
| SophonzLongTaskInstrumentationConfig | Config interface with optional screenNameOption for span metadata. |
Peer dependencies
@opentelemetry/instrumentation^0.217.0
License
See LICENSE in this package.
Part of sophonz-js.
