This commit is contained in:
Enno Gelhaus 2025-09-19 18:49:37 +02:00
commit f3c2a1f2f4
3 changed files with 22 additions and 2 deletions

View File

@ -35,7 +35,7 @@ export const initializeSentry = (appName: string, allowLogs = false) => {
enableLogs: true,
// Profiling
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.35,
profileSessionSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.45,
profileLifecycle: 'trace',
});
} catch (err) {

View File

@ -19,5 +19,5 @@ export const initializeSentryClient = (environment: string, dsn: string) =>
replaysSessionSampleRate: environment === 'development' ? 1.0 : 0.5,
replaysOnErrorSampleRate: 1.0,
profilesSampleRate: environment === 'development' ? 1.0 : 0.2,
profilesSampleRate: environment === 'development' ? 1.0 : 0.45,
});

View File

@ -26,6 +26,26 @@ export const initializeSentryBasic = (environment: string, dsn: string, extensio
...extension,
debug: environment === 'development',
tracesSampleRate: environment === 'development' ? 1.0 : 0.3,
// Filtert Events und zeigt das User-Feedback-Modal an
beforeSend(event, hint) {
if (event.exception && event.exception.values) {
for (const exception of event.exception.values) {
// Filtert "Failed to fetch" Fehler heraus
if (exception.value && /Failed to fetch/.test(exception.value)) {
return null; // Verwirft den Event
}
}
}
// Wenn der Event eine Ausnahme ist und nicht gefiltert wurde,
// wird das User-Feedback-Modal angezeigt
if (event.exception && event.event_id) {
Sentry.showReportDialog({ eventId: event.event_id });
}
return event; // Sendet den Event an Sentry
},
});
} catch (err) {}
};