Skip to content

Commit 0262e1a

Browse files
committed
Fixup: performance
1 parent 21b1b14 commit 0262e1a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

newrelic/api/transaction.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,14 +1051,6 @@ def _make_sampling_decision(self):
10511051
# to send the DT headers. Don't recompute the sampling decision multiple times as it is expensive.
10521052
if hasattr(self, "_sampling_decision_made"):
10531053
return
1054-
# If both full granularty and partial granularity tracing is off set priority=0
1055-
# and do not sample. This enables DT headers to still be sent even if the trace
1056-
# is never sampled.
1057-
if (not self.settings.distributed_tracing.sampler.full_granularity.enabled and
1058-
not self.settings.distributed_tracing.sampler.partial_granularity.enabled):
1059-
self._priority = 0
1060-
self._sampled = False
1061-
return
10621054
priority = self._priority
10631055
sampled = self._sampled
10641056
# Compute sampling decision for full granularity.
@@ -1094,6 +1086,13 @@ def _make_sampling_decision(self):
10941086
self._sampling_decision_made = True
10951087
if self._sampled:
10961088
self.partial_granularity_sampled = True
1089+
return
1090+
1091+
# This is only reachable if both full and partial granularity tracing are off.
1092+
# Set priority=0 and do not sample. This enables DT headers to still be sent
1093+
# even if the trace is never sampled.
1094+
self._priority = 0
1095+
self._sampled = False
10971096

10981097
def _freeze_path(self):
10991098
if self._frozen_path is None:

0 commit comments

Comments
 (0)