mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00
feat: initialize sentry only once (#7768)
This commit is contained in:
parent
629c54d3f9
commit
e47c7cc17b
@ -60,6 +60,8 @@ function App(): JSX.Element {
|
|||||||
|
|
||||||
const { isCloudUser, isEnterpriseSelfHostedUser } = useGetTenantLicense();
|
const { isCloudUser, isEnterpriseSelfHostedUser } = useGetTenantLicense();
|
||||||
|
|
||||||
|
const [isSentryInitialized, setIsSentryInitialized] = useState(false);
|
||||||
|
|
||||||
const enableAnalytics = useCallback(
|
const enableAnalytics = useCallback(
|
||||||
(user: IUser): void => {
|
(user: IUser): void => {
|
||||||
// wait for the required data to be loaded before doing init for anything!
|
// wait for the required data to be loaded before doing init for anything!
|
||||||
@ -293,6 +295,7 @@ function App(): JSX.Element {
|
|||||||
Userpilot.initialize(process.env.USERPILOT_KEY);
|
Userpilot.initialize(process.env.USERPILOT_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isSentryInitialized) {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: process.env.SENTRY_DSN,
|
dsn: process.env.SENTRY_DSN,
|
||||||
tunnel: process.env.TUNNEL_URL,
|
tunnel: process.env.TUNNEL_URL,
|
||||||
@ -312,6 +315,9 @@ function App(): JSX.Element {
|
|||||||
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
|
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
|
||||||
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
|
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setIsSentryInitialized(true);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
posthog.reset();
|
posthog.reset();
|
||||||
Sentry.close();
|
Sentry.close();
|
||||||
@ -320,6 +326,7 @@ function App(): JSX.Element {
|
|||||||
window.cioanalytics.reset();
|
window.cioanalytics.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [isCloudUser, isEnterpriseSelfHostedUser]);
|
}, [isCloudUser, isEnterpriseSelfHostedUser]);
|
||||||
|
|
||||||
// if the user is in logged in state
|
// if the user is in logged in state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user