A streamlined OpenTelemetry Middleware for SvelteKit
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
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 |
© Baselime Limited, 2023
Distributed under Apache 2 License (Apache-2.0
).
See LICENSE for more information.