Files
myeasycms-v2/packages/monitoring/api/src/instrumentation.ts
Giancarlo Buomprisco b3acbbe801 chore: remove Baselime monitoring integration and dependencies (#348)
- Deleted `@kit/baselime` package and its related files.
- Removed Baselime service registration from monitoring in API services.
- Cleared `registerInstrumentation`, hooks, provider components, and server utilities associated with Baselime.
- Updated package dependencies to exclude `@kit/baselime`.
2025-08-30 17:24:14 +08:00

43 lines
1.2 KiB
TypeScript

import { createRegistry } from '@kit/shared/registry';
import {
MonitoringProvider,
getMonitoringProvider,
} from './get-monitoring-provider';
// Define a type for the instrumentation registration implementation
type InstrumentationRegistration = {
register: () => Promise<void> | void;
};
// Create a registry for instrumentation providers, using literal strings 'baselime' and 'sentry'
const instrumentationRegistry = createRegistry<
InstrumentationRegistration,
NonNullable<MonitoringProvider>
>();
// Register the 'sentry' instrumentation provider with a no-op registration, since Sentry v8 sets up automatically
instrumentationRegistry.register('sentry', () => {
return {
register: () => {
return;
},
};
});
/**
* @name registerMonitoringInstrumentation
* @description Register monitoring instrumentation based on the MONITORING_PROVIDER environment variable using the registry internally.
*/
export async function registerMonitoringInstrumentation() {
const provider = getMonitoringProvider();
if (!provider) {
return;
}
const instrumentation = await instrumentationRegistry.get(provider);
return instrumentation.register();
}