@@ -1020,18 +1020,36 @@ def sampling_algo_compute_sampled_and_priority(self, priority, sampled):
10201020 priority += 1
10211021 return priority , sampled
10221022
1023- def _compute_sampled_and_priority (self , priority , sampled , remote_parent_sampled_path , remote_parent_sampled_setting , remote_parent_not_sampled_path , remote_parent_not_sampled_setting ):
1023+ def _compute_sampled_and_priority (
1024+ self ,
1025+ priority ,
1026+ sampled ,
1027+ remote_parent_sampled_path ,
1028+ remote_parent_sampled_setting ,
1029+ remote_parent_not_sampled_path ,
1030+ remote_parent_not_sampled_setting ,
1031+ ):
10241032 if self ._remote_parent_sampled is None :
10251033 config = "default" # Use sampling algo.
10261034 _logger .debug ("Sampling decision made based on no remote parent sampling decision present." )
10271035 elif self ._remote_parent_sampled :
10281036 setting_path = remote_parent_sampled_path
10291037 config = remote_parent_sampled_setting
1030- _logger .debug ("Sampling decision made based on remote_parent_sampled=%s and %s=%s." , self ._remote_parent_sampled , setting_path , config )
1038+ _logger .debug (
1039+ "Sampling decision made based on remote_parent_sampled=%s and %s=%s." ,
1040+ self ._remote_parent_sampled ,
1041+ setting_path ,
1042+ config ,
1043+ )
10311044 else : # self._remote_parent_sampled is False.
10321045 setting_path = remote_parent_not_sampled_path
10331046 config = remote_parent_not_sampled_setting
1034- _logger .debug ("Sampling decision made based on remote_parent_sampled=%s and %s=%s." , self ._remote_parent_sampled , setting_path , config )
1047+ _logger .debug (
1048+ "Sampling decision made based on remote_parent_sampled=%s and %s=%s." ,
1049+ self ._remote_parent_sampled ,
1050+ setting_path ,
1051+ config ,
1052+ )
10351053 if config == "always_on" :
10361054 sampled = True
10371055 priority = 2.0
@@ -1042,7 +1060,9 @@ def _compute_sampled_and_priority(self, priority, sampled, remote_parent_sampled
10421060 if config not in ("default" , "adaptive" ):
10431061 _logger .warning ("%s=%s is not a recognized value. Using 'default' instead." , setting_path , config )
10441062
1045- _logger .debug ("Let adaptive sampler algorithm decide based on sampled=%s and priority=%s." , sampled , priority )
1063+ _logger .debug (
1064+ "Let adaptive sampler algorithm decide based on sampled=%s and priority=%s." , sampled , priority
1065+ )
10461066 priority , sampled = self .sampling_algo_compute_sampled_and_priority (priority , sampled )
10471067 return priority , sampled
10481068
@@ -1055,14 +1075,18 @@ def _make_sampling_decision(self):
10551075 sampled = self ._sampled
10561076 # Compute sampling decision for full granularity.
10571077 if self .settings .distributed_tracing .sampler .full_granularity .enabled :
1058- _logger .debug ("Full granularity tracing is enabled. Asking if full granularity wants to sample. priority=%s, sampled=%s" , priority , sampled )
1078+ _logger .debug (
1079+ "Full granularity tracing is enabled. Asking if full granularity wants to sample. priority=%s, sampled=%s" ,
1080+ priority ,
1081+ sampled ,
1082+ )
10591083 computed_priority , computed_sampled = self ._compute_sampled_and_priority (
10601084 priority ,
10611085 sampled ,
1062- remote_parent_sampled_path = "distributed_tracing.sampler.full_granularity.remote_parent_sampled" ,
1063- remote_parent_sampled_setting = self .settings .distributed_tracing .sampler .full_granularity .remote_parent_sampled ,
1064- remote_parent_not_sampled_path = "distributed_tracing.sampler.full_granularity.remote_parent_not_sampled" ,
1065- remote_parent_not_sampled_setting = self .settings .distributed_tracing .sampler .full_granularity .remote_parent_not_sampled ,
1086+ remote_parent_sampled_path = "distributed_tracing.sampler.full_granularity.remote_parent_sampled" ,
1087+ remote_parent_sampled_setting = self .settings .distributed_tracing .sampler .full_granularity .remote_parent_sampled ,
1088+ remote_parent_not_sampled_path = "distributed_tracing.sampler.full_granularity.remote_parent_not_sampled" ,
1089+ remote_parent_not_sampled_setting = self .settings .distributed_tracing .sampler .full_granularity .remote_parent_not_sampled ,
10661090 )
10671091 _logger .debug ("Full granularity sampling decision was %s with priority=%s." , sampled , priority )
10681092 if computed_sampled :
@@ -1077,12 +1101,14 @@ def _make_sampling_decision(self):
10771101 self ._priority , self ._sampled = self ._compute_sampled_and_priority (
10781102 priority ,
10791103 sampled ,
1080- remote_parent_sampled_path = "distributed_tracing.sampler.partial_granularity.remote_parent_sampled" ,
1081- remote_parent_sampled_setting = self .settings .distributed_tracing .sampler .partial_granularity .remote_parent_sampled ,
1082- remote_parent_not_sampled_path = "distributed_tracing.sampler.partial_granularity.remote_parent_not_sampled" ,
1083- remote_parent_not_sampled_setting = self .settings .distributed_tracing .sampler .partial_granularity .remote_parent_not_sampled ,
1104+ remote_parent_sampled_path = "distributed_tracing.sampler.partial_granularity.remote_parent_sampled" ,
1105+ remote_parent_sampled_setting = self .settings .distributed_tracing .sampler .partial_granularity .remote_parent_sampled ,
1106+ remote_parent_not_sampled_path = "distributed_tracing.sampler.partial_granularity.remote_parent_not_sampled" ,
1107+ remote_parent_not_sampled_setting = self .settings .distributed_tracing .sampler .partial_granularity .remote_parent_not_sampled ,
1108+ )
1109+ _logger .debug (
1110+ "Partial granularity sampling decision was %s with priority=%s." , self ._sampled , self ._priority
10841111 )
1085- _logger .debug ("Partial granularity sampling decision was %s with priority=%s." , self ._sampled , self ._priority )
10861112 self ._sampling_decision_made = True
10871113 if self ._sampled :
10881114 self .partial_granularity_sampled = True
0 commit comments