measurometer 1.2.0 → 1.3.0

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: 145560329721f78f9988635eb5bbfcdeffd37ddaf3a5a14e2cf5891f76b94544
4
- data.tar.gz: a59156c128ce042aeb54ef08c94c8786aeed80456a2c38ea2a892861d0cd1642
3
+ metadata.gz: 29dcab627b5e7f4c4ed909b8d9fa740cdcb3c1ab038a8b288d3ac48fc49fe189
4
+ data.tar.gz: 03d734f978f1e76fa6e87af71b5859d258b51eebc579046abe3f2b4200a27cb1
5
5
  SHA512:
6
- metadata.gz: 667108345d55245fed14812c07608f2fde96d6455e92d14be8dd2e56a9a298c82464703a46e42e349a670277197adc6b105239e5c89711161bc6f9cabf0efff4
7
- data.tar.gz: c24c904cee40f2be10bbadba2aafe3c91b1e973782597678ad9e87cd7920a66a77b897c11739c961edf7c7ef10f990dc2d7ccb15adee68305c372ef0bbf5b10b
6
+ metadata.gz: d3b707c8511e4708fe75fc84d19335e59816ae896334b15781b0075b970515090d661bc44949d5c4fc11595c5e8aff1818c3b92622748721c9616439c275a2a6
7
+ data.tar.gz: 469e275e66e13485347d75dd9a855552b8c29ec4306bb187093ed0126a4999bddd3715ffbe12e8d4fa1f45b00c4633b9d7ed0d4bbdc1d93476bfbd9c06abcaff
data/CHANGELOG.md CHANGED
@@ -1,7 +1,24 @@
1
+ # 1.3.0
2
+
3
+ * Adds support to set a tag on Appsignal in `add_distribution_value` as well (in addition to gauges and counters)
4
+
1
5
  # 1.2.0
2
6
 
3
7
  * Adds support to set a tag on Appsignal in methods `increment_counter` and `set_gauge`
4
8
 
9
+ **Warning**: this version introduced a breaking change. It will be necessary to
10
+ add the new 3rd argument to the methods `#increment_counter` and `#set_gauge` if you
11
+ have a custom driver defined in your application, for example:
12
+
13
+ ```diff
14
+ -class CustomDriver
15
+ - def increment_counter(counter_name, by)
16
+ - def set_gauge(gauge_name, value)
17
+ +class CustomDriver
18
+ + def increment_counter(counter_name, by, _tags={})
19
+ + def set_gauge(gauge_name, value, _tags={})
20
+ ```
21
+
5
22
  # 1.1.1
6
23
 
7
24
  * Automatically convert metric and instrumentation block names to Strings, since i.e.
data/lib/measurometer.rb CHANGED
@@ -60,9 +60,10 @@ module Measurometer
60
60
  #
61
61
  # @param value_path[String] under which path to push the metric
62
62
  # @param value[Numeric] distribution value
63
+ # @param tags[Hash] tags for the sample
63
64
  # @return nil
64
- def add_distribution_value(value_path, value)
65
- @drivers.each { |d| d.add_distribution_value(value_path.to_s, value) }
65
+ def add_distribution_value(value_path, value, tags = {})
66
+ @drivers.each { |d| d.add_distribution_value(value_path.to_s, value, tags) }
66
67
  nil
67
68
  end
68
69
 
@@ -71,7 +72,7 @@ module Measurometer
71
72
  # @param counter_path[String] under which path to push the metric
72
73
  # @param by[Integer] the counter increment to apply
73
74
  # @return nil
74
- def increment_counter(counter_path, by = 1, tags={})
75
+ def increment_counter(counter_path, by = 1, tags = {})
75
76
  @drivers.each { |d| d.increment_counter(counter_path.to_s, by, tags) }
76
77
  nil
77
78
  end
@@ -81,7 +82,7 @@ module Measurometer
81
82
  # @param gauge_name[String] under which path to push the metric
82
83
  # @param value[Integer] the absolute value of the gauge
83
84
  # @return nil
84
- def set_gauge(gauge_name, value, tags={})
85
+ def set_gauge(gauge_name, value, tags = {})
85
86
  @drivers.each { |d| d.set_gauge(gauge_name.to_s, value, tags) }
86
87
  nil
87
88
  end
@@ -17,15 +17,15 @@ module Measurometer
17
17
  end
18
18
  end
19
19
 
20
- def increment_counter(counter_name, by, _tags={})
20
+ def increment_counter(counter_name, by, _tags = {})
21
21
  @statsd_client.increment(counter_name, by)
22
22
  end
23
23
 
24
- def add_distribution_value(key_path, value)
24
+ def add_distribution_value(key_path, value, _tags = {})
25
25
  @statsd_client.count(key_path, value)
26
26
  end
27
27
 
28
- def set_gauge(gauge_name, value, _tags={})
28
+ def set_gauge(gauge_name, value, _tags = {})
29
29
  @statsd_client.gauge(gauge_name, value)
30
30
  end
31
31
 
@@ -1,3 +1,3 @@
1
1
  module Measurometer
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
data/measurometer.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Measurometer::VERSION
9
9
  spec.authors = ['Julik Tarkhanov']
10
10
  spec.email = ['me@julik.nl']
11
- spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
11
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
12
12
 
13
13
  spec.summary = 'Minimum viable API for instrumentation in libraries'
14
14
  spec.description = 'Minimum viable API for instrumentation in libraries. Source metrics from your libraries to Measurometer, pick them up on the other end in the application, centrally.'
@@ -39,12 +39,21 @@ RSpec.describe Measurometer do
39
39
  describe '.add_distribution_value' do
40
40
  it 'converts the metric name to a String before passing it to the driver' do
41
41
  driver = double
42
- expect(driver).to receive(:add_distribution_value).with('bar_intensity', 114.4)
42
+ expect(driver).to receive(:add_distribution_value).with('bar_intensity', 114.4, {})
43
43
 
44
44
  Measurometer.drivers << driver
45
45
  result = Measurometer.add_distribution_value(:bar_intensity, 114.4)
46
46
  expect(result).to be_nil
47
47
  end
48
+
49
+ it 'accepts tags and passes them through' do
50
+ driver = double
51
+ expect(driver).to receive(:add_distribution_value).with('bar_intensity', 114.4, host: 'server1')
52
+
53
+ Measurometer.drivers << driver
54
+ result = Measurometer.add_distribution_value(:bar_intensity, 114.4, host: 'server1')
55
+ expect(result).to be_nil
56
+ end
48
57
  end
49
58
 
50
59
  describe '.increment_counter' do
@@ -142,17 +151,17 @@ RSpec.describe Measurometer do
142
151
  end
143
152
  end
144
153
 
145
- def add_distribution_value(value_path, value)
154
+ def add_distribution_value(value_path, value, _tags = {})
146
155
  @distributions ||= []
147
156
  @distributions << [value_path, value]
148
157
  end
149
158
 
150
- def increment_counter(value_path, value, tags={})
159
+ def increment_counter(value_path, value, _tags = {})
151
160
  @counters ||= []
152
161
  @counters << [value_path, value]
153
162
  end
154
163
 
155
- def set_gauge(value_path, value, tags={})
164
+ def set_gauge(value_path, value, _tags = {})
156
165
  @gauges ||= []
157
166
  @gauges << [value_path, value]
158
167
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: measurometer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler