statsd-instrument 3.5.8 → 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: 704d6e657601de493dc28e4a99f3d68529582693b7a74981a63a9837e99119e7
4
- data.tar.gz: b801455560f15650dd460cd25cf3de3efde71ec180842016899b2d51896b4a78
3
+ metadata.gz: 5b849985c5072f05154d25451f6db9fc1a6c5ca658d14aca02256aab9af99295
4
+ data.tar.gz: e780d3a60c47a278f1862fa5b18593cfdcc87febe6504a6de9c894e1f024ce2b
5
5
  SHA512:
6
- metadata.gz: 5a47689d821aeaab37d72af1021af0d1892d420bfbb3d75ded3f2318f73f16f2e36dde3706f82bf5c95b33b3669a028ceb11315f66fac6025c27da6da325ab59
7
- data.tar.gz: 64388d0ec0a6a1107d455d54dc2b26d5a5caf26d7a1a6051ad117d2d4088cc1cb6527490f87bacd706a13be4d04f4146e3806fe7f5d5e2336f9f9e23ef8609ec
6
+ metadata.gz: 6bc432d02716529829c060a0357de9772af5da0f1a270dcaadb5f014666701888e037917b70e794c265175e807df22bbf7153b43a6a79bf3563c97b1617c038d
7
+ data.tar.gz: 59dceba9b5b0e35d2a96d97e13e2536134e03a8d6116b728fe32d30e80b8e38b95263e5cf853e1d485b7ae0fe94b8d2833929d30ab7513874e737ae62e1562eb
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ 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
+
9
13
  ## Version 3.5.8
10
14
 
11
15
  - Allow the `tag_error_class` option for `statsd_count_success` in strict mode.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StatsD
4
4
  module Instrument
5
- VERSION = "3.5.8"
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.8
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-27 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.12
125
+ rubygems_version: 3.4.13
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: A StatsD client for Ruby apps