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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 638c33adaf9394488da292c98738966981fad1d1
4
- data.tar.gz: e0450850d9a358e78d3391050a1c43bfbb1b5705
3
+ metadata.gz: 18e46cb221b16ec43eb3b45158ae8849dfbe0728
4
+ data.tar.gz: 63537221d5bbcec71aa6c9f096b732b8586d7033
5
5
  SHA512:
6
- metadata.gz: 94d04b637d3f5477ea4a29f47411d385e608b85e57bd930ea3e18f85c31401288a385adc651365043df5bc6bade2870f73179b17067f706f220a8007b2efe3eb
7
- data.tar.gz: bcdf191cb6943a854503e5504ee69c41cde23bad18ffa77374d056cb61f616af208e696674a97d72a6008a62bf80ddc513e4bbbe94ee9b631138c52b7e1da57c
6
+ metadata.gz: 9f5fa1663e8fbf61b7e4f91501ff54dff521d567d0264a23c53d535580f25c423a7552829dcfa51a823bce599b143661f5f9a52ade22a12419c2a628f3e7d8dc
7
+ data.tar.gz: cfd6a663991702d6cade925af2f0b1d0ee7778bdd9e96511c68493ea44ba143a5e9f8e07fdac1186c748240f5877eb2fda37a60919429885ad25774525570ff0
@@ -1,3 +1,6 @@
1
+ # 2.5.3
2
+ - Fix Sidekiq action names containing arguments. PR #401
3
+
1
4
  # 2.5.2
2
5
  - Support Sidekiq delay extension for ActiveRecord instances. If using this
3
6
  feature in your app, an update is strongly recommended! PR #387
@@ -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
- return sidekiq_action_name if sidekiq_action_name =~ /\.|#/
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
- if job_class == "ActionMailer::DeliveryJob"
101
+ case job_class
102
+ when "ActionMailer::DeliveryJob"
98
103
  # MailerClass#mailer_method
99
104
  args[0]["arguments"][0..1].join("#")
100
- else
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"]
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = "2.5.2".freeze
2
+ VERSION = "2.5.3.alpha.1".freeze
3
3
  end
@@ -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.2
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-21 00:00:00.000000000 Z
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: '0'
362
+ version: 1.3.1
363
363
  requirements: []
364
364
  rubyforge_project:
365
365
  rubygems_version: 2.6.14