statsd-instrument 2.3.5 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/workflows/ci.yml +31 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml +1027 -0
  6. data/.rubocop.yml +21 -0
  7. data/CHANGELOG.md +9 -0
  8. data/CONTRIBUTING.md +25 -5
  9. data/Gemfile +2 -0
  10. data/Rakefile +3 -1
  11. data/lib/statsd-instrument.rb +2 -0
  12. data/lib/statsd/instrument.rb +51 -18
  13. data/lib/statsd/instrument/assertions.rb +24 -18
  14. data/lib/statsd/instrument/backend.rb +3 -2
  15. data/lib/statsd/instrument/backends/capture_backend.rb +2 -1
  16. data/lib/statsd/instrument/backends/logger_backend.rb +3 -3
  17. data/lib/statsd/instrument/backends/null_backend.rb +2 -0
  18. data/lib/statsd/instrument/backends/udp_backend.rb +18 -15
  19. data/lib/statsd/instrument/environment.rb +2 -0
  20. data/lib/statsd/instrument/helpers.rb +6 -2
  21. data/lib/statsd/instrument/matchers.rb +14 -11
  22. data/lib/statsd/instrument/metric.rb +34 -21
  23. data/lib/statsd/instrument/metric_expectation.rb +32 -18
  24. data/lib/statsd/instrument/railtie.rb +2 -1
  25. data/lib/statsd/instrument/version.rb +3 -1
  26. data/statsd-instrument.gemspec +13 -10
  27. data/test/assertions_test.rb +15 -4
  28. data/test/benchmark/default_tags.rb +47 -0
  29. data/test/benchmark/metrics.rb +9 -8
  30. data/test/benchmark/tags.rb +5 -3
  31. data/test/capture_backend_test.rb +4 -2
  32. data/test/environment_test.rb +2 -1
  33. data/test/helpers_test.rb +2 -1
  34. data/test/integration_test.rb +27 -7
  35. data/test/logger_backend_test.rb +10 -8
  36. data/test/matchers_test.rb +34 -20
  37. data/test/metric_test.rb +15 -4
  38. data/test/statsd_instrumentation_test.rb +7 -7
  39. data/test/statsd_test.rb +24 -15
  40. data/test/test_helper.rb +2 -0
  41. data/test/udp_backend_test.rb +3 -26
  42. metadata +22 -3
  43. data/.travis.yml +0 -12
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ENV['ENV'] = 'test'
2
4
 
3
5
  require 'minitest/autorun'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test_helper'
2
4
 
3
5
  class UDPBackendTest < Minitest::Test
@@ -76,7 +78,7 @@ class UDPBackendTest < Minitest::Test
76
78
  StatsD.histogram('fooh', 42.4)
77
79
  end
78
80
 
79
- def test_distribution_syntax_on_datadog
81
+ def test_distribution_syntax_on_datadog
80
82
  @backend.implementation = :datadog
81
83
  @backend.expects(:write_packet).with('fooh:42.4|d')
82
84
  StatsD.distribution('fooh', 42.4)
@@ -183,31 +185,6 @@ class UDPBackendTest < Minitest::Test
183
185
  StatsD.increment('fail')
184
186
  end
185
187
 
186
- def test_synchronize_in_exit_handler_handles_thread_error_and_exits_cleanly
187
- pid = fork do
188
- Signal.trap('TERM') do
189
- $sent_packet = false
190
-
191
- class << @backend.socket
192
- def send(command, *args)
193
- $sent_packet = true if command == 'exiting:1|c'
194
- command.length
195
- end
196
- end
197
-
198
- StatsD.increment('exiting')
199
- Process.exit!($sent_packet)
200
- end
201
-
202
- sleep 100
203
- end
204
-
205
- Process.kill('TERM', pid)
206
- Process.waitpid(pid)
207
-
208
- assert $?.success?, 'socket did not write on exit'
209
- end
210
-
211
188
  def test_socket_error_should_invalidate_socket
212
189
  seq = sequence('fail_then_succeed')
213
190
 
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.3.5
4
+ version: 2.4.0
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: 2019-09-16 00:00:00.000000000 Z
13
+ date: 2019-09-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -82,6 +82,20 @@ dependencies:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: rubocop
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
85
99
  - !ruby/object:Gem::Dependency
86
100
  name: benchmark-ips
87
101
  requirement: !ruby/object:Gem::Requirement
@@ -104,9 +118,12 @@ executables: []
104
118
  extensions: []
105
119
  extra_rdoc_files: []
106
120
  files:
121
+ - ".github/CODEOWNERS"
107
122
  - ".github/probots.yml"
123
+ - ".github/workflows/ci.yml"
108
124
  - ".gitignore"
109
- - ".travis.yml"
125
+ - ".rubocop-https---shopify-github-io-ruby-style-guide-rubocop-yml"
126
+ - ".rubocop.yml"
110
127
  - CHANGELOG.md
111
128
  - CONTRIBUTING.md
112
129
  - Gemfile
@@ -131,6 +148,7 @@ files:
131
148
  - shipit.rubygems.yml
132
149
  - statsd-instrument.gemspec
133
150
  - test/assertions_test.rb
151
+ - test/benchmark/default_tags.rb
134
152
  - test/benchmark/metrics.rb
135
153
  - test/benchmark/tags.rb
136
154
  - test/capture_backend_test.rb
@@ -169,6 +187,7 @@ specification_version: 4
169
187
  summary: A StatsD client for Ruby apps
170
188
  test_files:
171
189
  - test/assertions_test.rb
190
+ - test/benchmark/default_tags.rb
172
191
  - test/benchmark/metrics.rb
173
192
  - test/benchmark/tags.rb
174
193
  - test/capture_backend_test.rb
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.10
4
- - 2.2.6
5
- - 2.3.3
6
- - ruby-head
7
-
8
- matrix:
9
- allow_failures:
10
- - rvm: ruby-head
11
-
12
- sudo: false