Skip to content

Commit e0f97a3

Browse files
committed
fix
1 parent 4a3e92c commit e0f97a3

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/angular/src/tracing.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ import {
1313
getCurrentScope,
1414
startBrowserTracingNavigationSpan,
1515
} from '@sentry/browser';
16-
import { SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, getActiveSpan, spanToJSON, startInactiveSpan } from '@sentry/core';
16+
import {
17+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
18+
getActiveSpan,
19+
getClient,
20+
spanToJSON,
21+
startInactiveSpan,
22+
} from '@sentry/core';
1723
import type { Integration, Span, Transaction, TransactionContext } from '@sentry/types';
1824
import { logger, stripUrlQueryAndFragment, timestampInSeconds } from '@sentry/utils';
1925
import type { Observable } from 'rxjs';
@@ -115,11 +121,12 @@ export class TraceService implements OnDestroy {
115121
this._routingSpan = null;
116122
}
117123

124+
const client = getClient();
118125
const strippedUrl = stripUrlQueryAndFragment(navigationEvent.url);
119126

120-
if (hooksBasedInstrumentation) {
127+
if (client && hooksBasedInstrumentation) {
121128
if (!getActiveSpan()) {
122-
startBrowserTracingNavigationSpan({
129+
startBrowserTracingNavigationSpan(client, {
123130
name: strippedUrl,
124131
op: 'navigation',
125132
origin: 'auto.navigation.angular',

0 commit comments

Comments
 (0)