appsignal 3.9.2-java → 3.10.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +3138 -0
  3. data/.rubocop.yml +28 -20
  4. data/.rubocop_todo.yml +7 -33
  5. data/CHANGELOG.md +130 -0
  6. data/README.md +0 -1
  7. data/Rakefile +80 -65
  8. data/appsignal.gemspec +1 -1
  9. data/build_matrix.yml +112 -184
  10. data/ext/base.rb +1 -1
  11. data/gemfiles/hanami-2.1.gemfile +7 -0
  12. data/gemfiles/webmachine1.gemfile +5 -4
  13. data/lib/appsignal/cli/diagnose.rb +1 -1
  14. data/lib/appsignal/config.rb +5 -1
  15. data/lib/appsignal/demo.rb +0 -1
  16. data/lib/appsignal/environment.rb +11 -2
  17. data/lib/appsignal/extension/jruby.rb +1 -1
  18. data/lib/appsignal/helpers/instrumentation.rb +164 -2
  19. data/lib/appsignal/hooks/active_job.rb +1 -6
  20. data/lib/appsignal/integrations/grape.rb +19 -47
  21. data/lib/appsignal/integrations/hanami.rb +8 -7
  22. data/lib/appsignal/integrations/padrino.rb +51 -52
  23. data/lib/appsignal/integrations/railtie.rb +0 -3
  24. data/lib/appsignal/integrations/rake.rb +46 -12
  25. data/lib/appsignal/integrations/sidekiq.rb +1 -11
  26. data/lib/appsignal/integrations/sinatra.rb +0 -1
  27. data/lib/appsignal/integrations/webmachine.rb +15 -9
  28. data/lib/appsignal/probes/gvl.rb +24 -2
  29. data/lib/appsignal/probes/sidekiq.rb +1 -1
  30. data/lib/appsignal/probes.rb +1 -1
  31. data/lib/appsignal/rack/abstract_middleware.rb +104 -33
  32. data/lib/appsignal/rack/body_wrapper.rb +143 -0
  33. data/lib/appsignal/rack/event_handler.rb +12 -3
  34. data/lib/appsignal/rack/generic_instrumentation.rb +5 -4
  35. data/lib/appsignal/rack/grape_middleware.rb +40 -0
  36. data/lib/appsignal/rack/hanami_middleware.rb +2 -12
  37. data/lib/appsignal/rack/instrumentation_middleware.rb +62 -0
  38. data/lib/appsignal/rack/rails_instrumentation.rb +14 -57
  39. data/lib/appsignal/rack/sinatra_instrumentation.rb +1 -3
  40. data/lib/appsignal/rack/streaming_listener.rb +13 -59
  41. data/lib/appsignal/rack.rb +31 -0
  42. data/lib/appsignal/transaction.rb +50 -8
  43. data/lib/appsignal/utils/integration_memory_logger.rb +78 -0
  44. data/lib/appsignal/utils.rb +1 -0
  45. data/lib/appsignal/version.rb +1 -1
  46. data/lib/appsignal.rb +36 -33
  47. data/spec/.rubocop.yml +1 -1
  48. data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
  49. data/spec/lib/appsignal/cli/install_spec.rb +3 -3
  50. data/spec/lib/appsignal/config_spec.rb +8 -5
  51. data/spec/lib/appsignal/demo_spec.rb +38 -41
  52. data/spec/lib/appsignal/hooks/action_cable_spec.rb +86 -167
  53. data/spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb +8 -20
  54. data/spec/lib/appsignal/hooks/active_support_notifications/instrument_shared_examples.rb +38 -84
  55. data/spec/lib/appsignal/hooks/active_support_notifications/start_finish_shared_examples.rb +16 -37
  56. data/spec/lib/appsignal/hooks/active_support_notifications_spec.rb +4 -4
  57. data/spec/lib/appsignal/hooks/activejob_spec.rb +111 -200
  58. data/spec/lib/appsignal/hooks/delayed_job_spec.rb +54 -91
  59. data/spec/lib/appsignal/hooks/dry_monitor_spec.rb +14 -32
  60. data/spec/lib/appsignal/hooks/excon_spec.rb +8 -12
  61. data/spec/lib/appsignal/hooks/net_http_spec.rb +7 -42
  62. data/spec/lib/appsignal/hooks/rake_spec.rb +107 -34
  63. data/spec/lib/appsignal/hooks/redis_client_spec.rb +18 -30
  64. data/spec/lib/appsignal/hooks/redis_spec.rb +10 -16
  65. data/spec/lib/appsignal/hooks/resque_spec.rb +42 -62
  66. data/spec/lib/appsignal/hooks/shoryuken_spec.rb +33 -74
  67. data/spec/lib/appsignal/integrations/hanami_spec.rb +79 -21
  68. data/spec/lib/appsignal/integrations/http_spec.rb +12 -20
  69. data/spec/lib/appsignal/integrations/net_http_spec.rb +33 -0
  70. data/spec/lib/appsignal/integrations/object_spec.rb +29 -36
  71. data/spec/lib/appsignal/integrations/padrino_spec.rb +190 -163
  72. data/spec/lib/appsignal/integrations/que_spec.rb +43 -70
  73. data/spec/lib/appsignal/integrations/railtie_spec.rb +26 -67
  74. data/spec/lib/appsignal/integrations/sidekiq_spec.rb +86 -160
  75. data/spec/lib/appsignal/integrations/sinatra_spec.rb +10 -3
  76. data/spec/lib/appsignal/integrations/webmachine_spec.rb +77 -40
  77. data/spec/lib/appsignal/probes/gvl_spec.rb +80 -3
  78. data/spec/lib/appsignal/probes_spec.rb +7 -4
  79. data/spec/lib/appsignal/rack/abstract_middleware_spec.rb +302 -105
  80. data/spec/lib/appsignal/rack/body_wrapper_spec.rb +263 -0
  81. data/spec/lib/appsignal/rack/event_handler_spec.rb +81 -78
  82. data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +70 -27
  83. data/spec/lib/appsignal/rack/grape_middleware_spec.rb +234 -0
  84. data/spec/lib/appsignal/rack/hanami_middleware_spec.rb +2 -16
  85. data/spec/lib/appsignal/rack/instrumentation_middleware_spec.rb +38 -0
  86. data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +67 -131
  87. data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +36 -44
  88. data/spec/lib/appsignal/rack/streaming_listener_spec.rb +44 -139
  89. data/spec/lib/appsignal/transaction_spec.rb +239 -94
  90. data/spec/lib/appsignal/utils/integration_memory_logger_spec.rb +163 -0
  91. data/spec/lib/appsignal_spec.rb +556 -344
  92. data/spec/support/helpers/dependency_helper.rb +6 -1
  93. data/spec/support/helpers/std_streams_helper.rb +1 -1
  94. data/spec/support/helpers/transaction_helpers.rb +8 -0
  95. data/spec/support/matchers/transaction.rb +185 -0
  96. data/spec/support/mocks/dummy_app.rb +20 -0
  97. data/spec/support/shared_examples/instrument.rb +17 -12
  98. data/spec/support/testing.rb +18 -9
  99. metadata +20 -11
  100. data/.semaphore/semaphore.yml +0 -2347
  101. data/script/lint_git +0 -22
  102. data/spec/lib/appsignal/integrations/grape_spec.rb +0 -239
  103. data/spec/support/matchers/be_completed.rb +0 -5
  104. data/support/check_versions +0 -22
  105. /data/gemfiles/{hanami.gemfile → hanami-2.0.gemfile} +0 -0
@@ -5,54 +5,33 @@ shared_examples "activesupport start finish override" do
5
5
  instrumenter.start("sql.active_record", :sql => "SQL")
6
6
  instrumenter.finish("sql.active_record", {})
7
7
 
8
- expect(transaction.to_h["events"]).to match([
9
- {
10
- "allocation_count" => kind_of(Integer),
11
- "body" => "",
12
- "body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
13
- "child_allocation_count" => kind_of(Integer),
14
- "child_duration" => kind_of(Float),
15
- "child_gc_duration" => kind_of(Float),
16
- "count" => 1,
17
- "duration" => kind_of(Float),
18
- "gc_duration" => kind_of(Float),
19
- "name" => "sql.active_record",
20
- "start" => kind_of(Float),
21
- "title" => ""
22
- }
23
- ])
8
+ expect(transaction).to include_event(
9
+ "body" => "",
10
+ "body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
11
+ "count" => 1,
12
+ "name" => "sql.active_record",
13
+ "title" => ""
14
+ )
24
15
  end
25
16
 
26
17
  it "instruments an ActiveSupport::Notifications.start/finish event with payload on finish" do
27
18
  instrumenter.start("sql.active_record", {})
28
19
  instrumenter.finish("sql.active_record", :sql => "SQL")
29
20
 
30
- expect(transaction.to_h["events"]).to match([
31
- {
32
- "allocation_count" => kind_of(Integer),
33
- "body" => "SQL",
34
- "body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
35
- "child_allocation_count" => kind_of(Integer),
36
- "child_duration" => kind_of(Float),
37
- "child_gc_duration" => kind_of(Float),
38
- "count" => 1,
39
- "duration" => kind_of(Float),
40
- "gc_duration" => kind_of(Float),
41
- "name" => "sql.active_record",
42
- "start" => kind_of(Float),
43
- "title" => ""
44
- }
45
- ])
21
+ expect(transaction).to include_event(
22
+ "body" => "SQL",
23
+ "body_format" => Appsignal::EventFormatter::SQL_BODY_FORMAT,
24
+ "count" => 1,
25
+ "name" => "sql.active_record",
26
+ "title" => ""
27
+ )
46
28
  end
47
29
 
48
30
  it "does not instrument events whose name starts with a bang" do
49
- expect(Appsignal::Transaction.current).not_to receive(:start_event)
50
- expect(Appsignal::Transaction.current).not_to receive(:finish_event)
51
-
52
31
  instrumenter.start("!sql.active_record", {})
53
32
  instrumenter.finish("!sql.active_record", {})
54
33
 
55
- expect(transaction.to_h["events"]).to be_empty
34
+ expect(transaction).to_not include_events
56
35
  end
57
36
 
58
37
  context "when a transaction is completed in an instrumented block" do
@@ -63,7 +42,7 @@ shared_examples "activesupport start finish override" do
63
42
  Appsignal::Transaction.complete_current!
64
43
  instrumenter.finish("sql.active_record", {})
65
44
 
66
- expect(transaction.to_h["events"]).to match([])
45
+ expect(transaction).to_not include_events
67
46
  end
68
47
  end
69
48
  end
@@ -1,4 +1,4 @@
1
- require_relative "./active_support_notifications/instrument_shared_examples"
1
+ require_relative "active_support_notifications/instrument_shared_examples"
2
2
 
3
3
  describe Appsignal::Hooks::ActiveSupportNotificationsHook do
4
4
  if active_support_present?
@@ -23,19 +23,19 @@ describe Appsignal::Hooks::ActiveSupportNotificationsHook do
23
23
  it_behaves_like "activesupport instrument override"
24
24
 
25
25
  if defined?(::ActiveSupport::Notifications::Fanout::Handle)
26
- require_relative "./active_support_notifications/start_finish_shared_examples"
26
+ require_relative "active_support_notifications/start_finish_shared_examples"
27
27
 
28
28
  it_behaves_like "activesupport start finish override"
29
29
  end
30
30
 
31
31
  if ::ActiveSupport::Notifications::Instrumenter.method_defined?(:start)
32
- require_relative "./active_support_notifications/start_finish_shared_examples"
32
+ require_relative "active_support_notifications/start_finish_shared_examples"
33
33
 
34
34
  it_behaves_like "activesupport start finish override"
35
35
  end
36
36
 
37
37
  if ::ActiveSupport::Notifications::Instrumenter.method_defined?(:finish_with_state)
38
- require_relative "./active_support_notifications/finish_with_state_shared_examples"
38
+ require_relative "active_support_notifications/finish_with_state_shared_examples"
39
39
 
40
40
  it_behaves_like "activesupport finish_with_state override"
41
41
  end
@@ -119,25 +119,19 @@ if DependencyHelper.active_job_present?
119
119
  queue_job(ActiveJobTestJob)
120
120
 
121
121
  transaction = last_transaction
122
- transaction_hash = transaction.to_h
123
- expect(transaction_hash).to include(
124
- "action" => "ActiveJobTestJob#perform",
125
- "error" => nil,
126
- "namespace" => namespace,
127
- "metadata" => {},
128
- "sample_data" => hash_including(
129
- "params" => [],
130
- "tags" => {
131
- "active_job_id" => kind_of(String),
132
- "queue" => queue,
133
- "executions" => 1
134
- }
135
- )
122
+ expect(transaction).to have_namespace(namespace)
123
+ expect(transaction).to have_action("ActiveJobTestJob#perform")
124
+ expect(transaction).to_not have_error
125
+ expect(transaction).to_not include_metadata
126
+ expect(transaction).to include_params([])
127
+ expect(transaction).to include_tags(
128
+ "active_job_id" => kind_of(String),
129
+ "queue" => queue,
130
+ "executions" => 1
136
131
  )
137
- events = transaction_hash["events"]
132
+ events = transaction.to_h["events"]
138
133
  .sort_by { |e| e["start"] }
139
134
  .map { |event| event["name"] }
140
-
141
135
  expect(events).to eq(expected_perform_events)
142
136
  end
143
137
 
@@ -148,13 +142,7 @@ if DependencyHelper.active_job_present?
148
142
  .with("active_job_queue_job_count", 1, tags.merge(:status => :processed))
149
143
  queue_job(ActiveJobCustomQueueTestJob)
150
144
 
151
- transaction = last_transaction
152
- transaction_hash = transaction.to_h
153
- expect(transaction_hash).to include(
154
- "sample_data" => hash_including(
155
- "tags" => hash_including("queue" => "custom_queue")
156
- )
157
- )
145
+ expect(last_transaction).to include_tags("queue" => "custom_queue")
158
146
  end
159
147
  end
160
148
 
@@ -182,13 +170,7 @@ if DependencyHelper.active_job_present?
182
170
 
183
171
  queue_job(ActiveJobPriorityTestJob)
184
172
 
185
- transaction = last_transaction
186
- transaction_hash = transaction.to_h
187
- expect(transaction_hash).to include(
188
- "sample_data" => hash_including(
189
- "tags" => hash_including("queue" => queue, "priority" => 10)
190
- )
191
- )
173
+ expect(last_transaction).to include_tags("queue" => queue, "priority" => 10)
192
174
  end
193
175
  end
194
176
  end
@@ -207,29 +189,20 @@ if DependencyHelper.active_job_present?
207
189
  end.to raise_error(RuntimeError, "uh oh")
208
190
 
209
191
  transaction = last_transaction
210
- transaction_hash = transaction.to_h
211
- expect(transaction_hash).to include(
212
- "action" => "ActiveJobErrorTestJob#perform",
213
- "error" => {
214
- "name" => "RuntimeError",
215
- "message" => "uh oh",
216
- "backtrace" => kind_of(String)
217
- },
218
- "namespace" => namespace,
219
- "metadata" => {},
220
- "sample_data" => hash_including(
221
- "params" => [],
222
- "tags" => {
223
- "active_job_id" => kind_of(String),
224
- "queue" => queue,
225
- "executions" => 1
226
- }
227
- )
192
+ expect(transaction).to have_namespace(namespace)
193
+ expect(transaction).to have_action("ActiveJobErrorTestJob#perform")
194
+ expect(transaction).to have_error("RuntimeError", "uh oh")
195
+ expect(transaction).to_not include_metadata
196
+ expect(transaction).to include_params([])
197
+ expect(transaction).to include_tags(
198
+ "active_job_id" => kind_of(String),
199
+ "queue" => queue,
200
+ "executions" => 1
228
201
  )
229
- events = transaction_hash["events"]
202
+
203
+ events = transaction.to_h["events"]
230
204
  .sort_by { |e| e["start"] }
231
205
  .map { |event| event["name"] }
232
-
233
206
  expect(events).to eq(expected_perform_events)
234
207
  end
235
208
 
@@ -247,9 +220,7 @@ if DependencyHelper.active_job_present?
247
220
  queue_job(ActiveJobErrorTestJob)
248
221
  end.to raise_error(RuntimeError, "uh oh")
249
222
 
250
- transaction = last_transaction
251
- transaction_hash = transaction.to_h
252
- expect(transaction_hash).to include("error" => nil)
223
+ expect(last_transaction).to_not have_error
253
224
  end
254
225
  end
255
226
 
@@ -270,15 +241,8 @@ if DependencyHelper.active_job_present?
270
241
  end
271
242
 
272
243
  transaction = last_transaction
273
- transaction_hash = transaction.to_h
274
- expect(transaction_hash).to include(
275
- "error" => nil,
276
- "sample_data" => hash_including(
277
- "tags" => hash_including(
278
- "executions" => 1
279
- )
280
- )
281
- )
244
+ expect(transaction).to_not have_error
245
+ expect(transaction).to include_tags("executions" => 1)
282
246
  end
283
247
 
284
248
  it "reports error when discarding the job" do
@@ -294,19 +258,8 @@ if DependencyHelper.active_job_present?
294
258
  end
295
259
 
296
260
  transaction = last_transaction
297
- transaction_hash = transaction.to_h
298
- expect(transaction_hash).to include(
299
- "error" => {
300
- "name" => "RuntimeError",
301
- "message" => "uh oh",
302
- "backtrace" => kind_of(String)
303
- },
304
- "sample_data" => hash_including(
305
- "tags" => hash_including(
306
- "executions" => 2
307
- )
308
- )
309
- )
261
+ expect(transaction).to have_error("RuntimeError", "uh oh")
262
+ expect(transaction).to include_tags("executions" => 2)
310
263
  end
311
264
  end
312
265
  end
@@ -343,13 +296,7 @@ if DependencyHelper.active_job_present?
343
296
  queue_job(ActiveJobErrorPriorityTestJob)
344
297
  end.to raise_error(RuntimeError, "uh oh")
345
298
 
346
- transaction = last_transaction
347
- transaction_hash = transaction.to_h
348
- expect(transaction_hash).to include(
349
- "sample_data" => hash_including(
350
- "tags" => hash_including("queue" => queue, "priority" => 10)
351
- )
352
- )
299
+ expect(last_transaction).to include_tags("queue" => queue, "priority" => 10)
353
300
  end
354
301
  end
355
302
  end
@@ -363,51 +310,39 @@ if DependencyHelper.active_job_present?
363
310
  end.to raise_error(RuntimeError, "uh oh")
364
311
  end
365
312
 
366
- transaction = last_transaction
367
- transaction_hash = transaction.to_h
368
- expect(transaction_hash).to include(
369
- "sample_data" => hash_including(
370
- "tags" => hash_including("executions" => 2)
371
- )
372
- )
313
+ expect(last_transaction).to include_tags("executions" => 2)
373
314
  end
374
315
  end
375
316
 
376
317
  context "when wrapped in another transaction" do
377
318
  it "does not create a new transaction or close the currently open one" do
378
319
  current_transaction = background_job_transaction
379
- allow(current_transaction).to receive(:complete).and_call_original
380
320
  set_current_transaction current_transaction
381
321
 
382
322
  queue_job(ActiveJobTestJob)
383
323
 
384
324
  expect(created_transactions.count).to eql(1)
385
- expect(current_transaction).to_not have_received(:complete)
386
- current_transaction.complete
387
325
 
388
326
  transaction = current_transaction
389
- transaction_hash = transaction.to_h
327
+ expect(transaction).to_not be_completed
328
+ transaction._sample
390
329
  # It does set data on the transaction
391
- expect(transaction_hash).to include(
392
- "id" => current_transaction.transaction_id,
393
- "action" => "ActiveJobTestJob#perform",
394
- "error" => nil,
395
- "namespace" => namespace,
396
- "metadata" => {},
397
- "sample_data" => hash_including(
398
- "params" => [],
399
- "tags" => {
400
- "active_job_id" => kind_of(String),
401
- "queue" => queue,
402
- "executions" => 1
403
- }
404
- )
330
+ expect(transaction).to have_namespace(namespace)
331
+ expect(transaction).to have_id(current_transaction.transaction_id)
332
+ expect(transaction).to have_action("ActiveJobTestJob#perform")
333
+ expect(transaction).to_not have_error
334
+ expect(transaction).to_not include_metadata
335
+ expect(transaction).to include_params([])
336
+ expect(transaction).to include_tags(
337
+ "active_job_id" => kind_of(String),
338
+ "queue" => queue,
339
+ "executions" => 1
405
340
  )
406
- events = transaction_hash["events"]
341
+
342
+ events = transaction.to_h["events"]
407
343
  .reject { |e| e["name"] == "enqueue.active_job" }
408
344
  .sort_by { |e| e["start"] }
409
345
  .map { |event| event["name"] }
410
-
411
346
  expect(events).to eq(expected_perform_events)
412
347
  end
413
348
  end
@@ -467,9 +402,7 @@ if DependencyHelper.active_job_present?
467
402
  it "sets provider_job_id as tag" do
468
403
  queue_job(ProviderWrappedActiveJobTestJob)
469
404
 
470
- transaction = last_transaction
471
- transaction_hash = transaction.to_h
472
- expect(transaction_hash["sample_data"]["tags"]).to include(
405
+ expect(last_transaction).to include_tags(
473
406
  "provider_job_id" => "my_provider_job_id"
474
407
  )
475
408
  end
@@ -506,13 +439,10 @@ if DependencyHelper.active_job_present?
506
439
  end
507
440
 
508
441
  it "sets queue time on transaction" do
509
- allow_any_instance_of(Appsignal::Transaction).to receive(:set_queue_start).and_call_original
510
442
  queue_job(ProviderWrappedActiveJobTestJob)
511
443
 
512
- transaction = last_transaction
513
444
  queue_time = Time.parse("2020-10-10T10:10:10Z")
514
- expect(transaction).to have_received(:set_queue_start)
515
- .with((queue_time.to_f * 1_000).to_i)
445
+ expect(last_transaction).to have_queue_start((queue_time.to_f * 1_000).to_i)
516
446
  end
517
447
  end
518
448
 
@@ -534,18 +464,14 @@ if DependencyHelper.active_job_present?
534
464
  perform_mailer(ActionMailerTestJob, :welcome)
535
465
 
536
466
  transaction = last_transaction
537
- transaction_hash = transaction.to_h
538
- expect(transaction_hash).to include(
539
- "action" => "ActionMailerTestJob#welcome",
540
- "sample_data" => hash_including(
541
- "params" => ["ActionMailerTestJob", "welcome",
542
- "deliver_now"] + active_job_args_wrapper,
543
- "tags" => {
544
- "active_job_id" => kind_of(String),
545
- "queue" => "mailers",
546
- "executions" => 1
547
- }
548
- )
467
+ expect(transaction).to have_action("ActionMailerTestJob#welcome")
468
+ expect(transaction).to include_params(
469
+ ["ActionMailerTestJob", "welcome", "deliver_now"] + active_job_args_wrapper
470
+ )
471
+ expect(transaction).to include_tags(
472
+ "active_job_id" => kind_of(String),
473
+ "queue" => "mailers",
474
+ "executions" => 1
549
475
  )
550
476
  end
551
477
  end
@@ -555,18 +481,15 @@ if DependencyHelper.active_job_present?
555
481
  perform_mailer(ActionMailerTestJob, :welcome, method_given_args)
556
482
 
557
483
  transaction = last_transaction
558
- transaction_hash = transaction.to_h
559
- expect(transaction_hash).to include(
560
- "action" => "ActionMailerTestJob#welcome",
561
- "sample_data" => hash_including(
562
- "params" => ["ActionMailerTestJob", "welcome",
563
- "deliver_now"] + active_job_args_wrapper(:args => method_expected_args),
564
- "tags" => {
565
- "active_job_id" => kind_of(String),
566
- "queue" => "mailers",
567
- "executions" => 1
568
- }
569
- )
484
+ expect(transaction).to have_action("ActionMailerTestJob#welcome")
485
+ expect(transaction).to include_params(
486
+ ["ActionMailerTestJob", "welcome",
487
+ "deliver_now"] + active_job_args_wrapper(:args => method_expected_args)
488
+ )
489
+ expect(transaction).to include_tags(
490
+ "active_job_id" => kind_of(String),
491
+ "queue" => "mailers",
492
+ "executions" => 1
570
493
  )
571
494
  end
572
495
  end
@@ -577,21 +500,18 @@ if DependencyHelper.active_job_present?
577
500
  perform_mailer(ActionMailerTestJob, :welcome, parameterized_given_args)
578
501
 
579
502
  transaction = last_transaction
580
- transaction_hash = transaction.to_h
581
- expect(transaction_hash).to include(
582
- "action" => "ActionMailerTestJob#welcome",
583
- "sample_data" => hash_including(
584
- "params" => [
585
- "ActionMailerTestJob",
586
- "welcome",
587
- "deliver_now"
588
- ] + active_job_args_wrapper(:params => parameterized_expected_args),
589
- "tags" => {
590
- "active_job_id" => kind_of(String),
591
- "queue" => "mailers",
592
- "executions" => 1
593
- }
594
- )
503
+ expect(transaction).to have_action("ActionMailerTestJob#welcome")
504
+ expect(transaction).to include_params(
505
+ [
506
+ "ActionMailerTestJob",
507
+ "welcome",
508
+ "deliver_now"
509
+ ] + active_job_args_wrapper(:params => parameterized_expected_args)
510
+ )
511
+ expect(transaction).to include_tags(
512
+ "active_job_id" => kind_of(String),
513
+ "queue" => "mailers",
514
+ "executions" => 1
595
515
  )
596
516
  end
597
517
  end
@@ -618,22 +538,19 @@ if DependencyHelper.active_job_present?
618
538
  perform_mailer(ActionMailerTestMailDeliveryJob, :welcome)
619
539
 
620
540
  transaction = last_transaction
621
- transaction_hash = transaction.to_h
622
- expect(transaction_hash).to include(
623
- "action" => "ActionMailerTestMailDeliveryJob#welcome",
624
- "sample_data" => hash_including(
625
- "params" => [
626
- "ActionMailerTestMailDeliveryJob",
627
- "welcome",
628
- "deliver_now",
629
- { active_job_internal_key => ["args"], "args" => [] }
630
- ],
631
- "tags" => {
632
- "active_job_id" => kind_of(String),
633
- "queue" => "mailers",
634
- "executions" => 1
635
- }
636
- )
541
+ expect(transaction).to have_action("ActionMailerTestMailDeliveryJob#welcome")
542
+ expect(transaction).to include_params(
543
+ [
544
+ "ActionMailerTestMailDeliveryJob",
545
+ "welcome",
546
+ "deliver_now",
547
+ { active_job_internal_key => ["args"], "args" => [] }
548
+ ]
549
+ )
550
+ expect(transaction).to include_tags(
551
+ "active_job_id" => kind_of(String),
552
+ "queue" => "mailers",
553
+ "executions" => 1
637
554
  )
638
555
  end
639
556
 
@@ -642,25 +559,22 @@ if DependencyHelper.active_job_present?
642
559
  perform_mailer(ActionMailerTestMailDeliveryJob, :welcome, method_given_args)
643
560
 
644
561
  transaction = last_transaction
645
- transaction_hash = transaction.to_h
646
- expect(transaction_hash).to include(
647
- "action" => "ActionMailerTestMailDeliveryJob#welcome",
648
- "sample_data" => hash_including(
649
- "params" => [
650
- "ActionMailerTestMailDeliveryJob",
651
- "welcome",
652
- "deliver_now",
653
- {
654
- active_job_internal_key => ["args"],
655
- "args" => method_expected_args
656
- }
657
- ],
658
- "tags" => {
659
- "active_job_id" => kind_of(String),
660
- "queue" => "mailers",
661
- "executions" => 1
562
+ expect(transaction).to have_action("ActionMailerTestMailDeliveryJob#welcome")
563
+ expect(transaction).to include_params(
564
+ [
565
+ "ActionMailerTestMailDeliveryJob",
566
+ "welcome",
567
+ "deliver_now",
568
+ {
569
+ active_job_internal_key => ["args"],
570
+ "args" => method_expected_args
662
571
  }
663
- )
572
+ ]
573
+ )
574
+ expect(transaction).to include_tags(
575
+ "active_job_id" => kind_of(String),
576
+ "queue" => "mailers",
577
+ "executions" => 1
664
578
  )
665
579
  end
666
580
  end
@@ -670,11 +584,9 @@ if DependencyHelper.active_job_present?
670
584
  perform_mailer(ActionMailerTestMailDeliveryJob, :welcome, parameterized_given_args)
671
585
 
672
586
  transaction = last_transaction
673
- transaction_hash = transaction.to_h
674
- expect(transaction_hash).to include(
675
- "action" => "ActionMailerTestMailDeliveryJob#welcome",
676
- "sample_data" => hash_including(
677
- "params" => [
587
+ expect(transaction).to have_action("ActionMailerTestMailDeliveryJob#welcome")
588
+ expect(transaction).to include_params(
589
+ [
678
590
  "ActionMailerTestMailDeliveryJob",
679
591
  "welcome",
680
592
  "deliver_now",
@@ -683,13 +595,12 @@ if DependencyHelper.active_job_present?
683
595
  "args" => [],
684
596
  "params" => parameterized_expected_args
685
597
  }
686
- ],
687
- "tags" => {
688
- "active_job_id" => kind_of(String),
689
- "queue" => "mailers",
690
- "executions" => 1
691
- }
598
+ ]
692
599
  )
600
+ expect(transaction).to include_tags(
601
+ "active_job_id" => kind_of(String),
602
+ "queue" => "mailers",
603
+ "executions" => 1
693
604
  )
694
605
  end
695
606
  end