Refactor monitoring services into separate packages
Separated and isolated the responsibilities of monitoring tools. Reorganized the code by introducing a core package that contains common code related to monitoring and moved all the service operations like error capturing and identification of users into their respective packages. This ensures each tool is independent and easy to maintain.
This commit is contained in:
19
packages/monitoring/sentry/src/components/provider.tsx
Normal file
19
packages/monitoring/sentry/src/components/provider.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useRef } from 'react';
|
||||
|
||||
import { MonitoringContext } from '@kit/monitoring-core';
|
||||
|
||||
import { SentryServerMonitoringService } from '../services/sentry-server-monitoring.service';
|
||||
|
||||
export function SentryProvider({ children }: React.PropsWithChildren) {
|
||||
return <MonitoringProvider>{children}</MonitoringProvider>;
|
||||
}
|
||||
|
||||
function MonitoringProvider(props: React.PropsWithChildren) {
|
||||
const service = useRef(new SentryServerMonitoringService());
|
||||
|
||||
return (
|
||||
<MonitoringContext.Provider value={service.current}>
|
||||
{props.children}
|
||||
</MonitoringContext.Provider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user