appsignal 2.5.2 → 2.5.3.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/appsignal/hooks/sidekiq.rb +12 -3
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +56 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e46cb221b16ec43eb3b45158ae8849dfbe0728
|
4
|
+
data.tar.gz: 63537221d5bbcec71aa6c9f096b732b8586d7033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5fa1663e8fbf61b7e4f91501ff54dff521d567d0264a23c53d535580f25c423a7552829dcfa51a823bce599b143661f5f9a52ade22a12419c2a628f3e7d8dc
|
7
|
+
data.tar.gz: cfd6a663991702d6cade925af2f0b1d0ee7778bdd9e96511c68493ea44ba143a5e9f8e07fdac1186c748240f5877eb2fda37a60919429885ad25774525570ff0
|
data/CHANGELOG.md
CHANGED
@@ -22,6 +22,7 @@ module Appsignal
|
|
22
22
|
class SidekiqPlugin # rubocop:disable Metrics/ClassLength
|
23
23
|
include Appsignal::Hooks::Helpers
|
24
24
|
|
25
|
+
UNKNOWN_ACTION_NAME = "unknown".freeze
|
25
26
|
JOB_KEYS = %w[
|
26
27
|
args backtrace class created_at enqueued_at error_backtrace error_class
|
27
28
|
error_message failed_at jid retried_at retry wrapped
|
@@ -60,7 +61,10 @@ module Appsignal
|
|
60
61
|
|
61
62
|
def formatted_action_name(job)
|
62
63
|
sidekiq_action_name = parse_action_name(job)
|
63
|
-
|
64
|
+
complete_action = sidekiq_action_name =~ /\.|#/
|
65
|
+
if complete_action || sidekiq_action_name == UNKNOWN_ACTION_NAME
|
66
|
+
return sidekiq_action_name
|
67
|
+
end
|
64
68
|
"#{sidekiq_action_name}#perform"
|
65
69
|
end
|
66
70
|
|
@@ -94,11 +98,16 @@ module Appsignal
|
|
94
98
|
end
|
95
99
|
when "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"
|
96
100
|
job_class = job["wrapped"] || args[0]
|
97
|
-
|
101
|
+
case job_class
|
102
|
+
when "ActionMailer::DeliveryJob"
|
98
103
|
# MailerClass#mailer_method
|
99
104
|
args[0]["arguments"][0..1].join("#")
|
100
|
-
|
105
|
+
when String
|
101
106
|
job_class
|
107
|
+
else
|
108
|
+
Appsignal.logger.debug \
|
109
|
+
"Unable to determine an action name from Sidekiq payload: #{job}"
|
110
|
+
UNKNOWN_ACTION_NAME
|
102
111
|
end
|
103
112
|
else
|
104
113
|
job["class"]
|
data/lib/appsignal/version.rb
CHANGED
@@ -317,6 +317,62 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
|
|
317
317
|
)
|
318
318
|
end
|
319
319
|
end
|
320
|
+
|
321
|
+
context "when Sidekiq job payload is missing the 'wrapped' value" do
|
322
|
+
let(:item) do
|
323
|
+
{
|
324
|
+
"class" => "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper",
|
325
|
+
"queue" => "default",
|
326
|
+
"args" => [{
|
327
|
+
"job_class" => "ActiveMailerTestJob",
|
328
|
+
"job_id" => "23e79d48-6966-40d0-b2d4-f7938463a263",
|
329
|
+
"queue_name" => "default",
|
330
|
+
"arguments" => [
|
331
|
+
"MailerClass", "mailer_method", "deliver_now",
|
332
|
+
"foo", { "foo" => "Foo", "bar" => "Bar", "baz" => { 1 => :bar } }
|
333
|
+
]
|
334
|
+
}],
|
335
|
+
"retry" => true,
|
336
|
+
"jid" => "efb140489485999d32b5504c",
|
337
|
+
"created_at" => Time.parse("2001-01-01 10:00:00UTC").to_f,
|
338
|
+
"enqueued_at" => Time.parse("2001-01-01 10:00:00UTC").to_f
|
339
|
+
}
|
340
|
+
end
|
341
|
+
|
342
|
+
it "sets the action name to unknown and without sample data" do
|
343
|
+
perform_job
|
344
|
+
|
345
|
+
transaction_hash = transaction.to_h
|
346
|
+
expect(transaction_hash).to include(
|
347
|
+
"id" => kind_of(String),
|
348
|
+
"action" => "unknown",
|
349
|
+
"error" => nil,
|
350
|
+
"namespace" => namespace,
|
351
|
+
"metadata" => {
|
352
|
+
"queue" => "default"
|
353
|
+
},
|
354
|
+
"sample_data" => {
|
355
|
+
"environment" => {},
|
356
|
+
"params" => [],
|
357
|
+
"tags" => {}
|
358
|
+
}
|
359
|
+
)
|
360
|
+
# TODO: Not available in transaction.to_h yet.
|
361
|
+
# https://github.com/appsignal/appsignal-agent/issues/293
|
362
|
+
expect(transaction.request.env).to eq(
|
363
|
+
:queue_start => Time.parse("2001-01-01 10:00:00UTC").to_f
|
364
|
+
)
|
365
|
+
expect_transaction_to_have_sidekiq_event(transaction_hash)
|
366
|
+
end
|
367
|
+
|
368
|
+
it "logs a debug message" do
|
369
|
+
perform_job
|
370
|
+
|
371
|
+
expect(log_contents(log)).to contains_log(
|
372
|
+
:debug, "Unable to determine an action name from Sidekiq payload: #{item}"
|
373
|
+
)
|
374
|
+
end
|
375
|
+
end
|
320
376
|
end
|
321
377
|
end
|
322
378
|
|
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.5.
|
4
|
+
version: 2.5.3.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-04-
|
12
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -357,9 +357,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
357
357
|
version: '1.9'
|
358
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
359
359
|
requirements:
|
360
|
-
- - "
|
360
|
+
- - ">"
|
361
361
|
- !ruby/object:Gem::Version
|
362
|
-
version:
|
362
|
+
version: 1.3.1
|
363
363
|
requirements: []
|
364
364
|
rubyforge_project:
|
365
365
|
rubygems_version: 2.6.14
|