Add ready method to monitoring services
Implemented a ready method for all monitoring services to standardize initialization readiness checks. Updated initialization logic in SentryMonitoringService to determine environment and invoke appropriate client initialization.
This commit is contained in:
@@ -22,6 +22,9 @@ export function useBaselime(): MonitoringService {
|
||||
captureEvent<Extra extends object>(event: string, extra?: Extra) {
|
||||
return sendEvent(event, extra);
|
||||
},
|
||||
ready() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
} satisfies MonitoringService;
|
||||
}, [captureException, sendEvent, setUser]);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MonitoringService } from '@kit/monitoring-core';
|
||||
const apiKey = z
|
||||
.string({
|
||||
required_error: 'NEXT_PUBLIC_BASELIME_KEY is required',
|
||||
description: 'The Baseline API key',
|
||||
})
|
||||
.parse(process.env.NEXT_PUBLIC_BASELIME_KEY);
|
||||
|
||||
@@ -99,6 +100,10 @@ export class BaselimeServerMonitoringService implements MonitoringService {
|
||||
identifyUser<Info extends { id: string }>(info: Info) {
|
||||
this.userId = info.id;
|
||||
}
|
||||
|
||||
ready() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
function getFormattedError(error: Error) {
|
||||
|
||||
Reference in New Issue
Block a user