appsignal 0.11.17 → 0.11.18

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: 9134a3a7b0864bbdbf6c23ee90d43537adc7faa9
4
- data.tar.gz: 3c86992c153bcfceed5fae3db112d7e066b51c30
3
+ metadata.gz: 4204e0aa127219cae272542349aa109cfb4445df
4
+ data.tar.gz: c9100565b00cadfee94feeec9ddc8cc5bbce0c19
5
5
  SHA512:
6
- metadata.gz: 87aa26b8f6412505484af7adc3250f8339936cd71c09aeb3772c414f79813dcda1fbcafd9d02b7742fcc675d90abc81c5b39cd8b55d49735a6ec251b26185406
7
- data.tar.gz: acf5e0a21d3a5a163bb40da40d5083f9a644050d21dbab767dd7b237df39b7adfdeca8e5af7b98f966bb4fb4827905bd602423de1cdb0a544181ba6d6482842a
6
+ metadata.gz: 710507253fcf8873605f60638d2806ff4f08fcd59adc45a0b879eef9c2c63b87f7aad63b6abcaafb2f974f3370bafe9ccefe914c97cee68d6e6428c81e50933a
7
+ data.tar.gz: 75ab971b694c0cd2630e5fb4b5615b13b522d7c01b8859f4136391af4bdeed576af41c84628e1e6f65cbc98ede4aea1187360228c88b911e877a3f9207410835
@@ -1,3 +1,7 @@
1
+ # 0.11.18
2
+ * Fix in Rake integration
3
+ * Refactor of Resque integration
4
+
1
5
  # 0.11.17
2
6
  * Fix for bug using rack request in `send_exception`
3
7
 
data/Rakefile CHANGED
@@ -10,6 +10,7 @@ GEMFILES = %w(
10
10
  rails-4.2
11
11
  sequel
12
12
  sinatra
13
+ resque
13
14
  )
14
15
 
