@baselime/sveltekit-opentelemetry-middleware
v0.1.9
Published
A Template for Typescript NPM Libraries
Downloads
274
Readme
Svelte Kit OpenTelemetry Middleware
A streamlined OpenTelemetry Middleware for SvelteKit
Getting Started
Install the packages
npm i @baselime/node-opentelemetry @baselime/sveltekit-opentelemetry-middleware
Add the following code to your root.server.{ts|js}
import { withOpenTelemetry } from '@baselime/sveltekit-opentelemetry-middleware'
import { BaselimeSDK } from '@baselime/node-opentelemetry';
new BaselimeSDK({}).start();
export const handle = withOpenTelemetry(async ({ event, resolve }) => {
return resolve(event);
});
To configure the BaselimeSDK visit the documentation
Options
The withOpenTelemetry function takes the following options
| Parameter | Type | Description | |-----------------------|-----------|----------------------------------------------------------| | captureRequestBody | boolean | Capture the request body in the span. (Optional) | | captureResponseBody | boolean | Capture the response body in the span. (Optional) | | requestIdHeader | string | The header to look for the request id in. By default it will check x-request-id and x-vercel
License
© Baselime Limited, 2023
Distributed under Apache 2 License (Apache-2.0
).
See LICENSE for more information.