add baselime to nextjs

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-17 22:23:02 +02:00
committed by Carl-Gerhard Lindesvärd
parent ac84adf1a4
commit dd53a5757a
6 changed files with 636 additions and 26 deletions

View File

@@ -30,6 +30,7 @@ const config = {
experimental: {
// Avoid "Critical dependency: the request of a dependency is an expression"
serverComponentsExternalPackages: ['bullmq', 'ioredis'],
instrumentationHook: true,
},
/**
* If you are using `appDir` then you must comment the below `i18n` config out.

View File

@@ -13,6 +13,7 @@
"with-env": "dotenv -e ../../.env -c --"
},
"dependencies": {
"@baselime/node-opentelemetry": "^0.5.8",
"@clerk/nextjs": "^4.29.7",
"@clickhouse/client": "^0.2.9",
"@hookform/resolvers": "^3.3.4",

View File

@@ -0,0 +1,21 @@
/* eslint-disable */
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
const { BaselimeSDK, VercelPlugin, BetterHttpInstrumentation } =
// @ts-expect-error
await import('@baselime/node-opentelemetry');
const sdk = new BaselimeSDK({
serverless: true,
service: 'vercel-coderaxs-projects-d46dc62b',
instrumentations: [
new BetterHttpInstrumentation({
plugins: [new VercelPlugin()],
}),
],
});
sdk.start();
}
}