1
1
import ApplicationInstance from '@ember/application/instance' ;
2
2
import Ember from 'ember' ;
3
3
import { run } from '@ember/runloop' ;
4
- import environmentConfig from 'ember-get-config' ;
5
4
import * as Sentry from '@sentry/browser' ;
6
5
import { Span , Transaction , Integration } from '@sentry/types' ;
7
6
import { EmberRunQueues } from '@ember/runloop/-private/types' ;
8
7
import { getActiveTransaction } from '..' ;
9
8
import { timestampWithMs } from '@sentry/utils' ;
10
- import { macroCondition , isTesting } from '@embroider/macros' ;
9
+ import { macroCondition , isTesting , getOwnConfig } from '@embroider/macros' ;
10
+ import { EmberSentryConfig , OwnConfig } from '../types' ;
11
+
12
+ function getSentryConfig ( ) {
13
+ return getOwnConfig < OwnConfig > ( ) . sentryConfig ;
14
+ }
11
15
12
16
export function initialize ( appInstance : ApplicationInstance ) : void {
13
- const config = environmentConfig [ '@sentry/ember' ] ;
17
+ const config = getSentryConfig ( ) ;
14
18
if ( config [ 'disablePerformance' ] ) {
15
19
return ;
16
20
}
@@ -32,7 +36,7 @@ function getTransitionInformation(transition: any, router: any) {
32
36
export function _instrumentEmberRouter (
33
37
routerService : any ,
34
38
routerMain : any ,
35
- config : typeof environmentConfig [ '@sentry/ember' ] ,
39
+ config : EmberSentryConfig ,
36
40
startTransaction : Function ,
37
41
startTransactionOnPageLoad ?: boolean ,
38
42
) {
@@ -106,7 +110,7 @@ export function _instrumentEmberRouter(
106
110
} ;
107
111
}
108
112
109
- function _instrumentEmberRunloop ( config : typeof environmentConfig [ '@sentry/ember' ] ) {
113
+ function _instrumentEmberRunloop ( config : EmberSentryConfig ) {
110
114
const { disableRunloopPerformance, minimumRunloopQueueDuration } = config ;
111
115
if ( disableRunloopPerformance ) {
112
116
return ;
@@ -227,7 +231,7 @@ function processComponentRenderAfter(
227
231
}
228
232
}
229
233
230
- function _instrumentComponents ( config : typeof environmentConfig [ '@sentry/ember' ] ) {
234
+ function _instrumentComponents ( config : EmberSentryConfig ) {
231
235
const { disableInstrumentComponents, minimumComponentRenderDuration, enableComponentDefinitions } = config ;
232
236
if ( disableInstrumentComponents ) {
233
237
return ;
@@ -264,7 +268,7 @@ function _instrumentComponents(config: typeof environmentConfig['@sentry/ember']
264
268
_subscribeToRenderEvents ( ) ;
265
269
}
266
270
267
- function _instrumentInitialLoad ( config : typeof environmentConfig [ '@sentry/ember' ] ) {
271
+ function _instrumentInitialLoad ( config : EmberSentryConfig ) {
268
272
const startName = '@sentry/ember:initial-load-start' ;
269
273
const endName = '@sentry/ember:initial-load-end' ;
270
274
@@ -309,7 +313,7 @@ function _instrumentInitialLoad(config: typeof environmentConfig['@sentry/ember'
309
313
}
310
314
311
315
export async function instrumentForPerformance ( appInstance : ApplicationInstance ) {
312
- const config = environmentConfig [ '@sentry/ember' ] ;
316
+ const config = getSentryConfig ( ) ;
313
317
const sentryConfig = config . sentry ;
314
318
315
319
const tracing = await import ( '@sentry/tracing' ) ;
0 commit comments