measurometer 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bed7af6551956d2c161adbec8ab339f32d9defdcecfd9e6dc3abd8eb0efbfd1e
4
- data.tar.gz: 619b62ec3174855e0a8df68c74627603af45aae59bd92b4f8cbac951312b6706
3
+ metadata.gz: df51b60bd2fe7c7c02cbd31be5729b6ecf73f4bd648f1fb423bc493510555215
4
+ data.tar.gz: a92627ad8a3e285b5848a2295cc0ae5fd76082adc26dcf927aaed7314fe34013
5
5
  SHA512:
6
- metadata.gz: 410bd21ed1c2a692bcd6c85fc933a07152e7370f469585b0814c8bd3311f411a5fb0649f26755ee37191ef85ac3055e2ad0239c639b4a76be2cfa548d28e8b7a
7
- data.tar.gz: 41f293885d10f06b50fc0332559920f8b16e5e7e0c2f14100cf2577ccceda316af673a2aaf4f242f3a7d28810b4b975d5a753d25c214a1dc2ade0718267c2f55
6
+ metadata.gz: 847d3e71f92b9920736f8ab9f978fe153663368edbf4b78e2bee3d7063e97a18157323f2ff8fcaa3c5931cd4a07075f0cd5dc826803f44789485b4a4fd7db734
7
+ data.tar.gz: 570a3a98e128e02b2f7b1c6e4af64d4e5e78d8ad5a767fb401df9dc8e43212417716409c88049c3655be55be9b075eb6f8e7df78a5e92bfb9de835865289aef1
@@ -1,3 +1,12 @@
1
+ # 1.1.1
2
+
3
+ * Automatically convert metric and instrumentation block names to Strings, since i.e.
4
+ Appsignal cannot deal with Symbol names for those.
5
+
6
+ # 1.1.0
7
+
8
+ * Ensure #increment_counter provides the default increment of 1 to the drivers
9
+
1
10
  # 1.0.0
2
11
 
3
- Initial release
12
+ * Initial release
data/README.md CHANGED
@@ -9,7 +9,7 @@ You for a fact know that this action consists of the following code:
9
9
 
10
10
  ```
11
11
  heavy_model = ModelTree.find(user_id)
12
- prpfligation_outcome = Profilgator.profligate(heavy_model)
12
+ profligation_outcome = Profilgator.profligate(heavy_model)
13
13
  Promulgator.promulgate(profligation_outcome)
14
14
  ```
15
15
 
@@ -50,7 +50,7 @@ module Measurometer
50
50
  blk_with_capture = -> { blk_return_value = blk.call }
51
51
  @drivers.inject(blk_with_capture) { |outer_block, driver|
52
52
  -> {
53
- driver.instrument(block_name, &outer_block)
53
+ driver.instrument(block_name.to_s, &outer_block)
54
54
  }
55
55
  }.call
56
56
  blk_return_value
@@ -62,7 +62,7 @@ module Measurometer
62
62
  # @param value[Numeric] distribution value
63
63
  # @return nil
64
64
  def add_distribution_value(value_path, value)
65
- @drivers.each { |d| d.add_distribution_value(value_path, value) }
65
+ @drivers.each { |d| d.add_distribution_value(value_path.to_s, value) }
66
66
  nil
67
67
  end
68
68
 
@@ -72,7 +72,7 @@ module Measurometer
72
72
  # @param by[Integer] the counter increment to apply
73
73
  # @return nil
74
74
  def increment_counter(counter_path, by = 1)
75
- @drivers.each { |d| d.increment_counter(counter_path, by) }
75
+ @drivers.each { |d| d.increment_counter(counter_path.to_s, by) }
76
76
  nil
77
77
  end
78
78
 
@@ -82,7 +82,7 @@ module Measurometer
82
82
  # @param value[Integer] the absolute value of the gauge
83
83
  # @return nil
84
84
  def set_gauge(gauge_name, value)
85
- @drivers.each { |d| d.set_gauge(gauge_name, value) }
85
+ @drivers.each { |d| d.set_gauge(gauge_name.to_s, value) }
86
86
  nil
87
87
  end
88
88
  end
@@ -1,3 +1,3 @@
1
1
  module Measurometer
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 1'
24
- spec.add_development_dependency 'rake', '~> 10'
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'rake', '~> 12'
25
25
  spec.add_development_dependency 'rspec', '~> 3'
26
26
  spec.add_development_dependency 'wetransfer_style', '0.5.0'
27
27
  end
@@ -17,7 +17,7 @@ describe 'Measurometer::StatsdDriver' do
17
17
  Measurometer.increment_counter('app.some_counter', 2)
18
18
  Measurometer.add_distribution_value('app.some_sample', 42)
19
19
 
20
- expect(statsd).to have_received(:timing) {|block_name, timing_millis|
20
+ expect(statsd).to have_received(:timing) { |block_name, timing_millis|
21
21
  expect(block_name).to eq('some_block.x')
22
22
  expect(timing_millis).to be_within(20).of(200)
23
23
  }
@@ -35,6 +35,52 @@ RSpec.describe Measurometer do
35
35
  end
36
36
  end
37
37
 
38
+ describe '.add_distribution_value' do
39
+ it 'converts the metric name to a String before passing it to the driver' do
40
+ driver = double
41
+ expect(driver).to receive(:add_distribution_value).with('bar_intensity', 114.4)
42
+
43
+ Measurometer.drivers << driver
44
+ result = Measurometer.add_distribution_value(:bar_intensity, 114.4)
45
+ expect(result).to be_nil
46
+ Measurometer.drivers.delete(driver)
47
+ end
48
+ end
49
+
50
+ describe '.increment_counter' do
51
+ it 'increments by 1 by default and converts the counter name to a String before passing it to the driver' do
52
+ driver = double
53
+ expect(driver).to receive(:increment_counter).with('barness', 1)
54
+
55
+ Measurometer.drivers << driver
56
+ result = Measurometer.increment_counter(:barness)
57
+ expect(result).to be_nil
58
+ Measurometer.drivers.delete(driver)
59
+ end
60
+
61
+ it 'passes the increment to the driver' do
62
+ driver = double
63
+ expect(driver).to receive(:increment_counter).with('barness', 123)
64
+
65
+ Measurometer.drivers << driver
66
+ result = Measurometer.increment_counter(:barness, 123)
67
+ expect(result).to be_nil
68
+ Measurometer.drivers.delete(driver)
69
+ end
70
+ end
71
+
72
+ describe '.set_gauge' do
73
+ it 'converts the gauge name to a String before passing it to the driver' do
74
+ driver = double
75
+ expect(driver).to receive(:set_gauge).with('fooeyness', 456)
76
+
77
+ Measurometer.drivers << driver
78
+ result = Measurometer.set_gauge(:fooeyness, 456)
79
+ expect(result).to be_nil
80
+ Measurometer.drivers.delete(driver)
81
+ end
82
+ end
83
+
38
84
  describe '.instrument' do
39
85
  it 'preserves the return value of the block even if one of the drivers swallows it' do
40
86
  bad_driver = Object.new
@@ -51,6 +97,22 @@ RSpec.describe Measurometer do
51
97
 
52
98
  expect(instrument_result).to eq(:block_result)
53
99
  end
100
+
101
+ it 'converts the block name to a String before passing it to the instrumenters' do
102
+ instrumentation_driver = Object.new
103
+ def instrumentation_driver.instrument(block_name)
104
+ raise 'Block name must be a string' unless block_name.is_a?(String)
105
+ yield
106
+ end
107
+
108
+ Measurometer.drivers << instrumentation_driver
109
+ instrument_result = Measurometer.instrument(:foo) do
110
+ :block_result
111
+ end
112
+ Measurometer.drivers.delete(instrumentation_driver)
113
+
114
+ expect(instrument_result).to eq(:block_result)
115
+ end
54
116
  end
55
117
 
56
118
  it 'sources instrumentation to a driver' do
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: measurometer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-17 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10'
33
+ version: '12'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10'
40
+ version: '12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -112,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubyforge_project:
116
- rubygems_version: 2.7.6
115
+ rubygems_version: 3.0.3
117
116
  signing_key:
118
117
  specification_version: 4
119
118
  summary: Minimum viable API for instrumentation in libraries