@@ -679,8 +679,24 @@ public static MutableSettings CreateUpdatedMutableSettings(
679679 var dynamicConfig = new ConfigurationBuilder ( dynamicSource , telemetry ) ;
680680 var manualCustomSamplingRules = manualConfig . WithKeys ( ConfigurationKeys . CustomSamplingRules ) . AsStringResult ( ) ;
681681 var remoteCustomSamplingRules = dynamicConfig . WithKeys ( ConfigurationKeys . CustomSamplingRules ) . GetAsClassResult < string > ( validator : null , converter : s => s ) ;
682- var customSamplingRules = GetCombinedResult ( manualCustomSamplingRules , remoteCustomSamplingRules , initialSettings . CustomSamplingRules ) ;
683- var customSamplingRulesIsRemote = remoteCustomSamplingRules . ConfigurationResult . IsValid ;
682+ string ? customSamplingRules ;
683+ bool customSamplingRulesIsRemote ;
684+
685+ if ( remoteCustomSamplingRules . ConfigurationResult is { IsValid : true , Result : var r2 } )
686+ {
687+ customSamplingRules = r2 ;
688+ customSamplingRulesIsRemote = false ;
689+ }
690+ else if ( manualCustomSamplingRules . ConfigurationResult is { IsValid : true , Result : var r1 } )
691+ {
692+ customSamplingRules = r1 ;
693+ customSamplingRulesIsRemote = true ;
694+ }
695+ else
696+ {
697+ customSamplingRules = initialSettings . CustomSamplingRules ;
698+ customSamplingRulesIsRemote = initialSettings . CustomSamplingRulesIsRemote ;
699+ }
684700
685701 // These can't actually be changed in code right now, so just set them to the same values
686702 var gitRepositoryUrl = initialSettings . GitRepositoryUrl ;
@@ -714,24 +730,6 @@ public static MutableSettings CreateUpdatedMutableSettings(
714730 errorLog : errorLog ,
715731 telemetry : telemetry ) ;
716732
717- static string ? GetCombinedResult (
718- ConfigurationBuilder . ClassConfigurationResultWithKey < string > manualResult ,
719- ConfigurationBuilder . ClassConfigurationResultWithKey < string > remoteResult ,
720- string ? fallback )
721- {
722- if ( manualResult . ConfigurationResult is { IsValid : true , Result : var r1 } )
723- {
724- return r1 ;
725- }
726-
727- if ( remoteResult . ConfigurationResult is { IsValid : true , Result : var r2 } )
728- {
729- return r2 ;
730- }
731-
732- return fallback ;
733- }
734-
735733 static ReadOnlyDictionary < string , string > GetHeaderTagsResult (
736734 ConfigurationBuilder . ClassConfigurationResultWithKey < IDictionary < string , string > > result ,
737735 bool headerTagsNormalizationFixEnabled ,
0 commit comments