File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
browser-utils/src/metrics Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,13 @@ function _trackINP(): () => void {
9393 const replayId = replay && replay . getReplayId ( ) ;
9494
9595 const userDisplay = user !== undefined ? user . email || user . id || user . ip_address : undefined ;
96- const profileId = scope . getScopeData ( ) . contexts ?. profile ?. profile_id as string | undefined ;
96+ let profileId : string | undefined = undefined ;
97+ try {
98+ // @ts -expect-error skip optional chaining to save bundle size with try catch
99+ profileId = scope . getScopeData ( ) . contexts . profile . profile_id ;
100+ } catch {
101+ // do nothing
102+ }
97103
98104 const name = htmlTreeAsString ( entry . target ) ;
99105 const attributes : SpanAttributes = dropUndefinedKeys ( {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ export interface Contexts extends Record<string, Context | undefined> {
1212 trace ?: TraceContext ;
1313 cloud_resource ?: CloudResourceContext ;
1414 state ?: StateContext ;
15+ profile ?: ProfileContext ;
1516}
1617
1718export interface StateContext extends Record < string , unknown > {
@@ -114,3 +115,7 @@ export interface CloudResourceContext extends Record<string, unknown> {
114115 [ 'host.id' ] ?: string ;
115116 [ 'host.type' ] ?: string ;
116117}
118+
119+ export interface ProfileContext extends Record < string , unknown > {
120+ profile_id : string ;
121+ }
You can’t perform that action at this time.
0 commit comments