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

@@ -27,11 +27,11 @@
"@kit/email-templates": "workspace:^", "@kit/email-templates": "workspace:^",
"@kit/i18n": "workspace:^", "@kit/i18n": "workspace:^",
"@kit/mailers": "workspace:^", "@kit/mailers": "workspace:^",
"@kit/monitoring": "workspace:^",
"@kit/shared": "workspace:^", "@kit/shared": "workspace:^",
"@kit/supabase": "workspace:^", "@kit/supabase": "workspace:^",
"@kit/team-accounts": "workspace:^", "@kit/team-accounts": "workspace:^",
"@kit/ui": "workspace:^", "@kit/ui": "workspace:^",
"@kit/monitoring": "workspace:^",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@supabase/ssr": "^0.1.0", "@supabase/ssr": "^0.1.0",
"@supabase/supabase-js": "^2.42.0", "@supabase/supabase-js": "^2.42.0",

View File

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

View File

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

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 { enum InstrumentationProvider {
Baselime = 'baselime', Baselime = 'baselime',
Sentry = 'sentry', 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 * @name registerInstrumentation
* @description Register monitoring instrumentation based on the MONITORING_INSTRUMENTATION_PROVIDER environment variable. * @description Register monitoring instrumentation based on the MONITORING_INSTRUMENTATION_PROVIDER environment variable.
@@ -39,8 +39,6 @@ export async function registerInstrumentation() {
} }
default: default:
throw new Error( throw new Error(`Unknown instrumentation provider`);
`Unknown instrumentation provider: ${DEFAULT_INSTRUMENTATION_PROVIDER}`,
);
} }
} }