Commit bcb45cde authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

feat: add user id to sentry (#6896)

* feat: add user id to sentry

* downgrade

* key

* Update src/tracing/index.ts
Co-authored-by: default avatarZach Pomerantz <zzmp@uniswap.org>

* Update src/tracing/index.ts
Co-authored-by: default avatarZach Pomerantz <zzmp@uniswap.org>

* fixes

---------
Co-authored-by: default avatarZach Pomerantz <zzmp@uniswap.org>
parent dfe50b4b
......@@ -6,12 +6,16 @@ import { initializeAnalytics, OriginApplication } from '@uniswap/analytics'
import { SharedEventName } from '@uniswap/analytics-events'
import { isSentryEnabled } from 'utils/env'
import { getEnvName, isProductionEnv } from 'utils/env'
import { v4 as uuidv4 } from 'uuid'
import { beforeSend } from './errors'
// Dump some metadata into the window to allow client verification.
window.GIT_COMMIT_HASH = process.env.REACT_APP_GIT_COMMIT_HASH
// This is used to identify the user in Sentry.
const SENTRY_USER_ID_KEY = 'sentry-user-id'
// Actual KEYs are set by proxy servers.
const AMPLITUDE_DUMMY_KEY = '00000000000000000000000000000000'
export const STATSIG_DUMMY_KEY = 'client-0000000000000000000000000000000000000000000'
......@@ -31,6 +35,12 @@ Sentry.init({
beforeSend,
})
let sentryUserId = localStorage.getItem(SENTRY_USER_ID_KEY)
if (!sentryUserId) {
localStorage.setItem(SENTRY_USER_ID_KEY, (sentryUserId = uuidv4()))
}
Sentry.setUser({ id: sentryUserId })
initializeAnalytics(AMPLITUDE_DUMMY_KEY, OriginApplication.INTERFACE, {
proxyUrl: process.env.REACT_APP_AMPLITUDE_PROXY_URL,
defaultEventName: SharedEventName.PAGE_VIEWED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment