-
Notifications
You must be signed in to change notification settings - Fork 86
Add user identifier for Sentry #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export const init = jest.fn(); | ||
| export const addBreadcrumb = jest.fn(); | ||
| export const captureException = jest.fn(); | ||
| export const setUser = jest.fn(); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,7 +34,7 @@ import { | |||||
| } from './migrations/migrate-from-wp-now-folder'; | ||||||
| import { setupWPServerFiles, updateWPServerFiles } from './setup-wp-server-files'; | ||||||
| import { stopAllServersOnQuit } from './site-server'; | ||||||
| import { loadUserData } from './storage/user-data'; // eslint-disable-next-line import/order | ||||||
| import { loadUserData, saveUserData } from './storage/user-data'; // eslint-disable-next-line import/order | ||||||
| import { setupUpdates } from './updates'; | ||||||
|
|
||||||
| if ( ! isCLI() && ! process.env.IS_DEV_BUILD ) { | ||||||
|
|
@@ -271,14 +271,23 @@ async function appBoot() { | |||||
| await migrateFromWpNowFolder(); | ||||||
| } | ||||||
|
|
||||||
| const userData = await loadUserData(); | ||||||
|
|
||||||
| if ( ! userData.sentryUserId ) { | ||||||
| userData.sentryUserId = crypto.randomUUID(); | ||||||
| await saveUserData( userData ); | ||||||
| } | ||||||
|
|
||||||
| console.log( 'Setting Sentry user ID:', userData.sentryUserId ); | ||||||
| Sentry.setUser( { id: userData.sentryUserId } ); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, looking at Sentry UI - it seems
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, in this case I definitely ok with naming 👍 |
||||||
|
|
||||||
| createMainWindow(); | ||||||
|
|
||||||
| // Handle CLI commands | ||||||
| listenCLICommands(); | ||||||
| executeCLICommand(); | ||||||
|
|
||||||
| // Bump stats for the first time the app runs - this is when no lastBumpStats are available | ||||||
| const userData = await loadUserData(); | ||||||
| if ( ! userData.lastBumpStats ) { | ||||||
| bumpStat( 'studio-app-launch-first', process.platform ); | ||||||
| } | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about
studioInstanceId?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I referred to in the PR description 😄
To elaborate, I think a name like
studioInstanceIdis more difficult to understand at a glance, and there's currently no plan to use it for other purposes than Sentry reporting.To that end, I think it's better to cross that bridge when and if we get there.