Skip to content

Commit bb228b2

Browse files
committed
sentry.origin added, tests adjusted
1 parent e15607b commit bb228b2

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

packages/core/src/js/tracing/expoRouter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { SPAN_STATUS_ERROR, SPAN_STATUS_OK, startInactiveSpan } from '@sentry/core';
2+
import { SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH } from './origin';
23

34
/**
45
* Type definition for Expo Router's router object
@@ -47,6 +48,7 @@ export function wrapExpoRouter<T extends ExpoRouter>(router: T): T {
4748
op: 'navigation.prefetch',
4849
name: `Prefetch ${routeName}`,
4950
attributes: {
51+
'sentry.origin': SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH,
5052
'route.href': typeof href === 'string' ? href : JSON.stringify(href),
5153
'route.name': routeName,
5254
},

packages/core/src/js/tracing/origin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ export const SPAN_ORIGIN_AUTO_NAVIGATION_CUSTOM = 'auto.navigation.custom';
1010

1111
export const SPAN_ORIGIN_AUTO_UI_TIME_TO_DISPLAY = 'auto.ui.time_to_display';
1212
export const SPAN_ORIGIN_MANUAL_UI_TIME_TO_DISPLAY = 'manual.ui.time_to_display';
13+
14+
export const SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH = 'auto.expo_router.prefetch';

packages/core/test/tracing/expoRouter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { SPAN_STATUS_ERROR, SPAN_STATUS_OK } from '@sentry/core';
22
import { type ExpoRouter, wrapExpoRouter } from '../../src/js/tracing';
3+
import { SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH } from '../../src/js/tracing/origin';
34

45
const mockStartInactiveSpan = jest.fn();
56

@@ -51,6 +52,7 @@ describe('wrapExpoRouter', () => {
5152
name: 'Prefetch /details/123',
5253
origin: 'auto.navigation.react_navigation',
5354
attributes: {
55+
'sentry.origin': SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH,
5456
'route.href': '/details/123',
5557
'route.name': '/details/123',
5658
},
@@ -74,6 +76,7 @@ describe('wrapExpoRouter', () => {
7476
name: 'Prefetch /profile',
7577
origin: 'auto.navigation.react_navigation',
7678
attributes: {
79+
'sentry.origin': SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH,
7780
'route.href': JSON.stringify(href),
7881
'route.name': '/profile',
7982
},
@@ -97,6 +100,7 @@ describe('wrapExpoRouter', () => {
97100
name: 'Prefetch unknown',
98101
origin: 'auto.navigation.react_navigation',
99102
attributes: {
103+
'sentry.origin': SPAN_ORIGIN_AUTO_EXPO_ROUTER_PREFETCH,
100104
'route.href': JSON.stringify(href),
101105
'route.name': 'unknown',
102106
},

0 commit comments

Comments
 (0)