11import ApplicationInstance from '@ember/application/instance' ;
22import Ember from 'ember' ;
33import { run } from '@ember/runloop' ;
4- import environmentConfig from 'ember-get-config' ;
54import * as Sentry from '@sentry/browser' ;
65import { Span , Transaction , Integration } from '@sentry/types' ;
76import { EmberRunQueues } from '@ember/runloop/-private/types' ;
87import { getActiveTransaction } from '..' ;
98import { 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+ }
1115
1216export function initialize ( appInstance : ApplicationInstance ) : void {
13- const config = environmentConfig [ '@sentry/ember' ] ;
17+ const config = getSentryConfig ( ) ;
1418 if ( config [ 'disablePerformance' ] ) {
1519 return ;
1620 }
@@ -32,7 +36,7 @@ function getTransitionInformation(transition: any, router: any) {
3236export function _instrumentEmberRouter (
3337 routerService : any ,
3438 routerMain : any ,
35- config : typeof environmentConfig [ '@sentry/ember' ] ,
39+ config : EmberSentryConfig ,
3640 startTransaction : Function ,
3741 startTransactionOnPageLoad ?: boolean ,
3842) {
@@ -106,7 +110,7 @@ export function _instrumentEmberRouter(
106110 } ;
107111}
108112
109- function _instrumentEmberRunloop ( config : typeof environmentConfig [ '@sentry/ember' ] ) {
113+ function _instrumentEmberRunloop ( config : EmberSentryConfig ) {
110114 const { disableRunloopPerformance, minimumRunloopQueueDuration } = config ;
111115 if ( disableRunloopPerformance ) {
112116 return ;
@@ -227,7 +231,7 @@ function processComponentRenderAfter(
227231 }
228232}
229233
230- function _instrumentComponents ( config : typeof environmentConfig [ '@sentry/ember' ] ) {
234+ function _instrumentComponents ( config : EmberSentryConfig ) {
231235 const { disableInstrumentComponents, minimumComponentRenderDuration, enableComponentDefinitions } = config ;
232236 if ( disableInstrumentComponents ) {
233237 return ;
@@ -264,7 +268,7 @@ function _instrumentComponents(config: typeof environmentConfig['@sentry/ember']
264268 _subscribeToRenderEvents ( ) ;
265269}
266270
267- function _instrumentInitialLoad ( config : typeof environmentConfig [ '@sentry/ember' ] ) {
271+ function _instrumentInitialLoad ( config : EmberSentryConfig ) {
268272 const startName = '@sentry/ember:initial-load-start' ;
269273 const endName = '@sentry/ember:initial-load-end' ;
270274
@@ -309,7 +313,7 @@ function _instrumentInitialLoad(config: typeof environmentConfig['@sentry/ember'
309313}
310314
311315export async function instrumentForPerformance ( appInstance : ApplicationInstance ) {
312- const config = environmentConfig [ '@sentry/ember' ] ;
316+ const config = getSentryConfig ( ) ;
313317 const sentryConfig = config . sentry ;
314318
315319 const tracing = await import ( '@sentry/tracing' ) ;
0 commit comments