appsignal 2.5.2-java → 2.5.3.alpha.1-java

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: e3d9bc6665c2a3112a1aa24d8194a1c404ca933d
4
- data.tar.gz: e0450850d9a358e78d3391050a1c43bfbb1b5705
3
+ metadata.gz: ea3a27e8ba696561f20b761ac6f98e28aaebf384
4
+ data.tar.gz: a2676271086288a7e4c6de3e3be6b4b45acc8a7d
5
5
  SHA512:
6
- metadata.gz: 2b1bc35ce5ef95dc7f04332bb2e8f347477b13d60a19edfbe2891e27a07f409f8678efb653da4b2517d4991fd2267dddbe4077b3c48d11ded7421ce5c2594a9f
7
- data.tar.gz: bcdf191cb6943a854503e5504ee69c41cde23bad18ffa77374d056cb61f616af208e696674a97d72a6008a62bf80ddc513e4bbbe94ee9b631138c52b7e1da57c
6
+ metadata.gz: 811444b7be89ff7e4da044fac781acb0666122e594a08543dafa76966804152910f196396c8e7681845b1f9d4e045702fbc1f68be7f00bddf2a356556b435e75
7
+ data.tar.gz: f6b75547626577f17e143b1fb801182a5d77be7494ba3d6e43d0d7c8a8b59d9a51501d3bfabc5725f577fe814bdc1bb7e92811cb7938350ac54d6da1bb94610a
data/CHANGELOG.md CHANGED
@@ -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: java
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
@@ -371,9 +371,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
371
371
  version: '1.9'
372
372
  required_rubygems_version: !ruby/object:Gem::Requirement
373
373
  requirements:
374
- - - ">="
374
+ - - ">"
375
375
  - !ruby/object:Gem::Version
376
- version: '0'
376
+ version: 1.3.1
377
377
  requirements: []
378
378
  rubyforge_project:
379
379
  rubygems_version: 2.6.14