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

@@ -13,12 +13,12 @@
".": "./src/index.ts"
},
"devDependencies": {
"@kit/baselime": "workspace:*",
"@kit/eslint-config": "workspace:*",
"@kit/prettier-config": "workspace:*",
"@kit/sentry": "workspace:*",
"@kit/tailwind-config": "workspace:*",
"@kit/tsconfig": "workspace:*",
"@kit/baselime": "workspace:*",
"@kit/sentry": "workspace:*"
"@kit/tsconfig": "workspace:*"
},
"eslintConfig": {
"root": true,

View File

@@ -16,7 +16,7 @@
"./config/edge": "./src/config/sentry.server.edge.ts"
},
"dependencies": {
"@sentry/nextjs":"^7.109.0",
"@sentry/nextjs": "^7.109.0",
"@sentry/opentelemetry-node": "^7.109.0"
},
"devDependencies": {

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`);
}
}