statsd-instrument 2.2.0 → 2.2.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
  SHA1:
3
- metadata.gz: 1888f7964454431b2167c0c253ea7c53de3c1afb
4
- data.tar.gz: 74c6d0f9f44eb989bcfdc44cfea912fb07c1447a
3
+ metadata.gz: c90b5a926408cac6e7ddb08b2828626eabb890f3
4
+ data.tar.gz: b006fad637fb15c07f9167e9fbe06bc889ec539f
5
5
  SHA512:
6
- metadata.gz: b2faeaa7145f89905c966f08b044bb90b544f53f9bc5de0b1aa29bcf7731e3807f70ad114692a31481e19693d761f74253702791c24212f173c3254dc466f9dc
7
- data.tar.gz: 8f7d60c2a4144afb033adbb18435373d7bba35702782e835642923a09dff7ec8028fbf7de655c7031aa6102a8df698685af0b71b6bca4195ca17e86cb20d01fa
6
+ metadata.gz: 89b66de0c70a829a3d5e884ac93b4885958c50a0e84dd157230bc798afe4b014fa836b47af5fe8cae099cd56b15b6751b20d262c453a507b70e9ee9ca858eca5
7
+ data.tar.gz: 2754ba8ae91ced3221bbabc16b97b6272d8cbc269888caed3e9842a5ac69433b4f444cc57cc92cd61aa7bf4becd07bffba68af6df905da1f4c4db67fd1383678
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ please at an entry to the "unreleased changes" section below.
5
5
 
6
6
  ### Unreleased changes
7
7
 
8
+ ### Version 2.2.1
9
+
10
+ - Fix performance regression from v2.2.0
11
+
8
12
  ### Version 2.2.0
9
13
 
10
14
  - Add support for two new datadog specific metric types: events and service checks.
@@ -3,6 +3,8 @@ require 'monitor'
3
3
  module StatsD::Instrument::Backends
4
4
  class UDPBackend < StatsD::Instrument::Backend
5
5
 
6
+ BASE_SUPPORTED_METRIC_TYPES = { c: true, ms: true, g: true, s: true }
7
+
6
8
  class DogStatsDProtocol
7
9
  EVENT_OPTIONS = {
8
10
  date_happened: 'd',
@@ -19,9 +21,7 @@ module StatsD::Instrument::Backends
19
21
  message: 'm',
20
22
  }
21
23
 
22
- def supported?(metric)
23
- [:c, :ms, :g, :h, :s, :_e, :_sc].include?(metric.type)
24
- end
24
+ SUPPORTED_METRIC_TYPES = BASE_SUPPORTED_METRIC_TYPES.merge(h: true, _e: true, _sc: true)
25
25
 
26
26
  def generate_packet(metric)
27
27
  packet = ""
@@ -54,9 +54,7 @@ module StatsD::Instrument::Backends
54
54
  end
55
55
 
56
56
  class StatsiteStatsDProtocol
57
- def supported?(metric)
58
- [:c, :ms, :g, :s, :kv].include?(metric.type)
59
- end
57
+ SUPPORTED_METRIC_TYPES = BASE_SUPPORTED_METRIC_TYPES.merge(kv: true)
60
58
 
61
59
  def generate_packet(metric)
62
60
  packet = "#{metric.name}:#{metric.value}|#{metric.type}"
@@ -67,9 +65,7 @@ module StatsD::Instrument::Backends
67
65
  end
68
66
 
69
67
  class StatsDProtocol
70
- def supported?(metric)
71
- [:c, :ms, :g, :s].include?(metric.type)
72
- end
68
+ SUPPORTED_METRIC_TYPES = BASE_SUPPORTED_METRIC_TYPES
73
69
 
74
70
  def generate_packet(metric)
75
71
  packet = "#{metric.name}:#{metric.value}|#{metric.type}"
@@ -103,7 +99,7 @@ module StatsD::Instrument::Backends
103
99
  end
104
100
 
105
101
  def collect_metric(metric)
106
- unless @packet_factory.supported?(metric)
102
+ unless @packet_factory.class::SUPPORTED_METRIC_TYPES[metric.type]
107
103
  StatsD.logger.warn("[StatsD] Metric type #{metric.type.inspect} not supported on #{implementation} implementation.")
108
104
  return false
109
105
  end
@@ -1,5 +1,5 @@
1
1
  module StatsD
2
2
  module Instrument
3
- VERSION = "2.2.0"
3
+ VERSION = "2.2.1"
4
4
  end
5
5
  end
@@ -0,0 +1,38 @@
1
+ require 'statsd-instrument'
2
+ require 'benchmark/ips'
3
+
4
+ def helperFunction()
5
+ a = 10
6
+ a += a
7
+ a -= a
8
+ a *= a
9
+ end
10
+
11
+ Benchmark.ips do |bench|
12
+ bench.report("increment metric benchmark") do
13
+ StatsD.increment('GoogleBase.insert', 10)
14
+ end
15
+
16
+ bench.report("measure metric benchmark") do
17
+ StatsD.measure('helperFunction') do
18
+ helperFunction()
19
+ end
20
+ end
21
+
22
+ bench.report("gauge metric benchmark") do
23
+ StatsD.gauge('GoogleBase.insert', 12)
24
+ end
25
+
26
+ bench.report("set metric benchmark") do
27
+ StatsD.set('GoogleBase.customers', "12345", sample_rate: 1.0)
28
+ end
29
+
30
+ bench.report("event metric benchmark") do
31
+ StatsD.event('Event Title', "12345")
32
+ end
33
+
34
+ bench.report("service check metric benchmark") do
35
+ StatsD.service_check('shipit.redis_connection', 'ok')
36
+ end
37
+
38
+ 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: 2.2.0
4
+ version: 2.2.1
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: 2018-05-18 00:00:00.000000000 Z
13
+ date: 2018-05-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -130,6 +130,7 @@ files:
130
130
  - shipit.rubygems.yml
131
131
  - statsd-instrument.gemspec
132
132
  - test/assertions_test.rb
133
+ - test/benchmark/metrics.rb
133
134
  - test/benchmark/tags.rb
134
135
  - test/capture_backend_test.rb
135
136
  - test/environment_test.rb
@@ -168,6 +169,7 @@ specification_version: 4
168
169
  summary: A StatsD client for Ruby apps
169
170
  test_files:
170
171
  - test/assertions_test.rb
172
+ - test/benchmark/metrics.rb
171
173
  - test/benchmark/tags.rb
172
174
  - test/capture_backend_test.rb
173
175
  - test/environment_test.rb