Skip to content

Commit 3c841ce

Browse files
mydeaAbhiPrasad
authored andcommitted
ref(ember): Avoid namespace import to hopefully resolve minification issue (#10885)
Let's see if this actually fixes this issue: #10566 🤔 Maybe the internal bundler is thrown off by the fact that we lazy load browser tracing further below, and only includes certain things in `Sentry` on top, not sure...
1 parent 9b4c855 commit 3c841ce

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

packages/ember/addon/instance-initializers/sentry-performance.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@ import type RouterService from '@ember/routing/router-service';
66
import { _backburner, run, scheduleOnce } from '@ember/runloop';
77
import type { EmberRunQueues } from '@ember/runloop/-private/types';
88
import { getOwnConfig, isTesting, macroCondition } from '@embroider/macros';
9-
import * as Sentry from '@sentry/browser';
109
import type { ExtendedBackburner } from '@sentry/ember/runloop';
1110
import type { Span } from '@sentry/types';
1211
import { GLOBAL_OBJ, browserPerformanceTimeOrigin, timestampInSeconds } from '@sentry/utils';
1312

14-
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
15-
import type { BrowserClient } from '..';
16-
import { getActiveSpan, startInactiveSpan } from '..';
13+
import type { BrowserClient } from '@sentry/browser';
14+
import {
15+
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
16+
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
17+
getActiveSpan,
18+
getClient,
19+
startBrowserTracingNavigationSpan,
20+
startBrowserTracingPageLoadSpan,
21+
startInactiveSpan,
22+
} from '@sentry/browser';
1723
import type { EmberRouterMain, EmberSentryConfig, GlobalConfig, OwnConfig } from '../types';
1824

1925
function getSentryConfig(): EmberSentryConfig {
@@ -103,7 +109,7 @@ export function _instrumentEmberRouter(
103109
const browserTracingOptions = config.browserTracingOptions || config.sentry.browserTracingOptions || {};
104110
const url = getLocationURL(location);
105111

106-
const client = Sentry.getClient<BrowserClient>();
112+
const client = getClient<BrowserClient>();
107113

108114
if (!client) {
109115
return;
@@ -115,7 +121,7 @@ export function _instrumentEmberRouter(
115121
browserTracingOptions.instrumentPageLoad !== false
116122
) {
117123
const routeInfo = routerService.recognize(url);
118-
activeRootSpan = Sentry.startBrowserTracingPageLoadSpan(client, {
124+
activeRootSpan = startBrowserTracingPageLoadSpan(client, {
119125
name: `route:${routeInfo.name}`,
120126
origin: 'auto.pageload.ember',
121127
attributes: {
@@ -148,7 +154,7 @@ export function _instrumentEmberRouter(
148154
const { fromRoute, toRoute } = getTransitionInformation(transition, routerService);
149155
activeRootSpan?.end();
150156

151-
activeRootSpan = Sentry.startBrowserTracingNavigationSpan(client, {
157+
activeRootSpan = startBrowserTracingNavigationSpan(client, {
152158
name: `route:${toRoute}`,
153159
origin: 'auto.navigation.ember',
154160
attributes: {
@@ -429,7 +435,7 @@ export async function instrumentForPerformance(appInstance: ApplicationInstance)
429435
instrumentPageLoad: false,
430436
});
431437

432-
const client = Sentry.getClient<BrowserClient>();
438+
const client = getClient<BrowserClient>();
433439

434440
const isAlreadyInitialized = macroCondition(isTesting()) ? !!client?.getIntegrationByName('BrowserTracing') : false;
435441

0 commit comments

Comments
 (0)