@sophonz/instrumentation-post-doc-load-resource
v0.0.9
Published
Readme
@sophonz/instrumentation-post-doc-load-resource
Instruments resources that are dynamically added to the page after the initial document load, such as images, scripts, and stylesheets injected at runtime.
Part of the Sophonz OpenTelemetry suite.
Install
bun add @sophonz/instrumentation-post-doc-load-resource
# or
pnpm add @sophonz/instrumentation-post-doc-load-resource
# or
npm install @sophonz/instrumentation-post-doc-load-resourceUsage
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { SophonzPostDocLoadResourceInstrumentation } from '@sophonz/instrumentation-post-doc-load-resource';
registerInstrumentations({
instrumentations: [
new SophonzPostDocLoadResourceInstrumentation({
allowedInitiatorTypes: ['img', 'script', 'css', 'link'], // optional
ignoreUrls: [/\.js$/, /\.css$/], // optional
screenNameOption: 'full', // optional
}),
],
});API
| Export | Purpose |
|--------|---------|
| SophonzPostDocLoadResourceInstrumentation | Observes resources added after page load via Performance Observer and Mutation Observer. |
| SophonzPostDocLoadResourceInstrumentationConfig | Config with allowedInitiatorTypes, ignoreUrls, and screenNameOption. |
Peer dependencies
@opentelemetry/api^1.9.1@opentelemetry/core^2.7.1@opentelemetry/instrumentation^0.217.0@opentelemetry/sdk-trace-web^2.7.1
License
See LICENSE in this package.
Part of sophonz-js.
