scout_apm 6.0.1 → 6.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/CHANGELOG.markdown +10 -0
- data/gems/sidekiq8.gemfile +1 -0
- data/gems/sqlite3-v2.gemfile +1 -0
- data/lib/scout_apm/config.rb +4 -2
- data/lib/scout_apm/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/unit/config_test.rb +60 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af813ad30f40b8cee3cb1e50c8b6ca311c8347d0431d18c6e5ce0939cda174e5
|
|
4
|
+
data.tar.gz: d9baccb3c23a1c45571503349ddbc4dc4de4f0e48fbf10ee7fd40ce7f7b76b2f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d08de0c4f24ca6d8385a381705134baff6c5b65463f4775d78eae4c03bdc91195acfb24edf666743cf2e3064b20780251f345b6b4e02ac658e7841633986f51
|
|
7
|
+
data.tar.gz: ef12b4f094e373c5769e79c55a047b1b90db1a236fdcce4a23aacd657b5703127b662549cc56e92f72172e4e5732c99a8f769376df0a231411dbcf3f7e71d253
|
data/CHANGELOG.markdown
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
# 6.0.2
|
|
2
|
+
- Fix `endpoint_sample_rate` and `job_sample_rate` to support float values
|
|
3
|
+
|
|
1
4
|
# 6.0.1
|
|
2
5
|
- Fix capturing of job params for non ActiveJob
|
|
3
6
|
|
|
4
7
|
# 6.0.0
|
|
8
|
+
|
|
9
|
+
**Breaking Change**
|
|
10
|
+
Sampling configuration options now take `float` arguments between `0.0` and `1.0`. This means
|
|
11
|
+
you can now set sample rates lower than one. Backwards compatibility is maintained for
|
|
12
|
+
existing config > 1 by converting to a percentage internally. **If your endpoint is
|
|
13
|
+
sampled at exactly 1%, you must now set `0.01` instead of `1`.**
|
|
14
|
+
|
|
5
15
|
- Add Prism AutoInstruments Support (#582) (#594)
|
|
6
16
|
- Add OpenSearch instrumentation (#563)
|
|
7
17
|
- Add HTTPX instrumentation (#588)
|
data/gems/sidekiq8.gemfile
CHANGED
data/gems/sqlite3-v2.gemfile
CHANGED
data/lib/scout_apm/config.rb
CHANGED
|
@@ -213,6 +213,8 @@ module ScoutApm
|
|
|
213
213
|
|
|
214
214
|
class SampleRateCoercion
|
|
215
215
|
def coerce(val)
|
|
216
|
+
return nil if val.nil?
|
|
217
|
+
return nil if val.to_s.strip.empty?
|
|
216
218
|
v = val.to_f
|
|
217
219
|
# Anything above 1 is assumed a percentage for backwards compat, so convert to a decimal
|
|
218
220
|
if v > 1
|
|
@@ -252,8 +254,8 @@ module ScoutApm
|
|
|
252
254
|
'sample_rate' => SampleRateCoercion.new,
|
|
253
255
|
'sample_endpoints' => JsonCoercion.new,
|
|
254
256
|
'sample_jobs' => JsonCoercion.new,
|
|
255
|
-
'endpoint_sample_rate' =>
|
|
256
|
-
'job_sample_rate' =>
|
|
257
|
+
'endpoint_sample_rate' => SampleRateCoercion.new,
|
|
258
|
+
'job_sample_rate' => SampleRateCoercion.new,
|
|
257
259
|
'start_resque_server_instrument' => BooleanCoercion.new,
|
|
258
260
|
'timeline_traces' => BooleanCoercion.new,
|
|
259
261
|
'auto_instruments' => BooleanCoercion.new,
|
data/lib/scout_apm/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
data/test/unit/config_test.rb
CHANGED
|
@@ -94,15 +94,24 @@ class ConfigTest < Minitest::Test
|
|
|
94
94
|
|
|
95
95
|
def test_sample_rate_coercion
|
|
96
96
|
coercion = ScoutApm::Config::SampleRateCoercion.new
|
|
97
|
+
# Preserves nil and empty strings
|
|
98
|
+
assert_nil coercion.coerce(nil)
|
|
99
|
+
assert_nil coercion.coerce("")
|
|
100
|
+
assert_nil coercion.coerce(" ")
|
|
101
|
+
# Float strings work
|
|
97
102
|
assert_in_delta 1.0, coercion.coerce("1")
|
|
98
103
|
assert_in_delta 0.015, coercion.coerce("1.5")
|
|
104
|
+
assert_in_delta 0.5, coercion.coerce("0.5")
|
|
105
|
+
assert_in_delta 0.01, coercion.coerce("0.01")
|
|
106
|
+
# Numbers work
|
|
99
107
|
assert_in_delta 1.0, coercion.coerce(1)
|
|
100
108
|
assert_in_delta 0.015, coercion.coerce(1.5)
|
|
101
109
|
assert_in_delta 0.0, coercion.coerce("0")
|
|
102
110
|
assert_in_delta 0.0, coercion.coerce(0)
|
|
103
|
-
|
|
104
|
-
assert_in_delta 0.
|
|
105
|
-
assert_in_delta 0.
|
|
111
|
+
# Backwards compatibility: values > 1 treated as percentages
|
|
112
|
+
assert_in_delta 0.15, coercion.coerce("15")
|
|
113
|
+
assert_in_delta 0.15, coercion.coerce(15)
|
|
114
|
+
# Clamping
|
|
106
115
|
assert_in_delta 0, coercion.coerce("-2.5")
|
|
107
116
|
end
|
|
108
117
|
|
|
@@ -116,4 +125,52 @@ class ConfigTest < Minitest::Test
|
|
|
116
125
|
conf = ScoutApm::Config.with_file(@context, "a_file_that_doesnt_exist.yml")
|
|
117
126
|
assert conf.any_keys_found?
|
|
118
127
|
end
|
|
128
|
+
|
|
129
|
+
def test_endpoint_sample_rate_from_env_with_float_string
|
|
130
|
+
ENV['SCOUT_ENDPOINT_SAMPLE_RATE'] = '0.01'
|
|
131
|
+
conf = ScoutApm::Config.without_file(@context)
|
|
132
|
+
assert_in_delta 0.01, conf.value('endpoint_sample_rate')
|
|
133
|
+
ensure
|
|
134
|
+
ENV.delete('SCOUT_ENDPOINT_SAMPLE_RATE')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_job_sample_rate_from_env_with_float_string
|
|
138
|
+
ENV['SCOUT_JOB_SAMPLE_RATE'] = '0.01'
|
|
139
|
+
conf = ScoutApm::Config.without_file(@context)
|
|
140
|
+
assert_in_delta 0.01, conf.value('job_sample_rate')
|
|
141
|
+
ensure
|
|
142
|
+
ENV.delete('SCOUT_JOB_SAMPLE_RATE')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def test_endpoint_sample_rate_backwards_compat_with_percentage
|
|
146
|
+
# Values > 1 should be treated as percentages for backwards compatibility
|
|
147
|
+
ENV['SCOUT_ENDPOINT_SAMPLE_RATE'] = '15'
|
|
148
|
+
conf = ScoutApm::Config.without_file(@context)
|
|
149
|
+
assert_in_delta 0.15, conf.value('endpoint_sample_rate')
|
|
150
|
+
ensure
|
|
151
|
+
ENV.delete('SCOUT_ENDPOINT_SAMPLE_RATE')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def test_job_sample_rate_backwards_compat_with_percentage
|
|
155
|
+
# Values > 1 should be treated as percentages for backwards compatibility
|
|
156
|
+
ENV['SCOUT_JOB_SAMPLE_RATE'] = '15'
|
|
157
|
+
conf = ScoutApm::Config.without_file(@context)
|
|
158
|
+
assert_in_delta 0.15, conf.value('job_sample_rate')
|
|
159
|
+
ensure
|
|
160
|
+
ENV.delete('SCOUT_JOB_SAMPLE_RATE')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def test_endpoint_sample_rate_nil_when_not_set
|
|
164
|
+
# Nil allows sampling to fall through to global sample_rate
|
|
165
|
+
ENV.delete('SCOUT_ENDPOINT_SAMPLE_RATE')
|
|
166
|
+
conf = ScoutApm::Config.without_file(@context)
|
|
167
|
+
assert_nil conf.value('endpoint_sample_rate')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def test_job_sample_rate_nil_when_not_set
|
|
171
|
+
# Nil allows sampling to fall through to global sample_rate
|
|
172
|
+
ENV.delete('SCOUT_JOB_SAMPLE_RATE')
|
|
173
|
+
conf = ScoutApm::Config.without_file(@context)
|
|
174
|
+
assert_nil conf.value('job_sample_rate')
|
|
175
|
+
end
|
|
119
176
|
end
|