Reorganize monitoring package dependencies

The changes include some reorganization of the dependencies in the 'package.json' of the monitoring package and the web app, aimed to enhance readability. Also, a minor correction in the whitespace around "@sentry/nextjs" dependency version was made. Furthermore, code related to the monitoring instrumentation provider has been refactored for more readable error handling.
This commit is contained in:
giancarlo
2024-04-04 10:31:41 +08:00
parent ca2c3ebbbd
commit 5c5532dc22
5 changed files with 14 additions and 16 deletions

View File

@@ -1 +1 @@
export * from './instrumentation';
export * from './instrumentation';

View File

@@ -1,15 +1,15 @@
/**
* @name DEFAULT_INSTRUMENTATION_PROVIDER
* @description Register monitoring instrumentation based on the MONITORING_INSTRUMENTATION_PROVIDER environment variable.
*/
const DEFAULT_INSTRUMENTATION_PROVIDER =
process.env.MONITORING_INSTRUMENTATION_PROVIDER;
enum InstrumentationProvider {
Baselime = 'baselime',
Sentry = 'sentry',
}
/**
* @name DEFAULT_INSTRUMENTATION_PROVIDER
* @description Register monitoring instrumentation based on the MONITORING_INSTRUMENTATION_PROVIDER environment variable.
*/
const DEFAULT_INSTRUMENTATION_PROVIDER = process.env
.MONITORING_INSTRUMENTATION_PROVIDER as InstrumentationProvider | undefined;
/**
* @name registerInstrumentation
* @description Register monitoring instrumentation based on the MONITORING_INSTRUMENTATION_PROVIDER environment variable.
@@ -39,8 +39,6 @@ export async function registerInstrumentation() {
}
default:
throw new Error(
`Unknown instrumentation provider: ${DEFAULT_INSTRUMENTATION_PROVIDER}`,
);
throw new Error(`Unknown instrumentation provider`);
}
}