Skip to content
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

Setup IP address tracking for sentry user #2945

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Setup IP address for sentry user
  • Loading branch information
rohitvinnakota-codecov committed Jun 12, 2024
commit 24265d72577d1c668dbd99b9558d2a5edf288af6
11 changes: 6 additions & 5 deletions src/services/tracking/useTracking.js
Original file line number Diff line number Diff line change
@@ -42,16 +42,17 @@ export function useTracking() {
useTrackFeatureFlags(user) // TODO: Can probably delete
useUpdatePendoWithOwner(user)

const maybeSentryUser = {}
const sentryUser = {}
if (user?.email) {
maybeSentryUser.email = user?.email
sentryUser.email = user?.email
}
if (user?.user?.username) {
maybeSentryUser.username = user?.user?.username
sentryUser.username = user?.user?.username
}

const sentryUser =
Object.keys(maybeSentryUser).length === 0 ? null : maybeSentryUser
// https://docs.sentry.io/platforms/javascript/enriching-events/identify-user/#ip_address
// eslint-disable-next-line
sentryUser.ip_address = '{{auto}}'
Sentry.setUser(sentryUser)

return { data: user, ...all }
Loading
Oops, something went wrong.