statsd-instrument 3.5.7 → 3.5.9

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: 4b7e23789eaa2e8f4589989b748c3bd60b31b6916b58f92a845e96c4876fb6ff
4
- data.tar.gz: d19bcff247d6b3dcabbb9142955c8f1781fd54a7b235ffcae41fb59643babbe0
3
+ metadata.gz: 5b849985c5072f05154d25451f6db9fc1a6c5ca658d14aca02256aab9af99295
4
+ data.tar.gz: e780d3a60c47a278f1862fa5b18593cfdcc87febe6504a6de9c894e1f024ce2b
5
5
  SHA512:
6
- metadata.gz: 3bd9c53e5050773c076b08219965d4c25f509989b3c00ff8fe16c0299e01135b4ca19a02fb7617a5d55737cc776529e865be9f17340f9f8ac406a28562e37f82
7
- data.tar.gz: 9a5edafd0f72d4da58ca5ce1783c36755e99d458aff9d338af1abc583e9d23b1ccc825b192ef9f97b5f519b41d576755e3e797892f55483e3154795089618612
6
+ metadata.gz: 6bc432d02716529829c060a0357de9772af5da0f1a270dcaadb5f014666701888e037917b70e794c265175e807df22bbf7153b43a6a79bf3563c97b1617c038d
7
+ data.tar.gz: 59dceba9b5b0e35d2a96d97e13e2536134e03a8d6116b728fe32d30e80b8e38b95263e5cf853e1d485b7ae0fe94b8d2833929d30ab7513874e737ae62e1562eb
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ section below.
6
6
 
7
7
  ## Unreleased changes
8
8
 
9
+ ## Version 3.5.9
10
+
11
+ - Fix dynamic tags being evaluated only once.
12
+
13
+ ## Version 3.5.8
14
+
15
+ - Allow the `tag_error_class` option for `statsd_count_success` in strict mode.
16
+
9
17
  ## Version 3.5.7
10
18
 
11
19
  - Improve time measurement to avoid seconds to milliseconds conversions.
@@ -114,7 +114,8 @@ module StatsD
114
114
  super
115
115
  end
116
116
 
117
- def statsd_count_success(method, name, sample_rate: nil, tags: nil, no_prefix: false, client: nil)
117
+ def statsd_count_success(method, name, sample_rate: nil, tags: nil, no_prefix: false, client: nil,
118
+ tag_error_class: false)
118
119
  check_method_and_metric_name(method, name)
119
120
  super
120
121
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StatsD
4
4
  module Instrument
5
- VERSION = "3.5.7"
5
+ VERSION = "3.5.9"
6
6
  end
7
7
  end
@@ -79,8 +79,8 @@ module StatsD
79
79
  define_method(method) do |*args, &block|
80
80
  client ||= StatsD.singleton_client
81
81
  key = StatsD::Instrument.generate_metric_name(name, self, *args)
82
- tags = StatsD::Instrument.generate_tags(tags, self, *args)
83
- client.measure(key, sample_rate: sample_rate, tags: tags, no_prefix: no_prefix) do
82
+ generated_tags = StatsD::Instrument.generate_tags(tags, self, *args)
83
+ client.measure(key, sample_rate: sample_rate, tags: generated_tags, no_prefix: no_prefix) do
84
84
  super(*args, &block)
85
85
  end
86
86
  end
@@ -100,8 +100,8 @@ module StatsD
100
100
  define_method(method) do |*args, &block|
101
101
  client ||= StatsD.singleton_client
102
102
  key = StatsD::Instrument.generate_metric_name(name, self, *args)
103
- tags = StatsD::Instrument.generate_tags(tags, self, *args)
104
- client.distribution(key, sample_rate: sample_rate, tags: tags, no_prefix: no_prefix) do
103
+ generated_tags = StatsD::Instrument.generate_tags(tags, self, *args)
104
+ client.distribution(key, sample_rate: sample_rate, tags: generated_tags, no_prefix: no_prefix) do
105
105
  super(*args, &block)
106
106
  end
107
107
  end
@@ -145,10 +145,10 @@ module StatsD
145
145
  client ||= StatsD.singleton_client
146
146
  suffix = truthiness == false ? "failure" : "success"
147
147
  key = StatsD::Instrument.generate_metric_name(name, self, *args)
148
- tags = StatsD::Instrument.generate_tags(tags, self, *args)
149
- tags = Helpers.add_tag(tags, :error_class, error.class.name) if tag_error_class && error
148
+ generated_tags = StatsD::Instrument.generate_tags(tags, self, *args)
149
+ generated_tags = Helpers.add_tag(generated_tags, :error_class, error.class.name) if tag_error_class && error
150
150
 
151
- client.increment("#{key}.#{suffix}", sample_rate: sample_rate, tags: tags, no_prefix: no_prefix)
151
+ client.increment("#{key}.#{suffix}", sample_rate: sample_rate, tags: generated_tags, no_prefix: no_prefix)
152
152
  end
153
153
  end
154
154
  end
@@ -185,8 +185,8 @@ module StatsD
185
185
  if truthiness
186
186
  client ||= StatsD.singleton_client
187
187
  key = StatsD::Instrument.generate_metric_name(name, self, *args)
188
- tags = StatsD::Instrument.generate_tags(tags, self, *args)
189
- client.increment(key, sample_rate: sample_rate, tags: tags, no_prefix: no_prefix)
188
+ generated_tags = StatsD::Instrument.generate_tags(tags, self, *args)
189
+ client.increment(key, sample_rate: sample_rate, tags: generated_tags, no_prefix: no_prefix)
190
190
  end
191
191
  end
192
192
  end
@@ -206,8 +206,8 @@ module StatsD
206
206
  define_method(method) do |*args, &block|
207
207
  client ||= StatsD.singleton_client
208
208
  key = StatsD::Instrument.generate_metric_name(name, self, *args)
209
- tags = StatsD::Instrument.generate_tags(tags, self, *args)
210
- client.increment(key, sample_rate: sample_rate, tags: tags, no_prefix: no_prefix)
209
+ generated_tags = StatsD::Instrument.generate_tags(tags, self, *args)
210
+ client.increment(key, sample_rate: sample_rate, tags: generated_tags, no_prefix: no_prefix)
211
211
  super(*args, &block)
212
212
  end
213
213
  end
@@ -231,6 +231,9 @@ class StatsDInstrumentationTest < Minitest::Test
231
231
  assert_statsd_increment("subgateway.foo", tags: { "key": "foo" }) do
232
232
  GatewaySubClass.new.purchase("foo")
233
233
  end
234
+ assert_statsd_increment("subgateway.bar", tags: { "key": "bar" }) do
235
+ GatewaySubClass.new.purchase("bar")
236
+ end
234
237
  ensure
235
238
  ActiveMerchant::Gateway.statsd_remove_count(:ssl_post, metric_namer)
236
239
  end
@@ -243,6 +246,9 @@ class StatsDInstrumentationTest < Minitest::Test
243
246
  assert_statsd_increment("subgateway.foo", tags: { "key": "foo" }) do
244
247
  GatewaySubClass.new.purchase("foo")
245
248
  end
249
+ assert_statsd_increment("subgateway.bar", tags: { "key": "bar" }) do
250
+ GatewaySubClass.new.purchase("bar")
251
+ end
246
252
  ensure
247
253
  ActiveMerchant::Gateway.statsd_remove_count(:ssl_post, metric_namer)
248
254
  end
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: 3.5.7
4
+ version: 3.5.9
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: 2023-04-12 00:00:00.000000000 Z
13
+ date: 2023-05-17 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: A StatsD client for Ruby apps. Provides metaprogramming methods to inject
16
16
  StatsD instrumentation into your code.
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.4.10
125
+ rubygems_version: 3.4.13
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: A StatsD client for Ruby apps