@@ -678,8 +678,24 @@ public static MutableSettings CreateUpdatedMutableSettings(
678678 // Note: Calling GetAsClass<string>() here instead of GetAsString() as we need to get the
679679 // "serialized JToken", which in JsonConfigurationSource is different, as it allows for non-string tokens
680680 var remoteCustomSamplingRules = dynamicConfig . WithKeys ( ConfigurationKeys . CustomSamplingRules ) . GetAsClassResult < string > ( validator : null , converter : s => s ) ;
681- var customSamplingRules = GetCombinedResult ( manualCustomSamplingRules , remoteCustomSamplingRules , initialSettings . CustomSamplingRules ) ;
682- var customSamplingRulesIsRemote = remoteCustomSamplingRules . ConfigurationResult . IsValid ;
681+ string ? customSamplingRules ;
682+ bool customSamplingRulesIsRemote ;
683+
684+ if ( remoteCustomSamplingRules . ConfigurationResult is { IsValid : true , Result : var remoteRules } )
685+ {
686+ customSamplingRules = remoteRules ;
687+ customSamplingRulesIsRemote = true ;
688+ }
689+ else if ( manualCustomSamplingRules . ConfigurationResult is { IsValid : true , Result : var manualRules } )
690+ {
691+ customSamplingRules = manualRules ;
692+ customSamplingRulesIsRemote = false ;
693+ }
694+ else
695+ {
696+ customSamplingRules = initialSettings . CustomSamplingRules ;
697+ customSamplingRulesIsRemote = initialSettings . CustomSamplingRulesIsRemote ;
698+ }
683699
684700 // These can't actually be changed in code right now, so just set them to the same values
685701 var gitRepositoryUrl = initialSettings . GitRepositoryUrl ;
@@ -713,24 +729,6 @@ public static MutableSettings CreateUpdatedMutableSettings(
713729 errorLog : errorLog ,
714730 telemetry : telemetry ) ;
715731
716- static string ? GetCombinedResult (
717- ConfigurationBuilder . ClassConfigurationResultWithKey < string > manualResult ,
718- ConfigurationBuilder . ClassConfigurationResultWithKey < string > remoteResult ,
719- string ? fallback )
720- {
721- if ( manualResult . ConfigurationResult is { IsValid : true , Result : var r1 } )
722- {
723- return r1 ;
724- }
725-
726- if ( remoteResult . ConfigurationResult is { IsValid : true , Result : var r2 } )
727- {
728- return r2 ;
729- }
730-
731- return fallback ;
732- }
733-
734732 static ReadOnlyDictionary < string , string > GetHeaderTagsResult (
735733 ConfigurationBuilder . ClassConfigurationResultWithKey < IDictionary < string , string > > result ,
736734 bool headerTagsNormalizationFixEnabled ,
0 commit comments