Skip to content

Commit cdd1345

Browse files
committed
remove unnecessary logging
1 parent 7915e95 commit cdd1345

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

src/scout_apm/core/sampler.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def __init__(self, config):
2929
config: ScoutConfig instance containing sampling configuration
3030
"""
3131
self.config = config
32-
# Load sampling configuration
3332
self.sample_rate = config.value("sample_rate")
3433
self.sample_endpoints = config.value("sample_endpoints")
3534
self.sample_jobs = config.value("sample_jobs")
@@ -61,7 +60,6 @@ def _get_matching_pattern(
6160
matching_pattern = None
6261
longest_match = 0
6362

64-
# Only look at wildcard patterns
6563
wildcard_patterns = [p for p in patterns if "*" in p]
6664
for pattern in wildcard_patterns:
6765
if pattern.endswith("*"):
@@ -113,21 +111,17 @@ def get_effective_sample_rate(self, operation: str) -> int:
113111
return self.sample_rate # Fall back to global rate for unknown operations
114112

115113
if op_type == "endpoint":
116-
# Check if endpoint should be ignored
117114
if name in self.ignore_endpoints:
118115
return 0
119116

120-
# Find matching endpoint pattern
121117
matching_pattern = self._get_matching_pattern(name, self.sample_endpoints)
122118
if matching_pattern:
123119
return self.sample_endpoints[matching_pattern]
124120

125121
else: # op_type == 'job'
126-
# Check if job should be ignored
127122
if name in self.ignore_jobs:
128123
return 0
129124

130-
# Find matching job pattern
131125
matching_pattern = self._get_matching_pattern(name, self.sample_jobs)
132126
if matching_pattern:
133127
logger.debug(f"Matching job pattern: {matching_pattern}")
@@ -148,11 +142,4 @@ def should_sample(self, operation: str) -> bool:
148142
Returns:
149143
Boolean indicating whether to sample this operation
150144
"""
151-
rate = self.get_effective_sample_rate(operation)
152-
rand = random.randint(1, 100)
153-
result = rand <= rate
154-
155-
logger.debug(
156-
f"Sampling decision for {operation}: {result} rand: {rand} (rate: {rate})"
157-
)
158-
return result
145+
return random.randint(1, 100) <= self.get_effective_sample_rate(operation)

0 commit comments

Comments
 (0)