solarwinds_apm 7.0.1 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/solarwinds_apm/config.rb +3 -18
- data/lib/solarwinds_apm/sampling/token_bucket.rb +16 -27
- data/lib/solarwinds_apm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a5971dc87577f87109a1c774b68f804a6d91d95a14f23693efeeab6aa30663a
|
|
4
|
+
data.tar.gz: db9a7966cf2df759688617366ff07ed94d59821c5ae671fa803c15ccb10e7bb5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 886156c1e22aed57662fc1bbb9ff71b3d45be55557980cc1cdcb83fb40087dfa981f28db16379e88090ceabcd0f3a8ecf085e7f4928be33f373be15f9aeed63b
|
|
7
|
+
data.tar.gz: e793b950bef565ff82d585e4cfd1bf43903ac22ecc49c0dc13c15b3b91459463fbc6428822c1f7c54c12c9c1427aff99f6621dc30c73d5e0d3229b7e3b8cfae4
|
|
@@ -181,29 +181,14 @@ module SolarWindsAPM
|
|
|
181
181
|
case key
|
|
182
182
|
when :sampling_rate
|
|
183
183
|
SolarWindsAPM.logger.warn do
|
|
184
|
-
|
|
184
|
+
'[Deprecated] sampling_rate is not a supported setting for SolarWindsAPM::Config.'
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
when :sample_rate
|
|
188
|
-
|
|
189
|
-
SolarWindsAPM.
|
|
190
|
-
"[#{name}/#{__method__}] :sample_rate must be a number between 0 and 1000000 (1m) (provided: #{value}), corrected to 0"
|
|
191
|
-
end
|
|
192
|
-
value = 0
|
|
193
|
-
end
|
|
194
|
-
|
|
195
|
-
# Validate :sample_rate value
|
|
196
|
-
unless value.between?(0, 1e6)
|
|
197
|
-
new_value = value.negative? ? 0 : 1_000_000
|
|
198
|
-
SolarWindsAPM.logger.warn do
|
|
199
|
-
"[#{name}/#{__method__}] :sample_rate must be between 0 and 1000000 (1m) (provided: #{value}), corrected to #{new_value}"
|
|
200
|
-
end
|
|
188
|
+
SolarWindsAPM.logger.warn do
|
|
189
|
+
'[Deprecated] sample_rate is not a supported setting for SolarWindsAPM::Config.'
|
|
201
190
|
end
|
|
202
191
|
|
|
203
|
-
# Assure value is an integer
|
|
204
|
-
@@config[key.to_sym] = new_value.to_i
|
|
205
|
-
SolarWindsAPM.sample_rate(new_value)
|
|
206
|
-
|
|
207
192
|
when :transaction_settings
|
|
208
193
|
compile_settings(value)
|
|
209
194
|
|
|
@@ -23,9 +23,10 @@ module SolarWindsAPM
|
|
|
23
23
|
@timer = nil
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# oboe sampler update_settings will update the token
|
|
27
|
+
# (thread safe as update_settings is guarded by mutex from oboe sampler)
|
|
27
28
|
def update(settings)
|
|
28
|
-
settings.instance_of?(Hash) ? update_from_hash(settings) :
|
|
29
|
+
settings.instance_of?(Hash) ? update_from_hash(settings) : update_from_hash(tb_to_hash(settings))
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def update_from_hash(settings)
|
|
@@ -36,32 +37,13 @@ module SolarWindsAPM
|
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
self.rate = settings[:rate] if settings[:rate]
|
|
39
|
-
|
|
40
|
-
return unless settings[:interval]
|
|
41
|
-
|
|
42
|
-
self.interval = settings[:interval]
|
|
43
|
-
return unless running
|
|
44
|
-
|
|
45
|
-
stop
|
|
46
40
|
start
|
|
47
41
|
end
|
|
48
42
|
|
|
49
|
-
def
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
self.tokens = @tokens + difference
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
self.rate = settings.rate if settings.rate
|
|
57
|
-
|
|
58
|
-
return unless settings.interval
|
|
59
|
-
|
|
60
|
-
self.interval = settings.interval
|
|
61
|
-
return unless running
|
|
62
|
-
|
|
63
|
-
stop
|
|
64
|
-
start
|
|
43
|
+
def tb_to_hash(settings)
|
|
44
|
+
{ capacity: settings.capacity,
|
|
45
|
+
rate: settings.rate,
|
|
46
|
+
interval: settings.interval }
|
|
65
47
|
end
|
|
66
48
|
|
|
67
49
|
def capacity=(capacity)
|
|
@@ -72,8 +54,11 @@ module SolarWindsAPM
|
|
|
72
54
|
@rate = [0, rate].max
|
|
73
55
|
end
|
|
74
56
|
|
|
57
|
+
# self.interval= sets the @interval and @sleep_interval
|
|
58
|
+
# @sleep_interval is used in the timer thread to sleep between replenishing the bucket
|
|
75
59
|
def interval=(interval)
|
|
76
60
|
@interval = interval.clamp(0, MAX_INTERVAL)
|
|
61
|
+
@sleep_interval = @interval / 1000.0
|
|
77
62
|
end
|
|
78
63
|
|
|
79
64
|
def tokens=(tokens)
|
|
@@ -83,11 +68,15 @@ module SolarWindsAPM
|
|
|
83
68
|
# Attempts to consume tokens from the bucket
|
|
84
69
|
# @param n [Integer] Number of tokens to consume
|
|
85
70
|
# @return [Boolean] Whether there were enough tokens
|
|
71
|
+
# TODO: we need to include thread-safety here since sampler is shared across threads
|
|
72
|
+
# and we may have multiple threads trying to consume tokens at the same time
|
|
86
73
|
def consume(token = 1)
|
|
87
74
|
if @tokens >= token
|
|
88
75
|
self.tokens = @tokens - token
|
|
76
|
+
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] Consumed #{token} from total #{@tokens} (#{(@tokens.to_f / @capacity * 100).round(1)}% remaining)" }
|
|
89
77
|
true
|
|
90
78
|
else
|
|
79
|
+
SolarWindsAPM.logger.debug { "[#{self.class}/#{__method__}] Token consumption failed: requested=#{token}, available=#{@tokens}, capacity=#{@capacity}" }
|
|
91
80
|
false
|
|
92
81
|
end
|
|
93
82
|
end
|
|
@@ -99,7 +88,7 @@ module SolarWindsAPM
|
|
|
99
88
|
@timer = Thread.new do
|
|
100
89
|
loop do
|
|
101
90
|
task
|
|
102
|
-
sleep(@
|
|
91
|
+
sleep(@sleep_interval)
|
|
103
92
|
end
|
|
104
93
|
end
|
|
105
94
|
end
|
|
@@ -114,7 +103,7 @@ module SolarWindsAPM
|
|
|
114
103
|
|
|
115
104
|
# Whether the bucket is actively being replenished
|
|
116
105
|
def running
|
|
117
|
-
!@timer.nil?
|
|
106
|
+
!@timer.nil? && @timer.alive?
|
|
118
107
|
end
|
|
119
108
|
|
|
120
109
|
private
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solarwinds_apm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.0.
|
|
4
|
+
version: 7.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maia Engeli
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2025-
|
|
14
|
+
date: 2025-12-08 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: opentelemetry-exporter-otlp
|