statsd-instrument 2.0.0beta → 2.0.0beta2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d50bba4fad7c7d60e2272ec23888004b0cbebbd1
4
- data.tar.gz: b36122aa5c275370c1a0e3e9edd3803321a4a960
3
+ metadata.gz: 0754302b0628e373af2d790101ab5e9d687494d8
4
+ data.tar.gz: 8cf3646796b5b0e7569f772e0da663d442f58cf9
5
5
  SHA512:
6
- metadata.gz: 0e060d63fb216442bd387a131adca06326560aec60813efe34a608182b5066e698fdf217f13bee3ffbdcd8489e105079b0e99aca507729627a73014b5e2749e6
7
- data.tar.gz: 39f3c512927e0c8ac41ff7c21936853d1d7e048b02ed3030c2c21bd67e3f07f703d6093fa54062617e102b9b273a809c23c218675b1a6280b349a46f71630856
6
+ metadata.gz: 816a88ac56220bb3da7f947f8d462c6ca14c5debe3d5c011a03cb3cbc4aa1e832088585dc0430efa8dfa5ec9f138a268505f41ca8a85ecaf63c981f316905398
7
+ data.tar.gz: 49283deaa25ce88057610481c8efe052a4cd847c43bf39399934f432cd177546868096fb6780bb02107c2371c80e4ca4fe8a5065ad1a334683d07d44e2a990a3
data/README.md CHANGED
@@ -46,7 +46,7 @@ The other available settings, with their default, are
46
46
  # Logger to which commands are logged when using the LoggerBackend, which is
47
47
  # the default in development environment. Also, any errors or warnings will
48
48
  # be logged here.
49
- StatsD.logger = defiend?(Rails) : Rails.logger ? Logger.new($stderr)
49
+ StatsD.logger = defined?(Rails) ? Rails.logger : Logger.new($stderr)
50
50
 
51
51
  # An optional prefix to be added to each metric.
52
52
  StatsD.prefix = nil # but can be set to any string
@@ -211,7 +211,7 @@ warning is logged to `StatsD.logger`.
211
211
 
212
212
  ## Testing
213
213
 
214
- This library come swith a module called `StatsD::Instrument::Assertions` to help you write tests
214
+ This library comes with a module called `StatsD::Instrument::Assertions` to help you write tests
215
215
  to verify StatsD is called properly.
216
216
 
217
217
  ``` ruby
@@ -123,8 +123,9 @@ module StatsD
123
123
  end
124
124
 
125
125
  result = nil
126
- ms = value || 1000 * Benchmark.realtime { result = block.call }
127
- collect_metric(hash_argument(metric_options).merge(type: :ms, name: key, value: ms))
126
+ value = 1000 * Benchmark.realtime { result = block.call } if block_given?
127
+ metric = collect_metric(hash_argument(metric_options).merge(type: :ms, name: key, value: value))
128
+ result = metric unless block_given?
128
129
  result
129
130
  end
130
131
 
@@ -174,7 +175,8 @@ module StatsD
174
175
  end
175
176
 
176
177
  def collect_metric(options)
177
- backend.collect_metric(StatsD::Instrument::Metric.new(options))
178
+ backend.collect_metric(metric = StatsD::Instrument::Metric.new(options))
179
+ metric
178
180
  end
179
181
  end
180
182
  end
@@ -1,5 +1,5 @@
1
1
  module StatsD
2
2
  module Instrument
3
- VERSION = "2.0.0beta"
3
+ VERSION = "2.0.0beta2"
4
4
  end
5
5
  end
data/test/statsd_test.rb CHANGED
@@ -9,7 +9,9 @@ class StatsDTest < Minitest::Test
9
9
  end
10
10
 
11
11
  def test_statsd_measure_with_explicit_value
12
- metric = capture_statsd_call { StatsD.measure('values.foobar', 42) }
12
+ result = nil
13
+ metric = capture_statsd_call { result = StatsD.measure('values.foobar', 42) }
14
+ assert_equal metric, result
13
15
  assert_equal 'values.foobar', metric.name
14
16
  assert_equal 42, metric.value
15
17
  assert_equal :ms, metric.type
@@ -34,7 +36,9 @@ class StatsDTest < Minitest::Test
34
36
  end
35
37
 
36
38
  def test_statsd_increment
37
- metric = capture_statsd_call { StatsD.increment('values.foobar', 3) }
39
+ result = nil
40
+ metric = capture_statsd_call { result = StatsD.increment('values.foobar', 3) }
41
+ assert_equal metric, result
38
42
  assert_equal :c, metric.type
39
43
  assert_equal 'values.foobar', metric.name
40
44
  assert_equal 3, metric.value
@@ -55,28 +59,36 @@ class StatsDTest < Minitest::Test
55
59
  end
56
60
 
57
61
  def test_statsd_gauge
58
- metric = capture_statsd_call { StatsD.gauge('values.foobar', 12) }
62
+ result = nil
63
+ metric = capture_statsd_call { result = StatsD.gauge('values.foobar', 12) }
64
+ assert_equal metric, result
59
65
  assert_equal :g, metric.type
60
66
  assert_equal 'values.foobar', metric.name
61
67
  assert_equal 12, metric.value
62
68
  end
63
69
 
64
70
  def test_statsd_set
65
- metric = capture_statsd_call { StatsD.set('values.foobar', 'unique_identifier') }
71
+ result = nil
72
+ metric = capture_statsd_call { result = StatsD.set('values.foobar', 'unique_identifier') }
73
+ assert_equal metric, result
66
74
  assert_equal :s, metric.type
67
75
  assert_equal 'values.foobar', metric.name
68
76
  assert_equal 'unique_identifier', metric.value
69
77
  end
70
78
 
71
79
  def test_statsd_histogram
72
- metric = capture_statsd_call { StatsD.histogram('values.foobar', 42) }
80
+ result = nil
81
+ metric = capture_statsd_call { result = StatsD.histogram('values.foobar', 42) }
82
+ assert_equal metric, result
73
83
  assert_equal :h, metric.type
74
84
  assert_equal 'values.foobar', metric.name
75
85
  assert_equal 42, metric.value
76
86
  end
77
87
 
78
88
  def test_statsd_key_value
79
- metric = capture_statsd_call { StatsD.key_value('values.foobar', 42) }
89
+ result = nil
90
+ metric = capture_statsd_call { result = StatsD.key_value('values.foobar', 42) }
91
+ assert_equal metric, result
80
92
  assert_equal :kv, metric.type
81
93
  assert_equal 'values.foobar', metric.name
82
94
  assert_equal 42, metric.value
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.0.0beta
4
+ version: 2.0.0beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Storimer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-15 00:00:00.000000000 Z
12
+ date: 2014-04-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake