funktor 0.7.14 → 0.7.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -70,6 +70,6 @@ queues:
70
70
  # Here you can specify a list of worker that you want to monitor closely
71
71
  primaryWorkers:
72
72
  - HelloWorker
73
- - GreetingsWorker
74
- - AuditWorker
75
- - SingleThreadAuditWorker
73
+ #- GreetingsWorker
74
+ #- AuditWorker
75
+ #- SingleThreadAuditWorker
@@ -141,6 +141,22 @@ module Funktor
141
141
 
142
142
  private
143
143
 
144
+ def prioritized_workers
145
+ if primary_workers == app_worker_names
146
+ app_worker_names
147
+ else
148
+ primary_workers + non_primary_workers
149
+ end
150
+ end
151
+
152
+ def non_primary_workers
153
+ if primary_workers == app_worker_names
154
+ app_worker_names
155
+ else
156
+ app_worker_names - primary_workers
157
+ end
158
+ end
159
+
144
160
  def primary_workers
145
161
  funktor_config["primaryWorkers"] || app_worker_names
146
162
  end
@@ -152,7 +168,8 @@ module Funktor
152
168
  end
153
169
 
154
170
  def app_worker_files
155
- Dir.glob(File.join('app', 'workers', '**.rb'))
171
+ Dir.glob(File.join('app', 'workers', '**.rb')) +
172
+ Dir.glob(File.join('app', 'jobs', '**.rb'))
156
173
  end
157
174
 
158
175
  def all_iam_permissions
@@ -21,226 +21,19 @@ Resources:
21
21
  },
22
22
  <% current_y += 3 %>
23
23
 
24
- { <% "Processed Jobs By Worker" %>
25
- "height": 4,
26
- "width": 12,
27
- "y": <%= current_y %>,
28
- "x": 0,
29
- "type": "metric",
30
- "properties": {
31
- "metrics": [
32
- <%- primary_workers.each do |worker_name| -%>
33
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "<%= worker_name %>" ]<%= worker_name == primary_workers.last ? "" : "," %>
34
- <%- end -%>
35
- ],
36
- "view": "timeSeries",
37
- "stacked": false,
38
- "region": "us-east-1",
39
- "title": "Processed Jobs By Worker",
40
- "period": 60,
41
- "stat": "Sum"
42
- }
43
- },
44
- { <% "p90 By Worker" %>
45
- "height": 4,
46
- "width": 12,
47
- "y": <%= current_y %>,
48
- "x": 12,
49
- "type": "metric",
50
- "properties": {
51
- "metrics": [
52
- <%- primary_workers.each do |worker_name| -%>
53
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>" ]<%= worker_name == primary_workers.last ? "" : "," %>
54
- <%- end -%>
55
- ],
56
- "view": "timeSeries",
57
- "stacked": false,
58
- "region": "us-east-1",
59
- "stat": "p90",
60
- "period": 60,
61
- "title": "p90 by Worker"
62
- }
63
- },
64
- <% current_y += 3 %>
65
-
66
- { <% "Failed Jobs By Worker" %>
67
- "height": 4,
68
- "width": 12,
69
- "y": <%= current_y %>,
70
- "x": 0,
71
- "type": "metric",
72
- "properties": {
73
- "metrics": [
74
- <%- primary_workers.each do |worker_name| -%>
75
- [ "${self:custom.funktor.DashboardNamespace}", "failed", "WorkerClassName", "<%= worker_name %>" ]<%= worker_name == primary_workers.last ? "" : "," %>
76
- <%- end -%>
77
- ],
78
- "view": "timeSeries",
79
- "stacked": false,
80
- "region": "us-east-1",
81
- "title": "Failed Jobs By Worker",
82
- "period": 60,
83
- "stat": "Sum"
84
- }
85
- },
86
- { <% "p50 By Worker" %>
87
- "height": 4,
88
- "width": 12,
89
- "y": <%= current_y %>,
90
- "x": 12,
91
- "type": "metric",
92
- "properties": {
93
- "metrics": [
94
- <%- primary_workers.each do |worker_name| -%>
95
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>" ]<%= worker_name == primary_workers.last ? "" : "," %>
96
- <%- end -%>
97
- ],
98
- "view": "timeSeries",
99
- "stacked": false,
100
- "region": "us-east-1",
101
- "stat": "p50",
102
- "period": 60,
103
- "title": "p50 by Worker"
104
- }
105
- },
106
- <% current_y += 3 %>
107
-
108
- { <% "Processed Jobs By Queue" %>
109
- "height": 4,
110
- "width": 12,
111
- "y": <%= current_y %>,
112
- "x": 0,
113
- "type": "metric",
114
- "properties": {
115
- "metrics": [
116
- <%- queue_names.each do |queue_name| -%>
117
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "Queue", "<%= queue_name.underscore %>" ]<%= queue_name == queue_names.last ? "" : "," %>
118
- <%- end -%>
119
- ],
120
- "view": "timeSeries",
121
- "stacked": false,
122
- "region": "us-east-1",
123
- "title": "Processed Jobs By Queue",
124
- "period": 60,
125
- "stat": "Sum"
126
- }
127
- },
128
- { <% "p90 By Queue" %>
129
- "height": 4,
130
- "width": 12,
131
- "y": <%= current_y %>,
132
- "x": 12,
133
- "type": "metric",
134
- "properties": {
135
- "metrics": [
136
- <%- queue_names.each do |queue_name| -%>
137
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "Queue", "<%= queue_name.underscore %>" ]<%= queue_name == queue_names.last ? "" : "," %>
138
- <%- end -%>
139
- ],
140
- "view": "timeSeries",
141
- "stacked": false,
142
- "region": "us-east-1",
143
- "stat": "p90",
144
- "period": 60,
145
- "title": "p90 by Queue"
146
- }
147
- },
148
-
149
- <% current_y += 3 %>
150
- { <% "Failed Jobs By Queue" %>
151
- "height": 4,
152
- "width": 12,
153
- "y": <%= current_y %>,
154
- "x": 0,
155
- "type": "metric",
156
- "properties": {
157
- "metrics": [
158
- <%- queue_names.each do |queue_name| -%>
159
- [ "${self:custom.funktor.DashboardNamespace}", "failed", "Queue", "<%= queue_name.underscore %>" ]<%= queue_name == queue_names.last ? "" : "," %>
160
- <%- end -%>
161
- ],
162
- "view": "timeSeries",
163
- "stacked": false,
164
- "region": "us-east-1",
165
- "title": "Failed Jobs By Queue",
166
- "period": 60,
167
- "stat": "Sum"
168
- }
169
- },
170
- { <% "p50 By Queue" %>
171
- "height": 4,
172
- "width": 12,
173
- "y": <%= current_y %>,
174
- "x": 12,
175
- "type": "metric",
176
- "properties": {
177
- "metrics": [
178
- <%- queue_names.each do |queue_name| -%>
179
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "Queue", "<%= queue_name.underscore %>" ]<%= queue_name == queue_names.last ? "" : "," %>
180
- <%- end -%>
181
- ],
182
- "view": "timeSeries",
183
- "stacked": false,
184
- "region": "us-east-1",
185
- "stat": "p50",
186
- "period": 60,
187
- "title": "p50 by Queue"
188
- }
189
- },
190
- <% current_y += 3 %>
191
-
192
- { <% "Worker Overview" %>
193
- "height": 1,
194
- "width": 24,
195
- "y": <%= current_y %>,
196
- "x": 0,
197
- "type": "text",
198
- "properties": {
199
- "markdown": "\n# Worker Overviews\n"
200
- }
201
- },
202
- <% current_y += 1 %>
203
-
204
- <%- primary_workers.each_with_index do |worker_name, index| -%>
205
- <%- current_y += 5 if (index > 0 && (index % 3) == 0) %>
206
- { <% "Worker Overview" %>
207
- "height": 5,
208
- "width": 8,
209
- "y": <%= current_y %>,
210
- "x": <%= (index % 3) * 8 %>,
211
- "type": "metric",
212
- "properties": {
213
- "metrics": [
214
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "<%= worker_name %>", { "color": "#2ca02c" } ],
215
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>", { "label": "p90", "color": "#ff7f0e", "stat": "p90" } ],
216
- [ "${self:custom.funktor.DashboardNamespace}", "failed", "WorkerClassName", "<%= worker_name %>", { "color": "#d62728" } ],
217
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>", { "label": "p60", "color": "#1f77b4", "stat": "p60" } ]
218
- ],
219
- "view": "singleValue",
220
- "region": "us-east-1",
221
- "stat": "Sum",
222
- "period": 60,
223
- "sparkline": true,
224
- "title": "<%= worker_name %>"
225
- }
226
- },
227
- <%- end -%>
228
- <%#- current_y += 5 if (primary_workers.count - 1) % 3 != 0 %>
229
- <%- current_y += 5 %>
230
-
231
- { <% "Worker Overview Redux" %>
24
+ { <% "Primary Workers Overview" %>
232
25
  "height": 1,
233
26
  "width": 24,
234
27
  "y": <%= current_y %>,
235
28
  "x": 0,
236
29
  "type": "text",
237
30
  "properties": {
238
- "markdown": "\n# Worker Overviews Redux\n"
31
+ "markdown": "\n# Primary Workers Overview \n"
239
32
  }
240
33
  },
241
34
  <% current_y += 1 %>
242
35
 
243
- <%- primary_workers.each_with_index do |worker_name, index| -%>
36
+ <%- prioritized_workers.each_with_index do |worker_name, index| -%>
244
37
  <%- current_y += 9 if (index > 0 && (index % 6) == 0) %>
245
38
  { <% "Worker Overview" %>
246
39
  "height": 9,
@@ -264,243 +57,10 @@ Resources:
264
57
  }
265
58
  },
266
59
  <%- end -%>
267
- <%#- current_y += 9 if (primary_workers.count - 1) % 3 != 0 %>
60
+ <%#- current_y += 9 if (prioritized_workers.count - 1) % 3 != 0 %>
268
61
  <%- current_y += 9 %>
269
62
 
270
- { <% "Jobs/Minute Section" %>
271
- "height": 1,
272
- "width": 24,
273
- "y": <%= current_y %>,
274
- "x": 0,
275
- "type": "text",
276
- "properties": {
277
- "markdown": "\n# Jobs Per Minute By Worker\n"
278
- }
279
- },
280
- <% current_y += 1 %>
281
-
282
- <%- primary_workers.each_with_index do |worker_name, index| -%>
283
- <%- current_y += 3 if (index > 0 && (index % 6) == 0) %>
284
- { <% "Worker Jobs per minute" %>
285
- "height": 3,
286
- "width": 3,
287
- "y": <%= current_y %>,
288
- "x": <%= (index % 8) * 3 %>,
289
- "type": "metric",
290
- "properties": {
291
- "metrics": [
292
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "<%= worker_name %>" ]
293
- ],
294
- "view": "singleValue",
295
- "region": "us-east-1",
296
- "stat": "Sum",
297
- "period": 60,
298
- "sparkline": true,
299
- "title": "<%= worker_name %>"
300
- }
301
- },
302
- <%- end -%>
303
- <%- current_y += 3 if (primary_workers.count - 1) % 6 != 0 %>
304
-
305
- { <% "Failures/Minute Section" %>
306
- "height": 1,
307
- "width": 24,
308
- "y": <%= current_y %>,
309
- "x": 0,
310
- "type": "text",
311
- "properties": {
312
- "markdown": "\n# Failures Per Minute By Worker\n"
313
- }
314
- },
315
- <% current_y += 1 %>
316
-
317
- <%- primary_workers.each_with_index do |worker_name, index| -%>
318
- <%- current_y += 3 if (index > 0 && (index % 6) == 0) %>
319
- { <% "Worker Failures per minute" %>
320
- "height": 3,
321
- "width": 3,
322
- "y": <%= current_y %>,
323
- "x": <%= (index % 8) * 3 %>,
324
- "type": "metric",
325
- "properties": {
326
- "metrics": [
327
- [ "${self:custom.funktor.DashboardNamespace}", "failed", "WorkerClassName", "<%= worker_name %>" ]
328
- ],
329
- "view": "singleValue",
330
- "region": "us-east-1",
331
- "stat": "Sum",
332
- "period": 60,
333
- "sparkline": true,
334
- "title": "<%= worker_name %>"
335
- }
336
- },
337
- <%- end -%>
338
- <%- current_y += 3 if (primary_workers.count - 1) % 6 != 0 %>
339
-
340
- { <% "Duration Percentiles Section" %>
341
- "height": 1,
342
- "width": 24,
343
- "y": <%= current_y %>,
344
- "x": 0,
345
- "type": "text",
346
- "properties": {
347
- "markdown": "\n# Duration Percentiles By Worker\n"
348
- }
349
- },
350
- <% current_y += 1 %>
351
-
352
- <%- primary_workers.each_with_index do |worker_name, index| -%>
353
- <%- current_y += 5 if (index > 0 && (index % 6) == 0) %>
354
- { <% "p50 by worker" %>
355
- "height": 5,
356
- "width": 3,
357
- "y": <%= current_y %>,
358
- "x": <%= (index % 8) * 3 %>,
359
- "type": "metric",
360
- "properties": {
361
- "metrics": [
362
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>", { "color": "#d62728", "label": "p90"} ],
363
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>", { "color": "#1f77b4", "label": "p60", "stat": "p60"} ]
364
- ],
365
- "view": "singleValue",
366
- "region": "us-east-1",
367
- "stat": "p90",
368
- "period": 60,
369
- "sparkline": true,
370
- "title": "<%= worker_name %>"
371
- }
372
- },
373
- <%- end -%>
374
- <%- current_y += 5 if (primary_workers.count - 1) % 6 != 0 %>
375
-
376
-
377
-
378
-
379
-
380
- { <% "Jobs/Minute Section" %>
381
- "height": 1,
382
- "width": 24,
383
- "y": <%= current_y %>,
384
- "x": 0,
385
- "type": "text",
386
- "properties": {
387
- "markdown": "\n# Jobs Per Minute By Worker\n"
388
- }
389
- },
390
- <% current_y += 1 %>
391
-
392
-
393
- <%- primary_workers.each_with_index do |worker_name, index| -%>
394
- <%- current_y += 3 if (index > 0 && (index % 6) == 0) %>
395
- { <% "Processed Jobs By Worker" %>
396
- "height": 3,
397
- "width": 4,
398
- "y": <%= current_y %>,
399
- "x": <%= (index % 6) * 4 %>,
400
- "type": "metric",
401
- "properties": {
402
- "metrics": [
403
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "<%= worker_name %>" ]
404
- ],
405
- "view": "timeSeries",
406
- "stacked": false,
407
- "region": "us-east-1",
408
- "title": "<%= worker_name %> Jobs/Min",
409
- "period": 60,
410
- "stat": "Sum",
411
- "legend": {
412
- "position": "hidden"
413
- }
414
- }
415
- },
416
- <%- end -%>
417
- <%- current_y += 3 if (primary_workers.count - 1) % 6 != 0 %>
418
-
419
-
420
- { <% "Failures/Minute Section" %>
421
- "height": 1,
422
- "width": 24,
423
- "y": <%= current_y %>,
424
- "x": 0,
425
- "type": "text",
426
- "properties": {
427
- "markdown": "\n# Failures Per Minute By Worker\n"
428
- }
429
- },
430
- <% current_y += 1 %>
431
-
432
-
433
- <%- primary_workers.each_with_index do |worker_name, index| -%>
434
- <%- current_y += 3 if (index > 0 && (index % 6) == 0) %>
435
- { <% "Failed Jobs By Worker" %>
436
- "height": 3,
437
- "width": 4,
438
- "y": <%= current_y %>,
439
- "x": <%= (index % 6) * 4 %>,
440
- "type": "metric",
441
- "properties": {
442
- "metrics": [
443
- [ "${self:custom.funktor.DashboardNamespace}", "failed", "WorkerClassName", "<%= worker_name %>", { "color": "#d62728" } ]
444
- ],
445
- "view": "timeSeries",
446
- "stacked": false,
447
- "region": "us-east-1",
448
- "title": "<%= worker_name %> Fails/Min",
449
- "period": 60,
450
- "stat": "Sum",
451
- "legend": {
452
- "position": "hidden"
453
- }
454
- }
455
- },
456
- <%- end -%>
457
- <%- current_y += 3 if (primary_workers.count - 1) % 6 != 0 %>
458
-
459
-
460
- { <% "Duration Percentiles Section" %>
461
- "height": 1,
462
- "width": 24,
463
- "y": <%= current_y %>,
464
- "x": 0,
465
- "type": "text",
466
- "properties": {
467
- "markdown": "\n# Duration Percentiles By Worker\n"
468
- }
469
- },
470
- <% current_y += 1 %>
471
-
472
-
473
- <%- primary_workers.each_with_index do |worker_name, index| -%>
474
- <%- current_y += 4 if (index > 0 && (index % 6) == 0) %>
475
- { <% "Job Duration By Worker" %>
476
- "height": 4,
477
- "width": 4,
478
- "y": <%= current_y %>,
479
- "x": <%= (index % 6) * 4 %>,
480
- "type": "metric",
481
- "properties": {
482
- "metrics": [
483
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>", { "label": "p90", "stat": "p90", "color": "#d62728" } ],
484
- [ "...", { "label": "p80", "stat": "p80", "color": "#2ca02c" } ],
485
- [ "...", { "label": "p70", "stat": "p70", "color": "#ff7f0e" } ],
486
- [ "...", { "label": "p60", "color": "#1f77b4" } ]
487
- ],
488
- "view": "timeSeries",
489
- "stacked": false,
490
- "region": "us-east-1",
491
- "stat": "p60",
492
- "period": 60,
493
- "title": "<%= worker_name %> Duration Percentiles",
494
- "legend": {
495
- "position": "bottom"
496
- }
497
- }
498
- },
499
- <%- end -%>
500
- <%- current_y += 3 if (primary_workers.count - 1) % 6 != 0 %>
501
-
502
-
503
- <%- primary_workers.each do |worker_name| -%>
63
+ <%- prioritized_workers.each do |worker_name| -%>
504
64
  { <% "Worker" %>
505
65
  "height": 1,
506
66
  "width": 24,
@@ -773,98 +333,6 @@ Resources:
773
333
  <% current_y += 6 %>
774
334
  <%- end -%>
775
335
 
776
- { <% "Processed/Failed Jobs By Worker" %>
777
- "height": 6,
778
- "width": 12,
779
- "y": <%= current_y %>,
780
- "x": 0,
781
- "type": "metric",
782
- "properties": {
783
- "metrics": [
784
- <%- primary_workers.each do |worker_name| -%>
785
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "WorkerClassName", "<%= worker_name %>" ],
786
- [ ".", "failed", ".", "." ]<%= worker_name == primary_workers.last ? "" : "," %>
787
- <%- end -%>
788
- ],
789
- "view": "timeSeries",
790
- "stacked": false,
791
- "region": "us-east-1",
792
- "title": "Process/Failed Jobs By Worker",
793
- "period": 60,
794
- "stat": "Sum"
795
- }
796
- },
797
-
798
- { <% "Job Duration By Worker" %>
799
- "height": 6,
800
- "width": 12,
801
- "y": <%= current_y %>,
802
- "x": 12,
803
- "type": "metric",
804
- "properties": {
805
- "metrics": [
806
- <%- primary_workers.each do |worker_name| -%>
807
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "WorkerClassName", "<%= worker_name %>" ],
808
- [ "...", { "stat": "p99" } ]<%= worker_name == primary_workers.last ? "" : "," %>
809
- <%- end -%>
810
- ],
811
- "view": "timeSeries",
812
- "stacked": false,
813
- "region": "us-east-1",
814
- "stat": "Average",
815
- "period": 60,
816
- "title": "Job Duration by Worker"
817
- }
818
- },
819
-
820
-
821
- <% current_y += 6 %>
822
-
823
- { <% "Job Duration By Queue" %>
824
- "height": 6,
825
- "width": 12,
826
- "y": <%= current_y %>,
827
- "x": 12,
828
- "type": "metric",
829
- "properties": {
830
- "metrics": [
831
- <%- queue_names.each do |queue_name| -%>
832
- [ "${self:custom.funktor.DashboardNamespace}", "Duration", "Queue", "<%= queue_name.underscore %>" ],
833
- [ "...", { "stat": "p99" } ]<%= queue_name == queue_names.last ? "" : "," %>
834
- <%- end -%>
835
- ],
836
- "view": "timeSeries",
837
- "stacked": false,
838
- "region": "us-east-1",
839
- "stat": "Average",
840
- "period": 60,
841
- "title": "Job Duration by Queue"
842
- }
843
- },
844
- { <% "Processed/Failed Jobs By Queue" %>
845
- "height": 6,
846
- "width": 12,
847
- "y": <%= current_y %>,
848
- "x": 0,
849
- "type": "metric",
850
- "properties": {
851
- "metrics": [
852
- <%- queue_names.each do |queue_name| -%>
853
- [ "${self:custom.funktor.DashboardNamespace}", "processed", "Queue", "<%= queue_name.underscore %>" ],
854
- [ ".", "failed", ".", "." ]<%= queue_name == queue_names.last ? "" : "," %>
855
- <%- end -%>
856
- ],
857
- "view": "timeSeries",
858
- "stacked": false,
859
- "region": "us-east-1",
860
- "title": "Process/Failed Jobs By Queue",
861
- "period": 60,
862
- "stat": "Sum"
863
- }
864
- },
865
-
866
-
867
- <% current_y += 3 %>
868
336
  { <% "Funktor Behind the Scenes Banner" %>
869
337
  "height": 3,
870
338
  "width": 24,
data/lib/funktor/job.rb CHANGED
@@ -26,7 +26,11 @@ module Funktor
26
26
  end
27
27
 
28
28
  def worker_class_name
29
- job_data["worker"]
29
+ if job_data["worker"] == "ActiveJob::QueueAdapters::FunktorAdapter::JobWrapper"
30
+ job_data["wrapped"]
31
+ else
32
+ job_data["worker"]
33
+ end
30
34
  end
31
35
 
32
36
  def job_id
@@ -1,3 +1,3 @@
1
1
  module Funktor
2
- VERSION = "0.7.14"
2
+ VERSION = "0.7.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: funktor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.14
4
+ version: 0.7.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-19 00:00:00.000000000 Z
11
+ date: 2022-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sqs