Native support for SvelteKit's new OpenTelemetry spans

1 min read

Vercel now directly integrates with SvelteKit's new server-side OpenTelemetry spans.

To get started, activate experimental tracing in SvelteKit:

svelte.config.js
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
experimental: {
tracing: {
server: true,
},
instrumentation: {
server: true,
}
}
}
};
export default config;

And create the tracing instrumentation file with the Vercel OpenTelemetry collector:

src/instrumentation.server.ts
import { registerOTel } from '@vercel/otel';
registerOTel({
serviceName: 'my-sveltekit-app'
});

Traces generated during tracing sessions will now include the built-in SvelteKit spans. You can also configure other collectors. See the SvelteKit observability docs for more information.

SvelteKit integrated spans (in green) shown beneath Vercel infrastructure spans. Delays added for illustration.
SvelteKit integrated spans (in green) shown beneath Vercel infrastructure spans. Delays added for illustration.