Introduce error boundary mechanism and exception capture with Baselime and Sentry
Deleted the ErrorBoundary component from the makerkit package and introduced new exception capture mechanisms for Baselime and Sentry monitoring providers. The code now captures all exceptions thrown within components and sends them to the configured monitoring provider, which in turn logs the errors for debugging purposes. Updated packages and environment variables accordingly to support this feature.
This commit is contained in:
31
packages/monitoring/baselime/src/instrumentation.ts
Normal file
31
packages/monitoring/baselime/src/instrumentation.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
const INSTRUMENTATION_SERVICE_NAME = process.env.INSTRUMENTATION_SERVICE_NAME;
|
||||
|
||||
if (!INSTRUMENTATION_SERVICE_NAME) {
|
||||
throw new Error(`
|
||||
You have set the Baselime instrumentation provider, but have not set the INSTRUMENTATION_SERVICE_NAME environment variable. Please set the INSTRUMENTATION_SERVICE_NAME environment variable.
|
||||
`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name registerBaselimeInstrumentation
|
||||
* @description This file is used to register Baselime instrumentation for your Next.js application.
|
||||
*
|
||||
* Please set the MONITORING_INSTRUMENTATION_PROVIDER environment variable to 'baselime' to register Baselime instrumentation.
|
||||
*/
|
||||
export async function registerBaselimeInstrumentation() {
|
||||
const { BaselimeSDK, BetterHttpInstrumentation, VercelPlugin } = await import(
|
||||
'@baselime/node-opentelemetry'
|
||||
);
|
||||
|
||||
const sdk = new BaselimeSDK({
|
||||
serverless: true,
|
||||
service: INSTRUMENTATION_SERVICE_NAME,
|
||||
instrumentations: [
|
||||
new BetterHttpInstrumentation({
|
||||
plugins: [new VercelPlugin()],
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
sdk.start();
|
||||
}
|
||||
Reference in New Issue
Block a user