@sophonz/instrumentation-fetch
v0.0.9
Published
Readme
@sophonz/instrumentation-fetch
Instruments the browser Fetch API to trace HTTP requests and responses, extending the OpenTelemetry fetch instrumentation with request/response headers and body capture.
Part of the Sophonz OpenTelemetry suite.
Install
bun add @sophonz/instrumentation-fetch
# or
pnpm add @sophonz/instrumentation-fetch
# or
npm install @sophonz/instrumentation-fetchUsage
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { SophonzFetchInstrumentation } from '@sophonz/instrumentation-fetch';
registerInstrumentations({
instrumentations: [
new SophonzFetchInstrumentation({
advancedNetworkCapture: () => true, // optional: enable detailed capture
screenNameOption: 'full', // optional
}),
],
});API
| Export | Purpose |
|--------|---------|
| SophonzFetchInstrumentation | Extends OpenTelemetry's FetchInstrumentation with body and header capture. |
| SophonzFetchInstrumentationConfig | Config with advancedNetworkCapture callback and screenNameOption. |
Peer dependencies
@opentelemetry/instrumentation-fetch^0.217.0
License
See LICENSE in this package.
Part of sophonz-js.
