Skip to content

Commit

Permalink
identify user for sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
sadakchap committed Jan 31, 2025
1 parent 1d82958 commit c2a32c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import Security from './Settings/Security/Security.react';
import { Navbar } from '@back4app2/react-components';
import back4app2 from '../lib/back4app2';
import { initializeAmplitude, initializeLogRocketSession } from 'lib/amplitudeEvents';
import * as Sentry from '@sentry/react';

const ShowSchemaOverview = false; //In progress features. Change false to true to work on this feature.

Expand Down Expand Up @@ -228,6 +229,12 @@ class Dashboard extends React.Component {
}

initializeAmplitude(user.email);
Sentry.setUser({
id: user.email,
email: user.email,
username: user.email,
ip_address: '{{auto}}',
});
waitForScriptToLoad(() => typeof window.LogRocket !== 'undefined').then(() => {
// eslint-disable-next-line no-undef
initializeLogRocketSession(user.email);
Expand Down Expand Up @@ -491,7 +498,7 @@ const NavbarWrapper = () => {
window.location.replace(`${b4aSettings.BACK4APP_SITE_PATH}/login?return-url=${encodeURIComponent(window.location.href)}`);

return;
};
}

setUser(user);

Expand All @@ -503,7 +510,7 @@ const NavbarWrapper = () => {
console.error('unexpected error when finding apps plans', e);

return;
};
}

setAppsPlans(appsPlans);
})();
Expand Down
5 changes: 3 additions & 2 deletions src/dashboard/instrument.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Sentry.init({
dsn: b4aSettings.SENTRY_DSN,
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.5,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
maxBreadcrumbs: 100,
integrations: [
Expand All @@ -22,6 +22,7 @@ Sentry.init({
matchRoutes,
}),
Sentry.replayIntegration(),
Sentry.captureConsoleIntegration({ levels: ['error']})
Sentry.captureConsoleIntegration({ levels: ['error']}),
Sentry.browserTracingIntegration(),
],
});

0 comments on commit c2a32c8

Please sign in to comment.