statsd-instrument 2.3.0.beta2 → 2.3.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/statsd/instrument.rb +1 -1
- data/lib/statsd/instrument/version.rb +1 -1
- data/test/statsd_instrumentation_test.rb +40 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fed77a70470567d6ed49c57a482ca7e7f89dc93
|
4
|
+
data.tar.gz: 007f5373e64aa4a4ff2b082430fe4a8f1f65a10d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f2adb3365c37f6fb8a5abcea906b5f50e6f8cc7be751216680a1dcae0a453ddf39c36ee69066bccb995345b2102f7f68fdbd53284887a3d1d7f32ad46aa5133
|
7
|
+
data.tar.gz: 74948e391f080f3706bfb394f120f7eb3d9f9eabe410667257545426711ecef178162f666cd9f97a87365a32e382742a0bd48d0a79459461f4590757c8f7f0fd
|
data/lib/statsd/instrument.rb
CHANGED
@@ -82,7 +82,7 @@ module StatsD
|
|
82
82
|
def statsd_measure(method, name, *metric_options)
|
83
83
|
add_to_method(method, name, :measure) do
|
84
84
|
define_method(method) do |*args, &block|
|
85
|
-
StatsD.measure(StatsD::Instrument.generate_metric_name(name, self, *args),
|
85
|
+
StatsD.measure(StatsD::Instrument.generate_metric_name(name, self, *args), *metric_options) { super(*args, &block) }
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -225,6 +225,46 @@ class StatsDInstrumentationTest < Minitest::Test
|
|
225
225
|
ActiveMerchant::Base.statsd_remove_measure :post_with_block, 'ActiveMerchant.Base.post_with_block'
|
226
226
|
end
|
227
227
|
|
228
|
+
def test_statsd_measure_with_value
|
229
|
+
ActiveMerchant::UniqueGateway.statsd_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post', 1
|
230
|
+
|
231
|
+
assert_statsd_measure('ActiveMerchant.Gateway.ssl_post') do
|
232
|
+
ActiveMerchant::UniqueGateway.new.purchase(true)
|
233
|
+
end
|
234
|
+
ensure
|
235
|
+
ActiveMerchant::UniqueGateway.statsd_remove_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post'
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_statsd_measure_with_value_and_options
|
239
|
+
ActiveMerchant::UniqueGateway.statsd_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post', 1, sample_rate: 0.45
|
240
|
+
|
241
|
+
assert_statsd_measure('ActiveMerchant.Gateway.ssl_post', sample_rate: 0.45) do
|
242
|
+
ActiveMerchant::UniqueGateway.new.purchase(true)
|
243
|
+
end
|
244
|
+
ensure
|
245
|
+
ActiveMerchant::UniqueGateway.statsd_remove_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post'
|
246
|
+
end
|
247
|
+
|
248
|
+
def test_statsd_measure_with_value_and_distribution
|
249
|
+
ActiveMerchant::UniqueGateway.statsd_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post', 1, as_dist: true
|
250
|
+
|
251
|
+
assert_statsd_distribution('ActiveMerchant.Gateway.ssl_post') do
|
252
|
+
ActiveMerchant::UniqueGateway.new.purchase(true)
|
253
|
+
end
|
254
|
+
ensure
|
255
|
+
ActiveMerchant::UniqueGateway.statsd_remove_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post'
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_statsd_measure_without_value_as_distribution
|
259
|
+
ActiveMerchant::UniqueGateway.statsd_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post', as_dist: true
|
260
|
+
|
261
|
+
assert_statsd_distribution('ActiveMerchant.Gateway.ssl_post') do
|
262
|
+
ActiveMerchant::UniqueGateway.new.purchase(true)
|
263
|
+
end
|
264
|
+
ensure
|
265
|
+
ActiveMerchant::UniqueGateway.statsd_remove_measure :ssl_post, 'ActiveMerchant.Gateway.ssl_post'
|
266
|
+
end
|
267
|
+
|
228
268
|
def test_instrumenting_class_method
|
229
269
|
ActiveMerchant::Gateway.singleton_class.extend StatsD::Instrument
|
230
270
|
ActiveMerchant::Gateway.singleton_class.statsd_count :sync, 'ActiveMerchant.Gateway.sync'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsd-instrument
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.0.
|
4
|
+
version: 2.3.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Storimer
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|