@@ -319,6 +319,47 @@ def _process_setting(section, option, getter, mapper):
319319 _raise_configuration_error (section , option )
320320
321321
322+ def _process_dt_setting (section , option_p1 , option_p2 , getter ):
323+ try :
324+ # The type of a value is dictated by the getter
325+ # function supplied.
326+
327+ value1 = getattr (_config_object , getter )(section , option_p1 )
328+ value2 = getattr (_config_object , getter )(section , option_p2 )
329+
330+ # Now need to apply the option from the
331+ # configuration file to the internal settings
332+ # object. Walk the object path and assign it.
333+
334+ target = _settings
335+ fields = option_p1 .split ("." , 1 )
336+
337+ while True :
338+ if len (fields ) == 1 :
339+ value = value1 or value2 or "default"
340+ setattr (target , fields [0 ], value )
341+ break
342+ target = getattr (target , fields [0 ])
343+ fields = fields [1 ].split ("." , 1 )
344+
345+ # Cache the configuration so can be dumped out to
346+ # log file when whole main configuration has been
347+ # processed. This ensures that the log file and log
348+ # level entries have been set.
349+
350+ _cache_object .append ((option_p1 , value1 ))
351+ _cache_object .append ((option_p2 , value2 ))
352+
353+ except configparser .NoSectionError :
354+ pass
355+
356+ except configparser .NoOptionError :
357+ pass
358+
359+ except Exception :
360+ _raise_configuration_error (section , option )
361+
362+
322363# Processing of all the settings for specified section except
323364# for log file and log level which are applied separately to
324365# ensure they are set as soon as possible.
@@ -405,11 +446,9 @@ def _process_configuration(section):
405446 _process_setting (section , "distributed_tracing.enabled" , "getboolean" , None )
406447 _process_setting (section , "distributed_tracing.exclude_newrelic_header" , "getboolean" , None )
407448 _process_setting (section , "distributed_tracing.sampler.adaptive_sampling_target" , "getint" , None )
408- _process_setting (section , "distributed_tracing.sampler.remote_parent_sampled" , "get " , None )
409- _process_setting (section , "distributed_tracing.sampler.remote_parent_not_sampled" , "get " , None )
449+ _process_dt_setting (section , "distributed_tracing.sampler.full_granularity. remote_parent_sampled" , "distributed_tracing.sampler.remote_parent_sampled " , "get" )
450+ _process_dt_setting (section , "distributed_tracing.sampler.full_granularity. remote_parent_not_sampled" , "distributed_tracing.sampler.remote_parent_not_sampled " , "get" )
410451 _process_setting (section , "distributed_tracing.sampler.full_granularity.enabled" , "getboolean" , None )
411- _process_setting (section , "distributed_tracing.sampler.full_granularity.remote_parent_sampled" , "get" , None )
412- _process_setting (section , "distributed_tracing.sampler.full_granularity.remote_parent_not_sampled" , "get" , None )
413452 _process_setting (section , "distributed_tracing.sampler.partial_granularity.enabled" , "getboolean" , None )
414453 _process_setting (section , "distributed_tracing.sampler.partial_granularity.type" , "get" , None )
415454 _process_setting (section , "distributed_tracing.sampler.partial_granularity.remote_parent_sampled" , "get" , None )
0 commit comments