appsignal 2.3.3 → 2.3.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
  SHA1:
3
- metadata.gz: 35d677b53c12a5761308ea3158780deea694d4b7
4
- data.tar.gz: 0dcbadafab0f964c27814aa38f365eb922d327e0
3
+ metadata.gz: a71ef0ab84d14af51ac3acc5e650ffa795c1f47d
4
+ data.tar.gz: 5aac40d09039f0489fbba6dd635824854e3de470
5
5
  SHA512:
6
- metadata.gz: 244d06180b82d6188f9f7bd4bd100c89772e2eb1ed826dea3605d897436ed070def86a94c593da9fb826aee173880b8b2b69414f82f0c3f16c10a8664454e919
7
- data.tar.gz: 63683d63c2e268146b652bdf4b0bb7946368c8db76ebed184bbc643918e3604ad74459d8b43a8e08f9d0acef06af131c923da9606ba8d778748f1ff2a0a3cb29
6
+ metadata.gz: 8a1d8af6158df8b788beedb029af5c8ff73e9240bf9c8f7b1899f32c95138cd291000b6c61786d33f8ec053f9504a14f1e352e1364deb8e7ac132b731359494e
7
+ data.tar.gz: 15686c8a6ebd22a44ea4a88278876f366010b643bf66218656ca5e7dc1a6cae99e9bfbd1cac46d59db4f2098bcfb11958413a7a08638bf327343e7c1b01acc05
data/.travis.yml CHANGED
@@ -32,6 +32,7 @@ gemfile:
32
32
  - "gemfiles/sequel-435.gemfile"
33
33
  - "gemfiles/sinatra.gemfile"
34
34
  - "gemfiles/grape.gemfile"
35
+ - "gemfiles/webmachine.gemfile"
35
36
 
36
37
  matrix:
37
38
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,4 +1,5 @@
1
- # Unreleased version
1
+ # 2.3.4
2
+ * Fix naming for ActiveJob integration with DelayedJob. PR #345
2
3
 
3
4
  # 2.3.3
4
5
  * Accept mixed case env variable values for the `true` value. PR #333
@@ -15,20 +15,21 @@ module Appsignal
15
15
  end
16
16
 
17
17
  def self.invoke_with_instrumentation(job, block)
18
- if job.respond_to?(:payload_object)
19
- # Direct Delayed Job
18
+ payload = job.payload_object
19
+
20
+ if payload.respond_to? :job_data
21
+ # ActiveJob
22
+ job_data = payload.job_data
23
+ args = job_data.fetch("arguments", {})
24
+ class_name = job_data["job_class"]
25
+ method_name = "perform"
26
+ else
27
+ # Delayed Job
28
+ args = extract_value(job.payload_object, :args, {})
20
29
  class_and_method_name = extract_value(job.payload_object, :appsignal_name, job.name)
21
30
  class_name, method_name = class_and_method_name.split("#")
22
- args = extract_value(job.payload_object, :args, {})
23
- job_data = job
24
- elsif job.respond_to?(:job_data)
25
- # Via ActiveJob
26
- class_name, method_name = job.job_data[:name].split("#")
27
- args = job.job_data[:args] || {}
28
- job_data = job.job_data
29
- else
30
- args = {}
31
31
  end
32
+
32
33
  params = Appsignal::Utils::ParamsSanitizer.sanitize args,
33
34
  :filter_parameters => Appsignal.config[:filter_parameters]
34
35
 
@@ -37,13 +38,13 @@ module Appsignal
37
38
  :class => class_name,
38
39
  :method => method_name,
39
40
  :metadata => {
40
- :id => extract_value(job_data, :id, nil, true),
41
- :queue => extract_value(job_data, :queue),
42
- :priority => extract_value(job_data, :priority, 0),
43
- :attempts => extract_value(job_data, :attempts, 0)
41
+ :id => extract_value(job, :id, nil, true),
42
+ :queue => extract_value(job, :queue),
43
+ :priority => extract_value(job, :priority, 0),
44
+ :attempts => extract_value(job, :attempts, 0)
44
45
  },
45
46
  :params => params,
46
- :queue_start => extract_value(job_data, :run_at)
47
+ :queue_start => extract_value(job, :run_at)
47
48
  ) do
48
49
  block.call(job)
49
50
  end
@@ -1,5 +1,5 @@
1
1
  require "yaml"
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.3.3".freeze
4
+ VERSION = "2.3.4".freeze
5
5
  end
@@ -215,7 +215,27 @@ describe Appsignal::Hooks::DelayedJobHook do
215
215
  require "active_job"
216
216
 
217
217
  context "when wrapped by ActiveJob" do
218
- let(:job) { ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper.new(job_data) }
218
+ let(:wrapped_job) do
219
+ ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper.new(
220
+ "arguments" => args,
221
+ "job_class" => "TestClass",
222
+ "job_id" => 123,
223
+ "locale" => :en,
224
+ "queue_name" => "default"
225
+ )
226
+ end
227
+ let(:job) do
228
+ double(
229
+ :id => 123,
230
+ :name => "ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper",
231
+ :priority => 1,
232
+ :attempts => 1,
233
+ :queue => "default",
234
+ :created_at => created_at,
235
+ :run_at => run_at,
236
+ :payload_object => wrapped_job
237
+ )
238
+ end
219
239
  let(:default_params) do
220
240
  {
221
241
  :class => "TestClass",
@@ -231,7 +251,6 @@ describe Appsignal::Hooks::DelayedJobHook do
231
251
  }
232
252
  end
233
253
  let(:args) { ["activejob_argument"] }
234
- before { job_data[:args] = args }
235
254
 
236
255
  context "with simple params" do
237
256
  it "wraps it in a transaction with the correct params" do
@@ -36,7 +36,7 @@ if DependencyHelper.webmachine_present?
36
36
  end
37
37
 
38
38
  it "should set the action" do
39
- expect(transaction).to receive(:set_action_if_nil).with("RSpec::Mocks::Mock#GET")
39
+ expect(transaction).to receive(:set_action_if_nil).with("RSpec::Mocks::Double#GET")
40
40
  end
41
41
 
42
42
  it "should call the original method" do
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.3.3
4
+ version: 2.3.4
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: 2017-09-01 00:00:00.000000000 Z
12
+ date: 2017-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack