codeclimate 0.87.1 → 0.87.2

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: 7aef62a2ef1fac0bb295ee3505ddf3db68b0f303764a0ae75a00f8e3b413610a
4
- data.tar.gz: ed7edb689f9147848be2453c04727c9a98b6880c61233464c93a87b4dbde74e2
3
+ metadata.gz: 70a48143ec65e582ac39752b48a5a963865ac8e36c99c16e2d4dfa3835a138c3
4
+ data.tar.gz: ba0d3afc2fc5a462cf2f3ce4c783798f8f07ba4db36da42cdbce0ce3dbbd8cfe
5
5
  SHA512:
6
- metadata.gz: 5766e1f9011abc604fc3e03a2886f770f039e12e1b741e1f76baa206d4100cbfd3a1ae64714cee02611dbce814183f212adddfb2cf2bcec595c97b14d94f58cd
7
- data.tar.gz: 6213518488e6a71d2ef1bdb5fc80b4cbccc041e27abc3515a0541ef2bf2e6a1452fdd635ed697db248972baa7f1a750bca47af443186a7c09f0a4d6892bb1f81
6
+ metadata.gz: 8767bbbdfb65ec6a8ec40c473dc63722ab58c90fefdb1cade7b004d3ae1c8f922a4c65c000338867df90fa2f872be2093d0f1b05e2bc525f9a68f981e8381949
7
+ data.tar.gz: e88c146dcfc1117f0bb8bbb1e2e0076adda3416f430fb81cfc79c8f7c7164a41fe7b08100d86046653eb61839a2bdf6c107fdffab65593ef9940ccef258d5006
@@ -31,21 +31,34 @@ module CC
31
31
 
32
32
  attr_reader :statsd
33
33
 
34
- def increment(engine, metric)
35
- statsd.increment("engines.#{metric}")
36
- statsd.increment("engines.names.#{engine.name}.#{metric}")
37
- if engine.respond_to?(:channel) && engine.channel
38
- statsd.increment("engines.names.#{engine.name}.#{engine.channel}.#{metric}")
34
+ def increment(engine, metric_name)
35
+ tags = engine_tags(engine)
36
+ metrics(engine, metric_name).each { |metric| statsd.increment(metric, tags:) }
37
+ end
38
+
39
+ def timing(engine, metric_name, millis)
40
+ tags = engine_tags(engine)
41
+ metrics(engine, metric_name).each { |metric| statsd.timing(metric, millis, tags:) }
42
+ end
43
+
44
+ def metrics(engine, metric_name)
45
+ [
46
+ "engines.#{metric_name}",
47
+ "engines.names.#{engine.name}.#{metric_name}",
48
+ ].tap do |metrics|
49
+ metrics << "engines.names.#{engine.name}.#{engine.channel}.#{metric_name}" if engine_channel_present?(engine)
39
50
  end
40
51
  end
41
52
 
42
- def timing(engine, metric, millis)
43
- statsd.timing("engines.#{metric}", millis)
44
- statsd.timing("engines.names.#{engine.name}.#{metric}", millis)
45
- if engine.respond_to?(:channel) && engine.channel
46
- statsd.timing("engines.names.#{engine.name}.#{engine.channel}.#{metric}", millis)
53
+ def engine_tags(engine)
54
+ ["engine:#{engine.name}"].tap do |tags|
55
+ tags << "channel:#{engine.channel}" if engine_channel_present?(engine)
47
56
  end
48
57
  end
58
+
59
+ def engine_channel_present?(engine)
60
+ engine.respond_to?(:channel) && engine.channel
61
+ end
49
62
  end
50
63
  end
51
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.87.1
4
+ version: 0.87.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-02 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport