appsignal 2.11.0.beta.3 → 2.11.0.beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d8565582bb357410dee8c4683c62da303f2b1cbbb9dc5dcc0494b03761a7c55
4
- data.tar.gz: 7270ef47a9574e21887a8044d1934abdddb75293f919ab3ebda55ce5fb4afd3b
3
+ metadata.gz: b0817fdd28fcb7bd6bd93f42a4a42939b6059076ba5bb1db77c1d8a6897631e7
4
+ data.tar.gz: fd9d4818ca5126d282aff16930a1be2a3968da40279a3a6c0ff221719aa1b999
5
5
  SHA512:
6
- metadata.gz: 233fc5bb7044fab5c6743a6516be7e2058f211aa4ce94529f4a7bde232fc803f6b4833987bf308578c4f7760b86a9ea3f437edf91b796b977fb115100d1e4ee4
7
- data.tar.gz: 123e21c4bd820b766d011fdbc221c243ca2b746745e8a8b9de785fe432b599315d3b17c72b8627479c25490d754947d00501d8dd796ff402758343e0fc53a06e
6
+ metadata.gz: 76d76b6a5c32bd596ab975c2b34a5f7a3e4c295fd12da00ee1d03b83cb2654d4a9133f69a278ab617684af78a18d8af789f9609b6e9525cc9a99484c10857627
7
+ data.tar.gz: c8c1d34eb4484bb847c35ff75e023c73fc08090ff8d17ecb010d985792b440e36e2812d6ef8dd6945bf23e82c6547f75c6fa24ddd296b49332990b267718ae3c
@@ -18,6 +18,11 @@
18
18
  agents. Commit ba9afb538f44c68b8035a8cf40a39d89bc77b021
19
19
  - Add support for Active Job priority. PR #632
20
20
  - Track Active Job job metrics for magic dashboard. PR #633
21
+ - Report Sidekiq `jid` (job id) as transaction id, reported as "request_id" on
22
+ AppSignal.com. PR #640
23
+ - Always report Active Job ID, an internal ID used by Active Job. PR #639
24
+ - Support Delayed::Job jobs without specific method name, using
25
+ `Delayed::Job.enqueue`. PR #642
21
26
 
22
27
  # 2.10.9
23
28
  - Use http proxy if configured when downloading agent. PR #606
@@ -41,11 +41,7 @@ module Appsignal
41
41
  transaction.set_error(exception)
42
42
  raise exception
43
43
  ensure
44
- tags = {}
45
- queue = job["queue_name"]
46
- tags[:queue] = queue if queue
47
- priority = job["priority"]
48
- tags[:priority] = priority if priority
44
+ tags = ActiveJobHelpers.tags_for_job(job)
49
45
 
50
46
  if transaction
51
47
  transaction.params =
@@ -54,7 +50,8 @@ module Appsignal
54
50
  Appsignal.config[:filter_parameters]
55
51
  )
56
52
 
57
- transaction_tags = tags
53
+ transaction_tags = tags.dup
54
+ transaction_tags["active_job_id"] = job["job_id"]
58
55
  provider_job_id = job["provider_job_id"]
59
56
  if provider_job_id
60
57
  transaction_tags[:provider_job_id] = provider_job_id
@@ -99,6 +96,15 @@ module Appsignal
99
96
  end
100
97
  end
101
98
 
99
+ def self.tags_for_job(job)
100
+ tags = {}
101
+ queue = job["queue_name"]
102
+ tags[:queue] = queue if queue
103
+ priority = job["priority"]
104
+ tags[:priority] = priority if priority
105
+ tags
106
+ end
107
+
102
108
  def self.increment_counter(key, value, tags = {})
103
109
  Appsignal.increment_counter "active_job_#{key}", value, tags
104
110
  end
@@ -35,7 +35,7 @@ module Appsignal
35
35
  def call(_worker, item, _queue)
36
36
  job_status = nil
37
37
  transaction = Appsignal::Transaction.create(
38
- SecureRandom.uuid,
38
+ item["jid"],
39
39
  Appsignal::Transaction::BACKGROUND_JOB,
40
40
  Appsignal::Transaction::GenericRequest.new(
41
41
  :queue_start => item["enqueued_at"]
@@ -64,7 +64,7 @@ module Appsignal
64
64
  dot_split = default_name.split(".")
65
65
  return default_name if dot_split.length == 2
66
66
 
67
- ["unknown"]
67
+ "#{default_name}#perform"
68
68
  end
69
69
 
70
70
  def self.extract_value(object_or_hash, field, default_value = nil, convert_to_s = false)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.11.0.beta.3".freeze
4
+ VERSION = "2.11.0.beta.4".freeze
5
5
  end
@@ -110,7 +110,10 @@ if DependencyHelper.active_job_present?
110
110
  "metadata" => {},
111
111
  "sample_data" => hash_including(
112
112
  "params" => [],
113
- "tags" => { "queue" => queue }
113
+ "tags" => {
114
+ "active_job_id" => kind_of(String),
115
+ "queue" => queue
116
+ }
114
117
  )
115
118
  )
116
119
  events = transaction_hash["events"]
@@ -130,7 +133,7 @@ if DependencyHelper.active_job_present?
130
133
  transaction_hash = transaction.to_h
131
134
  expect(transaction_hash).to include(
132
135
  "sample_data" => hash_including(
133
- "tags" => { "queue" => "custom_queue" }
136
+ "tags" => hash_including("queue" => "custom_queue")
134
137
  )
135
138
  )
136
139
  end
@@ -161,7 +164,7 @@ if DependencyHelper.active_job_present?
161
164
  transaction_hash = transaction.to_h
162
165
  expect(transaction_hash).to include(
163
166
  "sample_data" => hash_including(
164
- "tags" => { "queue" => queue, "priority" => 10 }
167
+ "tags" => hash_including("queue" => queue, "priority" => 10)
165
168
  )
166
169
  )
167
170
  end
@@ -194,7 +197,10 @@ if DependencyHelper.active_job_present?
194
197
  "metadata" => {},
195
198
  "sample_data" => hash_including(
196
199
  "params" => [],
197
- "tags" => { "queue" => queue }
200
+ "tags" => {
201
+ "active_job_id" => kind_of(String),
202
+ "queue" => queue
203
+ }
198
204
  )
199
205
  )
200
206
  events = transaction_hash["events"]
@@ -227,7 +233,10 @@ if DependencyHelper.active_job_present?
227
233
  "metadata" => {},
228
234
  "sample_data" => hash_including(
229
235
  "params" => [],
230
- "tags" => { "queue" => queue }
236
+ "tags" => {
237
+ "active_job_id" => kind_of(String),
238
+ "queue" => queue
239
+ }
231
240
  )
232
241
  )
233
242
  events = transaction_hash["events"]
@@ -363,7 +372,10 @@ if DependencyHelper.active_job_present?
363
372
  "action" => "ActionMailerTestJob#welcome",
364
373
  "sample_data" => hash_including(
365
374
  "params" => ["ActionMailerTestJob", "welcome", "deliver_now"],
366
- "tags" => { "queue" => "mailers" }
375
+ "tags" => {
376
+ "active_job_id" => kind_of(String),
377
+ "queue" => "mailers"
378
+ }
367
379
  )
368
380
  )
369
381
  end
@@ -379,7 +391,10 @@ if DependencyHelper.active_job_present?
379
391
  "action" => "ActionMailerTestJob#welcome",
380
392
  "sample_data" => hash_including(
381
393
  "params" => ["ActionMailerTestJob", "welcome", "deliver_now"] + method_expected_args,
382
- "tags" => { "queue" => "mailers" }
394
+ "tags" => {
395
+ "active_job_id" => kind_of(String),
396
+ "queue" => "mailers"
397
+ }
383
398
  )
384
399
  )
385
400
  end
@@ -396,7 +411,10 @@ if DependencyHelper.active_job_present?
396
411
  "action" => "ActionMailerTestJob#welcome",
397
412
  "sample_data" => hash_including(
398
413
  "params" => ["ActionMailerTestJob", "welcome", "deliver_now", parameterized_expected_args],
399
- "tags" => { "queue" => "mailers" }
414
+ "tags" => {
415
+ "active_job_id" => kind_of(String),
416
+ "queue" => "mailers"
417
+ }
400
418
  )
401
419
  )
402
420
  end
@@ -434,7 +452,10 @@ if DependencyHelper.active_job_present?
434
452
  "deliver_now",
435
453
  { active_job_internal_key => ["args"], "args" => [] }
436
454
  ],
437
- "tags" => { "queue" => "mailers" }
455
+ "tags" => {
456
+ "active_job_id" => kind_of(String),
457
+ "queue" => "mailers"
458
+ }
438
459
  )
439
460
  )
440
461
  end
@@ -457,7 +478,10 @@ if DependencyHelper.active_job_present?
457
478
  "args" => method_expected_args
458
479
  }
459
480
  ],
460
- "tags" => { "queue" => "mailers" }
481
+ "tags" => {
482
+ "active_job_id" => kind_of(String),
483
+ "queue" => "mailers"
484
+ }
461
485
  )
462
486
  )
463
487
  end
@@ -482,7 +506,10 @@ if DependencyHelper.active_job_present?
482
506
  "params" => parameterized_expected_args
483
507
  }
484
508
  ],
485
- "tags" => { "queue" => "mailers" }
509
+ "tags" => {
510
+ "active_job_id" => kind_of(String),
511
+ "queue" => "mailers"
512
+ }
486
513
  )
487
514
  )
488
515
  end
@@ -227,25 +227,14 @@ describe Appsignal::Hooks::DelayedJobHook do
227
227
  end
228
228
  end
229
229
 
230
- context "without job name" do
231
- let(:job_data) do
232
- { :name => "", :payload_object => payload_object }
233
- end
234
-
235
- it "wraps it in a transaction using the class method job name" do
236
- perform
237
- expect(last_transaction.to_h["action"]).to eql("unknown")
238
- end
239
- end
240
-
241
- context "with invalid job name" do
230
+ context "with only job class name" do
242
231
  let(:job_data) do
243
232
  { :name => "Banana", :payload_object => payload_object }
244
233
  end
245
234
 
246
- it "wraps it in a transaction using the class method job name" do
235
+ it "appends #perform to the class name" do
247
236
  perform
248
- expect(last_transaction.to_h["action"]).to eql("unknown")
237
+ expect(last_transaction.to_h["action"]).to eql("Banana#perform")
249
238
  end
250
239
  end
251
240
 
@@ -76,9 +76,10 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
76
76
  ]
77
77
  end
78
78
  let(:job_class) { "TestClass" }
79
+ let(:jid) { "b4a577edbccf1d805744efa9" }
79
80
  let(:item) do
80
81
  {
81
- "jid" => "b4a577edbccf1d805744efa9",
82
+ "jid" => jid,
82
83
  "class" => job_class,
83
84
  "retry_count" => 0,
84
85
  "queue" => "default",
@@ -151,7 +152,7 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
151
152
  context "when using the Sidekiq delayed extension" do
152
153
  let(:item) do
153
154
  {
154
- "jid" => "efb140489485999d32b5504c",
155
+ "jid" => jid,
155
156
  "class" => "Sidekiq::Extensions::DelayedClass",
156
157
  "queue" => "default",
157
158
  "args" => [
@@ -191,7 +192,7 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
191
192
  context "when using the Sidekiq ActiveRecord instance delayed extension" do
192
193
  let(:item) do
193
194
  {
194
- "jid" => "efb140489485999d32b5504c",
195
+ "jid" => jid,
195
196
  "class" => "Sidekiq::Extensions::DelayedModel",
196
197
  "queue" => "default",
197
198
  "args" => [
@@ -243,7 +244,7 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
243
244
 
244
245
  transaction_hash = transaction.to_h
245
246
  expect(transaction_hash).to include(
246
- "id" => kind_of(String),
247
+ "id" => jid,
247
248
  "action" => "TestClass#perform",
248
249
  "error" => {
249
250
  "name" => "ExampleException",
@@ -277,7 +278,7 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
277
278
 
278
279
  transaction_hash = transaction.to_h
279
280
  expect(transaction_hash).to include(
280
- "id" => kind_of(String),
281
+ "id" => jid,
281
282
  "action" => "TestClass#perform",
282
283
  "error" => nil,
283
284
  "metadata" => {
@@ -361,6 +362,7 @@ if DependencyHelper.active_job_present?
361
362
  end
362
363
  let(:expected_tags) do
363
364
  {}.tap do |hash|
365
+ hash["active_job_id"] = kind_of(String)
364
366
  if DependencyHelper.rails_version >= Gem::Version.new("5.0.0")
365
367
  hash["provider_job_id"] = kind_of(String)
366
368
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.0.beta.3
4
+ version: 2.11.0.beta.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-07-08 00:00:00.000000000 Z
13
+ date: 2020-07-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack