File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
sentry_sdk/integrations/opentelemetry Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -143,18 +143,18 @@ def should_sample(
143143 # Check if there is a traces_sample_rate
144144 sample_rate = client .options .get ("traces_sample_rate" )
145145
146- # Down-sample in case of back pressure monitor says so
147- # TODO: this should only be done for transactions (aka root spans)
148- if client .monitor :
149- sample_rate /= 2 ** client .monitor .downsample_factor
150-
151146 # If the sample rate is invalid, drop the span
152147 if not is_valid_sample_rate (sample_rate , source = self .__class__ .__name__ ):
153148 logger .warning (
154149 f"[Tracing] Discarding { name } because of invalid sample rate."
155150 )
156151 return dropped_result (parent_span_context , attributes )
157152
153+ # Down-sample in case of back pressure monitor says so
154+ # TODO: this should only be done for transactions (aka root spans)
155+ if client .monitor :
156+ sample_rate /= 2 ** client .monitor .downsample_factor
157+
158158 # Roll the dice on sample rate
159159 sample_rate = float (cast ("Union[bool, float, int]" , sample_rate ))
160160 sampled = random .random () < sample_rate
You can’t perform that action at this time.
0 commit comments