15
16
  RUBY_VERSIONS = %w(
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'resque'
4
+
5
+ gemspec :path => '../'
@@ -3,11 +3,7 @@ module Rake
3
3
  alias_method :invoke_without_appsignal, :invoke
4
4
 
5
5
  def invoke(*args)
6
- if Appsignal.active?
7
- invoke_with_appsignal(*args)
8
- else
9
- invoke_without_appsignal(*args)
10
- end
6
+ invoke_with_appsignal(*args)
11
7
  end
12
8
 
13
9
  def invoke_with_appsignal(*args)
@@ -27,7 +27,4 @@ if defined?(::Resque)
27
27
  Resque.after_fork do |job|
28
28
  Appsignal::IPC.forked! if Appsignal.active?
29
29
  end
30
-
31
- # Extend the default job class with AppSignal instrumentation
32
- Resque::Job.send(:extend, Appsignal::Integrations::ResquePlugin)
33
30
  end
@@ -1,3 +1,3 @@
1
1
  module Appsignal
2
- VERSION = '0.11.17'
2
+ VERSION = '0.11.18'
3
3
  end
@@ -13,22 +13,13 @@ describe "Rack integration" do
13
13
  end
14
14
 
15
15
  describe "#invoke" do
16
- before { Appsignal.stub(:active? => true) }
17
16
 
18
17
  it "should call with appsignal monitoring" do
19
18
  expect( task ).to receive(:invoke_with_appsignal).with(['foo'])
20
19
  end
21
20
 
22
- context "when not active" do
23
- before { Appsignal.stub(:active? => false) }
24
-
25
- it "should NOT call with appsignal monitoring" do
26
- expect( task ).to_not receive(:invoke_with_appsignal).with(['foo'])
27
- end
28
-
29
- it "should call the original task" do
30
- expect( task ).to receive(:invoke_without_appsignal).with(['foo'])
31
- end
21
+ it "should call the original task" do
22
+ expect( task ).to receive(:invoke_without_appsignal).with(['foo'])
32
23
  end
33
24
 
34
25
  after { task.invoke(['foo']) }
@@ -1,78 +1,82 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Resque integration" do
4
- let(:file) { File.expand_path('lib/appsignal/integrations/resque.rb') }
3
+ if resque_present?
4
+ describe "Resque integration" do
5
+ let(:file) { File.expand_path('lib/appsignal/integrations/resque.rb') }
5
6
 
6
- context "with resque" do
7
- before do
8
- module Resque
7
+ context "with resque" do
8
+ before do
9
+ load file
10
+ start_agent
9
11
 
10
- def self.before_first_fork
11
- end
12
+ class TestJob
13
+ extend Appsignal::Integrations::ResquePlugin
12
14
 
13
- def self.after_fork
15
+ def self.perform
16
+ end
14
17
  end
15
18
 
16
- class Job
17
- end
19
+ class BrokenTestJob
20
+ extend Appsignal::Integrations::ResquePlugin
18
21
 
19
- class TestError < StandardError
22
+ def self.perform
23
+ raise VerySpecificError.new('broken')
24
+ end
20
25
  end
21
- end
22
-
23
- load file
24
- start_agent
25
- end
26
26
 
27
- describe :around_perform_resque_plugin do
28
- let(:transaction) { Appsignal::Transaction.new(1, {}) }
29
- let(:job) { Resque::Job }
30
- let(:invoked_job) { nil }
31
- before do
32
- transaction.stub(:complete! => true)
33
- Appsignal::Transaction.stub(:current => transaction)
34
27
  end
35
28
 
36
- context "without exception" do
37
- it "should create a new transaction" do
38
- Appsignal::Transaction.should_receive(:create).and_return(transaction)
29
+ describe :around_perform_resque_plugin do
30
+ let(:transaction) { Appsignal::Transaction.new(1, {}) }
31
+ let(:job) { Resque::Job.new('default', {'class' => 'TestJob'}) }
32
+ before do
33
+ transaction.stub(:complete! => true)
34
+ Appsignal::Transaction.stub(:current => transaction)
39
35
  end
40
36
 
41
- it "should wrap in a transaction with the correct params" do
42
- Appsignal.should_receive(:monitor_transaction).with(
43
- 'perform_job.resque',
44
- :class => 'Resque::Job',
45
- :method => 'perform'
46
- )
47
- end
37
+ context "without exception" do
38
+ it "should create a new transaction" do
39
+ Appsignal::Transaction.should_receive(:create).and_return(transaction)
40
+ end
48
41
 
49
- it "should close the transaction" do
50
- transaction.should_receive(:complete!)
51
- end
42
+ it "should wrap in a transaction with the correct params" do
43
+ Appsignal.should_receive(:monitor_transaction).with(
44
+ 'perform_job.resque',
45
+ :class => 'TestJob',
46
+ :method => 'perform'
47
+ )
48
+ end
52
49
 
53
- after { job.around_perform_resque_plugin { invoked_job } }
54
- end
50
+ it "should close the transaction" do
51
+ transaction.should_receive(:complete!)
52
+ end
55
53
 
56
- context "with exception" do
57
- it "should set the exception" do
58
- transaction.should_receive(:add_exception)
54
+ after { job.perform }
59
55
  end
60
56
 
61
- after do
62
- begin
63
- job.around_perform_resque_plugin { raise(Resque::TestError.new('the roof')) }
64
- rescue Resque::TestError
65
- # Do nothing
57
+ context "with exception" do
58
+ let(:job) { Resque::Job.new('default', {'class' => 'BrokenTestJob'}) }
59
+
60
+ it "should set the exception" do
61
+ transaction.should_receive(:add_exception)
62
+ end
63
+
64
+ after do
65
+ begin
66
+ job.perform
67
+ rescue VerySpecificError
68
+ # Do nothing
69
+ end
66
70
  end
67
71
  end
68
72
  end
69
73
  end
70
- end
71
74
 
72
- context "without resque" do
73
- before(:all) { Object.send(:remove_const, :Resque) }
75
+ context "without resque" do
76
+ before(:all) { Object.send(:remove_const, :Resque) }
74
77
 
75
- specify { expect { ::Resque }.to raise_error(NameError) }
76
- specify { expect { load file }.to_not raise_error }
78
+ specify { expect { ::Resque }.to raise_error(NameError) }
79
+ specify { expect { load file }.to_not raise_error }
80
+ end
77
81
  end
78
82
  end
@@ -52,6 +52,13 @@ rescue LoadError
52
52
  false
53
53
  end
54
54
 
55
+ def resque_present?
56
+ require 'resque'
57
+ true
58
+ rescue LoadError
59
+ false
60
+ end
61
+
55
62
  def padrino_present?
56
63
  require 'padrino'
57
64
  true
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: 0.11.17
4
+ version: 0.11.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-10-20 00:00:00.000000000 Z
15
+ date: 2016-01-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
@@ -141,6 +141,7 @@ files:
141
141
  - gemfiles/rails-4.0.gemfile
142
142
  - gemfiles/rails-4.1.gemfile
143
143
  - gemfiles/rails-4.2.gemfile
144
+ - gemfiles/resque.gemfile
144
145
  - gemfiles/sequel.gemfile
145
146
  - gemfiles/sinatra.gemfile
146
147
  - lib/appsignal.rb