@@ -39,7 +39,7 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
3939 #client: AppConfigurationClient ;
4040 #options: AzureAppConfigurationOptions | undefined ;
4141 #isInitialLoadCompleted: boolean = false ;
42- #featureFlagTracing: FeatureFlagTracingOptions = new FeatureFlagTracingOptions ( ) ;
42+ #featureFlagTracing: FeatureFlagTracingOptions | undefined ;
4343
4444 // Refresh
4545 #refreshInProgress: boolean = false ;
@@ -68,6 +68,9 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
6868
6969 // Enable request tracing if not opt-out
7070 this . #requestTracingEnabled = requestTracingEnabled ( ) ;
71+ if ( this . #requestTracingEnabled) {
72+ this . #featureFlagTracing = new FeatureFlagTracingOptions ( ) ;
73+ }
7174
7275 if ( options ?. trimKeyPrefixes ) {
7376 this . #sortedTrimKeyPrefixes = [ ...options . trimKeyPrefixes ] . sort ( ( a , b ) => b . localeCompare ( a ) ) ;
@@ -284,7 +287,9 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
284287 selector . pageEtags = pageEtags ;
285288 }
286289
287- this . #featureFlagTracing. resetFeatureFlagTracing ( ) ;
290+ if ( this . #requestTracingEnabled && this . #featureFlagTracing !== undefined ) {
291+ this . #featureFlagTracing. resetFeatureFlagTracing ( ) ;
292+ }
288293
289294 // parse feature flags
290295 const featureFlags = await Promise . all (
@@ -559,13 +564,13 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
559564 throw new Error ( "The value of configuration setting cannot be undefined." ) ;
560565 }
561566 const featureFlag = JSON . parse ( rawFlag ) ;
562-
563- if ( featureFlag [ CONDITIONS_KEY_NAME ] && featureFlag [ CONDITIONS_KEY_NAME ] [ CLIENT_FILTERS_KEY_NAME ] ) {
564- for ( const filter of featureFlag [ CONDITIONS_KEY_NAME ] [ CLIENT_FILTERS_KEY_NAME ] ) {
565- this . #featureFlagTracing. updateFeatureFilterTracing ( filter [ NAME_KEY_NAME ] ) ;
567+ if ( this . #requestTracingEnabled && this . #featureFlagTracing !== undefined ) {
568+ if ( featureFlag [ CONDITIONS_KEY_NAME ] && featureFlag [ CONDITIONS_KEY_NAME ] [ CLIENT_FILTERS_KEY_NAME ] ) {
569+ for ( const filter of featureFlag [ CONDITIONS_KEY_NAME ] [ CLIENT_FILTERS_KEY_NAME ] ) {
570+ this . #featureFlagTracing. updateFeatureFilterTracing ( filter [ NAME_KEY_NAME ] ) ;
571+ }
566572 }
567573 }
568-
569574 return featureFlag ;
570575 }
571576}
0 commit comments