Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 7 additions & 1 deletion packages/browser-utils/src/metrics/inp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,13 @@ function _trackINP(): () => void {
const replayId = replay && replay.getReplayId();

const userDisplay = user !== undefined ? user.email || user.id || user.ip_address : undefined;
const profileId = scope.getScopeData().contexts?.profile?.profile_id as string | undefined;
let profileId: string | undefined = undefined;
try {
// @ts-expect-error skip optional chaining to save bundle size with try catch
profileId = scope.getScopeData().contexts.profile.profile_id;
} catch {
// do nothing
}

const name = htmlTreeAsString(entry.target);
const attributes: SpanAttributes = dropUndefinedKeys({
Expand Down
5 changes: 5 additions & 0 deletions packages/types/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Contexts extends Record<string, Context | undefined> {
trace?: TraceContext;
cloud_resource?: CloudResourceContext;
state?: StateContext;
profile?: ProfileContext;
}

export interface StateContext extends Record<string, unknown> {
Expand Down Expand Up @@ -114,3 +115,7 @@ export interface CloudResourceContext extends Record<string, unknown> {
['host.id']?: string;
['host.type']?: string;
}

export interface ProfileContext extends Record<string, unknown> {
profile_id: string;
}