@@ -21,6 +21,7 @@ import { ThemeWrapper } from '@/ThemeWrapper';
2121import { useConfirmModal } from '@/useConfirm' ;
2222import { QueryParamProvider as HDXQueryParamProvider } from '@/useQueryParam' ;
2323import { useBackground , useUserPreferences } from '@/useUserPreferences' ;
24+ import { NextApiConfigResponseData } from '@/types' ;
2425
2526import '@mantine/core/styles.css' ;
2627import '@mantine/notifications/styles.css' ;
@@ -68,26 +69,20 @@ export default function MyApp({ Component, pageProps }: AppPropsWithLayout) {
6869 }
6970 fetch ( '/api/config' )
7071 . then ( res => res . json ( ) )
71- . then ( _jsonData => {
72- if ( _jsonData ?. apiKey ) {
73- let hostname ;
74- try {
75- const url = new URL ( _jsonData . apiServerUrl ) ;
76- hostname = url . hostname ;
77- } catch ( err ) {
78- // ignore
79- }
72+ . then ( ( _jsonData ?: NextApiConfigResponseData ) => {
73+ if ( ! _jsonData ?. exporterEnabled ) {
74+ console . info ( 'OTEL exporter disabled' ) ;
75+ } else if ( _jsonData ?. apiKey ) {
8076 HyperDX . init ( {
8177 apiKey : _jsonData . apiKey ,
8278 consoleCapture : true ,
8379 maskAllInputs : true ,
8480 maskAllText : true ,
8581 service : _jsonData . serviceName ,
86- // tracePropagationTargets: [new RegExp(hostname ?? 'localhost', 'i')],
8782 url : _jsonData . collectorUrl ,
8883 } ) ;
8984 } else {
90- console . warn ( 'No API key found' ) ;
85+ console . warn ( 'No API key found to enable OTEL exporter ' ) ;
9186 }
9287 } )
9388 . catch ( err => {
0 commit comments