inst-jobs-statsd 2.1.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inst-jobs-statsd.rb +22 -18
  3. data/lib/inst_jobs_statsd/default_tracking.rb +3 -1
  4. data/lib/inst_jobs_statsd/ext/job.rb +2 -0
  5. data/lib/inst_jobs_statsd/jobs_tracker.rb +4 -0
  6. data/lib/inst_jobs_statsd/naming.rb +19 -24
  7. data/lib/inst_jobs_statsd/stats/counters/complete.rb +23 -0
  8. data/lib/inst_jobs_statsd/stats/counters/create.rb +23 -0
  9. data/lib/inst_jobs_statsd/stats/counters/run.rb +2 -0
  10. data/lib/inst_jobs_statsd/stats/counters.rb +2 -0
  11. data/lib/inst_jobs_statsd/stats/periodic/failed.rb +2 -0
  12. data/lib/inst_jobs_statsd/stats/periodic/queue.rb +3 -1
  13. data/lib/inst_jobs_statsd/stats/periodic/run.rb +3 -1
  14. data/lib/inst_jobs_statsd/stats/periodic.rb +6 -2
  15. data/lib/inst_jobs_statsd/stats/timing/failed.rb +2 -0
  16. data/lib/inst_jobs_statsd/stats/timing/perform.rb +2 -0
  17. data/lib/inst_jobs_statsd/stats/timing/pop.rb +2 -0
  18. data/lib/inst_jobs_statsd/stats/timing.rb +7 -3
  19. data/lib/inst_jobs_statsd/version.rb +3 -1
  20. metadata +88 -97
  21. data/spec/factories/jobs.rb +0 -9
  22. data/spec/factories/workers.rb +0 -9
  23. data/spec/gemfiles/42.gemfile +0 -8
  24. data/spec/gemfiles/42.gemfile.lock +0 -206
  25. data/spec/gemfiles/51.gemfile +0 -8
  26. data/spec/gemfiles/51.gemfile.lock +0 -231
  27. data/spec/gemfiles/60.gemfile +0 -7
  28. data/spec/gemfiles/60.gemfile.lock +0 -259
  29. data/spec/inst_jobs_statsd/ext/job_spec.rb +0 -15
  30. data/spec/inst_jobs_statsd/jobs_tracker_spec.rb +0 -28
  31. data/spec/inst_jobs_statsd/naming_spec.rb +0 -56
  32. data/spec/inst_jobs_statsd/stats/counters/run_spec.rb +0 -27
  33. data/spec/inst_jobs_statsd/stats/periodic/failed_spec.rb +0 -31
  34. data/spec/inst_jobs_statsd/stats/periodic/queue_spec.rb +0 -95
  35. data/spec/inst_jobs_statsd/stats/periodic/run_spec.rb +0 -53
  36. data/spec/inst_jobs_statsd/stats/periodic_spec.rb +0 -63
  37. data/spec/inst_jobs_statsd/stats/timing/failed_spec.rb +0 -25
  38. data/spec/inst_jobs_statsd/stats/timing/perform_spec.rb +0 -35
  39. data/spec/inst_jobs_statsd/stats/timing/pop_spec.rb +0 -34
  40. data/spec/inst_jobs_statsd/stats/timing_spec.rb +0 -35
  41. data/spec/inst_statsd/default_tracking_spec.rb +0 -16
  42. data/spec/matchers.rb +0 -3
  43. data/spec/setup_test_db.rb +0 -49
  44. data/spec/spec_helper.rb +0 -61
@@ -1,231 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- inst-jobs-statsd (2.1.0)
5
- inst-jobs (> 1.0, < 3.0)
6
- inst_statsd (>= 2.1.2, < 3.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (5.1.7)
12
- actionpack (= 5.1.7)
13
- nio4r (~> 2.0)
14
- websocket-driver (~> 0.6.1)
15
- actionmailer (5.1.7)
16
- actionpack (= 5.1.7)
17
- actionview (= 5.1.7)
18
- activejob (= 5.1.7)
19
- mail (~> 2.5, >= 2.5.4)
20
- rails-dom-testing (~> 2.0)
21
- actionpack (5.1.7)
22
- actionview (= 5.1.7)
23
- activesupport (= 5.1.7)
24
- rack (~> 2.0)
25
- rack-test (>= 0.6.3)
26
- rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.1.7)
29
- activesupport (= 5.1.7)
30
- builder (~> 3.1)
31
- erubi (~> 1.4)
32
- rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.1.7)
35
- activesupport (= 5.1.7)
36
- globalid (>= 0.3.6)
37
- activemodel (5.1.7)
38
- activesupport (= 5.1.7)
39
- activerecord (5.1.7)
40
- activemodel (= 5.1.7)
41
- activesupport (= 5.1.7)
42
- arel (~> 8.0)
43
- activesupport (5.1.7)
44
- concurrent-ruby (~> 1.0, >= 1.0.2)
45
- i18n (>= 0.7, < 2)
46
- minitest (~> 5.1)
47
- tzinfo (~> 1.1)
48
- after_transaction_commit (2.1.0)
49
- activerecord (>= 5.0)
50
- arel (8.0.0)
51
- aroi (0.0.7)
52
- rails (>= 3.2)
53
- ast (2.4.0)
54
- backports (3.15.0)
55
- builder (3.2.4)
56
- bump (0.8.0)
57
- byebug (11.1.1)
58
- coderay (1.1.2)
59
- concurrent-ruby (1.1.5)
60
- crass (1.0.6)
61
- database_cleaner (1.7.0)
62
- debug_inspector (0.0.3)
63
- diff-lcs (1.3)
64
- docile (1.3.2)
65
- dogstatsd-ruby (4.8.2)
66
- erubi (1.9.0)
67
- et-orbi (1.2.4)
68
- tzinfo
69
- factory_girl (4.9.0)
70
- activesupport (>= 3.0.0)
71
- fugit (1.4.2)
72
- et-orbi (~> 1.1, >= 1.1.8)
73
- raabro (~> 1.4)
74
- globalid (0.4.2)
75
- activesupport (>= 4.2.0)
76
- i18n (1.8.2)
77
- concurrent-ruby (~> 1.0)
78
- inst-jobs (1.0.4)
79
- activerecord (>= 4.2)
80
- activesupport (>= 4.2)
81
- after_transaction_commit (>= 1.0, < 3)
82
- debug_inspector (~> 0.0.3)
83
- fugit (~> 1.3)
84
- railties (>= 4.2)
85
- redis (> 3.0)
86
- redis-scripting (~> 1.0.1)
87
- inst_statsd (2.1.6)
88
- aroi (~> 0.0.7)
89
- dogstatsd-ruby (~> 4.2)
90
- statsd-ruby (~> 1.0)
91
- json (2.3.0)
92
- loofah (2.4.0)
93
- crass (~> 1.0.2)
94
- nokogiri (>= 1.5.9)
95
- mail (2.7.1)
96
- mini_mime (>= 0.1.1)
97
- method_source (0.9.2)
98
- mini_mime (1.0.2)
99
- mini_portile2 (2.4.0)
100
- minitest (5.14.0)
101
- multi_json (1.14.1)
102
- mustermann (1.1.1)
103
- ruby2_keywords (~> 0.0.1)
104
- nio4r (2.5.2)
105
- nokogiri (1.10.7)
106
- mini_portile2 (~> 2.4.0)
107
- parser (2.7.0.2)
108
- ast (~> 2.4.0)
109
- pg (1.2.2)
110
- powerpack (0.1.2)
111
- pry (0.12.2)
112
- coderay (~> 1.1.0)
113
- method_source (~> 0.9.0)
114
- raabro (1.4.0)
115
- rack (2.1.1)
116
- rack-protection (2.0.8.1)
117
- rack
118
- rack-test (1.1.0)
119
- rack (>= 1.0, < 3)
120
- rails (5.1.7)
121
- actioncable (= 5.1.7)
122
- actionmailer (= 5.1.7)
123
- actionpack (= 5.1.7)
124
- actionview (= 5.1.7)
125
- activejob (= 5.1.7)
126
- activemodel (= 5.1.7)
127
- activerecord (= 5.1.7)
128
- activesupport (= 5.1.7)
129
- bundler (>= 1.3.0)
130
- railties (= 5.1.7)
131
- sprockets-rails (>= 2.0.0)
132
- rails-dom-testing (2.0.3)
133
- activesupport (>= 4.2.0)
134
- nokogiri (>= 1.6)
135
- rails-html-sanitizer (1.3.0)
136
- loofah (~> 2.3)
137
- railties (5.1.7)
138
- actionpack (= 5.1.7)
139
- activesupport (= 5.1.7)
140
- method_source
141
- rake (>= 0.8.7)
142
- thor (>= 0.18.1, < 2.0)
143
- rainbow (2.2.2)
144
- rake
145
- rake (13.0.1)
146
- redis (4.2.5)
147
- redis-scripting (1.0.1)
148
- redis (>= 3.0)
149
- rspec (3.9.0)
150
- rspec-core (~> 3.9.0)
151
- rspec-expectations (~> 3.9.0)
152
- rspec-mocks (~> 3.9.0)
153
- rspec-core (3.9.1)
154
- rspec-support (~> 3.9.1)
155
- rspec-expectations (3.9.0)
156
- diff-lcs (>= 1.2.0, < 2.0)
157
- rspec-support (~> 3.9.0)
158
- rspec-mocks (3.9.1)
159
- diff-lcs (>= 1.2.0, < 2.0)
160
- rspec-support (~> 3.9.0)
161
- rspec-support (3.9.2)
162
- rubocop (0.48.1)
163
- parser (>= 2.3.3.1, < 3.0)
164
- powerpack (~> 0.1)
165
- rainbow (>= 1.99.1, < 3.0)
166
- ruby-progressbar (~> 1.7)
167
- unicode-display_width (~> 1.0, >= 1.0.1)
168
- ruby-progressbar (1.10.1)
169
- ruby2_keywords (0.0.2)
170
- simplecov (0.17.1)
171
- docile (~> 1.1)
172
- json (>= 1.8, < 3)
173
- simplecov-html (~> 0.10.0)
174
- simplecov-html (0.10.2)
175
- sinatra (2.0.8.1)
176
- mustermann (~> 1.0)
177
- rack (~> 2.0)
178
- rack-protection (= 2.0.8.1)
179
- tilt (~> 2.0)
180
- sinatra-contrib (2.0.8.1)
181
- backports (>= 2.8.2)
182
- multi_json
183
- mustermann (~> 1.0)
184
- rack-protection (= 2.0.8.1)
185
- sinatra (= 2.0.8.1)
186
- tilt (~> 2.0)
187
- sprockets (3.7.2)
188
- concurrent-ruby (~> 1.0)
189
- rack (> 1, < 3)
190
- sprockets-rails (3.2.1)
191
- actionpack (>= 4.0)
192
- activesupport (>= 4.0)
193
- sprockets (>= 3.0.0)
194
- statsd-ruby (1.5.0)
195
- thor (1.0.1)
196
- thread_safe (0.3.6)
197
- tilt (2.0.10)
198
- timecop (0.9.1)
199
- tzinfo (1.2.6)
200
- thread_safe (~> 0.1)
201
- unicode-display_width (1.6.1)
202
- websocket-driver (0.6.5)
203
- websocket-extensions (>= 0.1.0)
204
- websocket-extensions (0.1.4)
205
- wwtd (1.4.0)
206
-
207
- PLATFORMS
208
- ruby
209
-
210
- DEPENDENCIES
211
- bump
212
- bundler
213
- byebug
214
- database_cleaner (~> 1.7)
215
- factory_girl
216
- inst-jobs-statsd!
217
- pg (~> 1.2)
218
- pry
219
- rails (~> 5.1.7)
220
- rake
221
- rspec (~> 3.9)
222
- rubocop (~> 0.48.0)
223
- simplecov (~> 0.17)
224
- sinatra (~> 2.0.8)
225
- sinatra-contrib (~> 2.0.8)
226
- sprockets (~> 3.7)
227
- timecop
228
- wwtd (~> 1.4.0)
229
-
230
- BUNDLED WITH
231
- 1.17.3
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec :path=>"../../"
4
-
5
- gem "rails", "~> 6.0"
6
- gem "sinatra", "~> 2.0.8"
7
- gem "sinatra-contrib", "~> 2.0.8"
@@ -1,259 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- inst-jobs-statsd (2.1.0)
5
- inst-jobs (> 1.0, < 3.0)
6
- inst_statsd (>= 2.1.2, < 3.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (6.1.3)
12
- actionpack (= 6.1.3)
13
- activesupport (= 6.1.3)
14
- nio4r (~> 2.0)
15
- websocket-driver (>= 0.6.1)
16
- actionmailbox (6.1.3)
17
- actionpack (= 6.1.3)
18
- activejob (= 6.1.3)
19
- activerecord (= 6.1.3)
20
- activestorage (= 6.1.3)
21
- activesupport (= 6.1.3)
22
- mail (>= 2.7.1)
23
- actionmailer (6.1.3)
24
- actionpack (= 6.1.3)
25
- actionview (= 6.1.3)
26
- activejob (= 6.1.3)
27
- activesupport (= 6.1.3)
28
- mail (~> 2.5, >= 2.5.4)
29
- rails-dom-testing (~> 2.0)
30
- actionpack (6.1.3)
31
- actionview (= 6.1.3)
32
- activesupport (= 6.1.3)
33
- rack (~> 2.0, >= 2.0.9)
34
- rack-test (>= 0.6.3)
35
- rails-dom-testing (~> 2.0)
36
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
37
- actiontext (6.1.3)
38
- actionpack (= 6.1.3)
39
- activerecord (= 6.1.3)
40
- activestorage (= 6.1.3)
41
- activesupport (= 6.1.3)
42
- nokogiri (>= 1.8.5)
43
- actionview (6.1.3)
44
- activesupport (= 6.1.3)
45
- builder (~> 3.1)
46
- erubi (~> 1.4)
47
- rails-dom-testing (~> 2.0)
48
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
49
- activejob (6.1.3)
50
- activesupport (= 6.1.3)
51
- globalid (>= 0.3.6)
52
- activemodel (6.1.3)
53
- activesupport (= 6.1.3)
54
- activerecord (6.1.3)
55
- activemodel (= 6.1.3)
56
- activesupport (= 6.1.3)
57
- activestorage (6.1.3)
58
- actionpack (= 6.1.3)
59
- activejob (= 6.1.3)
60
- activerecord (= 6.1.3)
61
- activesupport (= 6.1.3)
62
- marcel (~> 0.3.1)
63
- mimemagic (~> 0.3.2)
64
- activesupport (6.1.3)
65
- concurrent-ruby (~> 1.0, >= 1.0.2)
66
- i18n (>= 1.6, < 2)
67
- minitest (>= 5.1)
68
- tzinfo (~> 2.0)
69
- zeitwerk (~> 2.3)
70
- after_transaction_commit (2.2.1)
71
- activerecord (>= 5.2)
72
- aroi (0.0.7)
73
- rails (>= 3.2)
74
- ast (2.4.2)
75
- backports (3.20.2)
76
- builder (3.2.4)
77
- bump (0.10.0)
78
- byebug (11.1.3)
79
- coderay (1.1.3)
80
- concurrent-ruby (1.1.8)
81
- crass (1.0.6)
82
- database_cleaner (1.99.0)
83
- debug_inspector (0.0.3)
84
- diff-lcs (1.4.4)
85
- docile (1.3.5)
86
- dogstatsd-ruby (4.8.2)
87
- erubi (1.10.0)
88
- et-orbi (1.2.4)
89
- tzinfo
90
- factory_girl (4.9.0)
91
- activesupport (>= 3.0.0)
92
- fugit (1.4.2)
93
- et-orbi (~> 1.1, >= 1.1.8)
94
- raabro (~> 1.4)
95
- globalid (0.4.2)
96
- activesupport (>= 4.2.0)
97
- i18n (1.8.9)
98
- concurrent-ruby (~> 1.0)
99
- inst-jobs (2.2.0)
100
- activerecord (>= 4.2)
101
- activesupport (>= 4.2)
102
- after_transaction_commit (>= 1.0, < 3)
103
- debug_inspector (~> 0.0.3)
104
- fugit (~> 1.3)
105
- railties (>= 4.2)
106
- redis (> 3.0)
107
- redis-scripting (~> 1.0.1)
108
- inst_statsd (2.1.6)
109
- aroi (~> 0.0.7)
110
- dogstatsd-ruby (~> 4.2)
111
- statsd-ruby (~> 1.0)
112
- loofah (2.9.0)
113
- crass (~> 1.0.2)
114
- nokogiri (>= 1.5.9)
115
- mail (2.7.1)
116
- mini_mime (>= 0.1.1)
117
- marcel (0.3.3)
118
- mimemagic (~> 0.3.2)
119
- method_source (1.0.0)
120
- mimemagic (0.3.5)
121
- mini_mime (1.0.2)
122
- mini_portile2 (2.5.0)
123
- minitest (5.14.3)
124
- multi_json (1.15.0)
125
- mustermann (1.1.1)
126
- ruby2_keywords (~> 0.0.1)
127
- nio4r (2.5.5)
128
- nokogiri (1.11.1)
129
- mini_portile2 (~> 2.5.0)
130
- racc (~> 1.4)
131
- parser (2.7.2.0)
132
- ast (~> 2.4.1)
133
- pg (1.2.3)
134
- powerpack (0.1.3)
135
- pry (0.14.0)
136
- coderay (~> 1.1)
137
- method_source (~> 1.0)
138
- raabro (1.4.0)
139
- racc (1.5.2)
140
- rack (2.2.3)
141
- rack-protection (2.0.8.1)
142
- rack
143
- rack-test (1.1.0)
144
- rack (>= 1.0, < 3)
145
- rails (6.1.3)
146
- actioncable (= 6.1.3)
147
- actionmailbox (= 6.1.3)
148
- actionmailer (= 6.1.3)
149
- actionpack (= 6.1.3)
150
- actiontext (= 6.1.3)
151
- actionview (= 6.1.3)
152
- activejob (= 6.1.3)
153
- activemodel (= 6.1.3)
154
- activerecord (= 6.1.3)
155
- activestorage (= 6.1.3)
156
- activesupport (= 6.1.3)
157
- bundler (>= 1.15.0)
158
- railties (= 6.1.3)
159
- sprockets-rails (>= 2.0.0)
160
- rails-dom-testing (2.0.3)
161
- activesupport (>= 4.2.0)
162
- nokogiri (>= 1.6)
163
- rails-html-sanitizer (1.3.0)
164
- loofah (~> 2.3)
165
- railties (6.1.3)
166
- actionpack (= 6.1.3)
167
- activesupport (= 6.1.3)
168
- method_source
169
- rake (>= 0.8.7)
170
- thor (~> 1.0)
171
- rainbow (2.2.2)
172
- rake
173
- rake (13.0.3)
174
- redis (4.2.5)
175
- redis-scripting (1.0.1)
176
- redis (>= 3.0)
177
- rspec (3.10.0)
178
- rspec-core (~> 3.10.0)
179
- rspec-expectations (~> 3.10.0)
180
- rspec-mocks (~> 3.10.0)
181
- rspec-core (3.10.1)
182
- rspec-support (~> 3.10.0)
183
- rspec-expectations (3.10.1)
184
- diff-lcs (>= 1.2.0, < 2.0)
185
- rspec-support (~> 3.10.0)
186
- rspec-mocks (3.10.2)
187
- diff-lcs (>= 1.2.0, < 2.0)
188
- rspec-support (~> 3.10.0)
189
- rspec-support (3.10.2)
190
- rubocop (0.48.1)
191
- parser (>= 2.3.3.1, < 3.0)
192
- powerpack (~> 0.1)
193
- rainbow (>= 1.99.1, < 3.0)
194
- ruby-progressbar (~> 1.7)
195
- unicode-display_width (~> 1.0, >= 1.0.1)
196
- ruby-progressbar (1.11.0)
197
- ruby2_keywords (0.0.4)
198
- simplecov (0.21.2)
199
- docile (~> 1.1)
200
- simplecov-html (~> 0.11)
201
- simplecov_json_formatter (~> 0.1)
202
- simplecov-html (0.12.3)
203
- simplecov_json_formatter (0.1.2)
204
- sinatra (2.0.8.1)
205
- mustermann (~> 1.0)
206
- rack (~> 2.0)
207
- rack-protection (= 2.0.8.1)
208
- tilt (~> 2.0)
209
- sinatra-contrib (2.0.8.1)
210
- backports (>= 2.8.2)
211
- multi_json
212
- mustermann (~> 1.0)
213
- rack-protection (= 2.0.8.1)
214
- sinatra (= 2.0.8.1)
215
- tilt (~> 2.0)
216
- sprockets (4.0.2)
217
- concurrent-ruby (~> 1.0)
218
- rack (> 1, < 3)
219
- sprockets-rails (3.2.2)
220
- actionpack (>= 4.0)
221
- activesupport (>= 4.0)
222
- sprockets (>= 3.0.0)
223
- statsd-ruby (1.5.0)
224
- thor (1.1.0)
225
- tilt (2.0.10)
226
- timecop (0.9.4)
227
- tzinfo (2.0.4)
228
- concurrent-ruby (~> 1.0)
229
- unicode-display_width (1.7.0)
230
- websocket-driver (0.7.3)
231
- websocket-extensions (>= 0.1.0)
232
- websocket-extensions (0.1.5)
233
- wwtd (1.4.1)
234
- zeitwerk (2.4.2)
235
-
236
- PLATFORMS
237
- ruby
238
-
239
- DEPENDENCIES
240
- bump
241
- bundler
242
- byebug
243
- database_cleaner (~> 1.7)
244
- factory_girl
245
- inst-jobs-statsd!
246
- pg (~> 1.2)
247
- pry
248
- rails (~> 6.0)
249
- rake
250
- rspec (~> 3.9)
251
- rubocop (~> 0.48.0)
252
- simplecov (~> 0.17)
253
- sinatra (~> 2.0.8)
254
- sinatra-contrib (~> 2.0.8)
255
- timecop
256
- wwtd (~> 1.4.0)
257
-
258
- BUNDLED WITH
259
- 2.1.4
@@ -1,15 +0,0 @@
1
- RSpec.describe 'InstJobsStatsd::Ext::Job' do
2
- describe 'sends count on job failure' do
3
- before do
4
- InstJobsStatsd::JobsTracker.new
5
- end
6
- let(:x) { Struct.new(:perform).new(true) }
7
- it 'sends a stat' do
8
- expect(InstStatsd::Statsd).to receive(:count)
9
- .with(array_including(/\.failed$/), 1, 1, short_stat: :failed, tags: {})
10
-
11
- x.delay.perform
12
- Delayed::Job.first.fail!
13
- end
14
- end
15
- end
@@ -1,28 +0,0 @@
1
- RSpec.describe InstJobsStatsd::JobsTracker do
2
- describe '.track' do
3
- it 'calls the block' do
4
- @done_in_block = false
5
- expect do
6
- InstJobsStatsd::JobsTracker.track do
7
- @done_in_block = true
8
- end
9
- end.to(change { @done_in_block })
10
- end
11
- end
12
-
13
- describe '.initialize' do
14
- it 'enables everything' do
15
- expect(InstJobsStatsd::Stats::Counters::Run).to receive(:enable)
16
-
17
- expect(InstJobsStatsd::Stats::Periodic::Failed).to receive(:enable)
18
- expect(InstJobsStatsd::Stats::Periodic::Queue).to receive(:enable)
19
- expect(InstJobsStatsd::Stats::Periodic::Run).to receive(:enable)
20
-
21
- expect(InstJobsStatsd::Stats::Timing::Failed).to receive(:enable)
22
- expect(InstJobsStatsd::Stats::Timing::Perform).to receive(:enable)
23
- expect(InstJobsStatsd::Stats::Timing::Pop).to receive(:enable)
24
-
25
- InstJobsStatsd::JobsTracker.new
26
- end
27
- end
28
- end
@@ -1,56 +0,0 @@
1
- RSpec.describe InstJobsStatsd::Naming do
2
- describe '.qualified_names' do
3
- subject { InstJobsStatsd::Naming.qualified_names(stat_name, job) }
4
- let(:stat_name) { :wut }
5
-
6
- context 'when no job is given' do
7
- let(:job) { nil }
8
- it { should eq ['delayedjob.wut'] }
9
- end
10
-
11
- context 'when job is given' do
12
- let(:job) { build :job }
13
- it { should include 'delayedjob.wut.tag.Test-Job.perform' }
14
-
15
- context 'job tag is unusual' do
16
- let(:job) { build :job, tag: 'periodic__Something_on_a_schedule' }
17
- it { should include 'delayedjob.wut.tag.periodic__Something_on_a_schedule' }
18
- end
19
-
20
- context 'job tag is dynamic' do
21
- let(:job) { build :job, tag: '<Class:0x00000004f575b8>#perform' }
22
- it { should eq ['delayedjob.wut'] }
23
- end
24
- end
25
-
26
- context 'with region tags' do
27
- before do
28
- @jobs_namespace = ENV['INST_JOBS_STATSD_NAMESPACE']
29
- ENV['INST_JOBS_STATSD_NAMESPACE'] = 'region_name'
30
- end
31
-
32
- after do
33
- ENV['INST_JOBS_STATSD_NAMESPACE'] = @jobs_namespace
34
- end
35
-
36
- let(:job) { build :job, tag: 'a_tag_name' }
37
-
38
- it { should include 'delayedjob.wut' }
39
- it { should include 'delayedjob.wut.tag.a_tag_name' }
40
- it { should include 'delayedjob.wut.region_name' }
41
- it { should include 'delayedjob.wut.region_name.tag.a_tag_name' }
42
- end
43
-
44
- describe '.dd_job_tags' do
45
- it 'works' do
46
- job = double(tag: 'Account.run_reports_later', shard: double(id: 101), strand: 'special')
47
- expect(InstJobsStatsd::Naming.dd_job_tags(job)).to eq(tag: 'Account.run_reports_later', jobshard: 101)
48
- end
49
-
50
- it 'properly munges job tags' do
51
- job = double(tag: 'Quizzes::Quiz#do_something', strand: nil)
52
- expect(InstJobsStatsd::Naming.dd_job_tags(job)).to eq(tag: 'Quizzes-Quiz.do_something')
53
- end
54
- end
55
- end
56
- end
@@ -1,27 +0,0 @@
1
- RSpec.describe InstJobsStatsd::Stats::Counters::Run do
2
- describe '.enable' do
3
- it 'enables all the things' do
4
- expect(InstJobsStatsd::Stats::Counters::Run).to receive(:enable_run_count)
5
- InstJobsStatsd::Stats::Counters::Run.enable
6
- end
7
- end
8
-
9
- describe '.report_run_count' do
10
- let(:x) { Struct.new(:perform).new(true) }
11
-
12
- before do
13
- Delayed::Worker.lifecycle.reset!
14
- InstJobsStatsd::Stats::Counters::Run.enable
15
-
16
- 2.times { x.delay.perform }
17
- end
18
-
19
- it do
20
- expect(InstStatsd::Statsd).to receive(:count)
21
- .twice.with(array_including(/\.run$/), 1, 1, short_stat: anything, tags: {})
22
- Delayed::Job.all.each do |job|
23
- Delayed::Worker.lifecycle.run_callbacks(:perform, {}, job) {}
24
- end
25
- end
26
- end
27
- end
@@ -1,31 +0,0 @@
1
- RSpec.describe InstJobsStatsd::Stats::Periodic::Failed do
2
- before do
3
- InstJobsStatsd::Stats::Periodic.instance_variable_set(:@instance, nil)
4
- end
5
-
6
- describe '.enable' do
7
- it 'enables all the things' do
8
- expect(InstJobsStatsd::Stats::Periodic::Failed).to receive(:enable_failed_depth)
9
- InstJobsStatsd::Stats::Periodic::Failed.enable
10
- end
11
- end
12
-
13
- describe '.report_failed_depth' do
14
- let(:x) { Struct.new(:perform).new(true) }
15
- let(:now) { Delayed::Job.db_time_now }
16
-
17
- before do
18
- InstJobsStatsd::Stats::Periodic.enable_callbacks
19
- InstJobsStatsd::Stats::Periodic::Failed.enable_failed_depth
20
-
21
- x.delay.perform
22
- Delayed::Job.first.fail!
23
- end
24
-
25
- it do
26
- expect(InstStatsd::Statsd).to receive(:gauge)
27
- .with(array_including(/\.failed_depth$/), 1, 1, short_stat: anything, tags: {})
28
- InstJobsStatsd::Stats::Periodic::Failed.report_failed_depth
29
- end
30
- end
31
- end