appsignal 0.11.13.beta.1 → 0.11.13.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +7 -1
- data/gemfiles/padrino-0.13.gemfile +7 -0
- data/lib/appsignal.rb +4 -0
- data/lib/appsignal/agent.rb +3 -0
- data/lib/appsignal/capistrano.rb +2 -1
- data/lib/appsignal/integrations/padrino.rb +49 -0
- data/lib/appsignal/integrations/rake.rb +21 -0
- data/lib/appsignal/rack/sinatra_instrumentation.rb +8 -0
- data/lib/appsignal/transaction.rb +9 -1
- data/lib/appsignal/transaction/formatter.rb +1 -0
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/agent_spec.rb +1 -1
- data/spec/lib/appsignal/aggregator/middleware/active_record_sanitizer_spec.rb +1 -1
- data/spec/lib/appsignal/aggregator/post_processor_spec.rb +8 -2
- data/spec/lib/appsignal/integrations/padrino_spec.rb +131 -0
- data/spec/lib/appsignal/integrations/rake_spec.rb +83 -0
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +31 -3
- data/spec/lib/appsignal/transaction/formatter_spec.rb +24 -0
- data/spec/lib/appsignal/transaction_spec.rb +16 -0
- data/spec/lib/appsignal_spec.rb +16 -7
- data/spec/spec_helper.rb +14 -0
- metadata +31 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a2d6b6b69b1d8d66673b8322f59914d9b0ee411e
|
4
|
+
data.tar.gz: 1f10620110c8acc23fb9c0bfdd6eba8e027d262e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 968ef086fccf1833f3f6049dc16b800c8488069252a700424bc98d03cb58164f2ebd0d4b0a11bcba7464b1d9f2af67e1482d78790886c4fa76be117068263ad0
|
7
|
+
data.tar.gz: 96225881c0898a7a0febb304cd0253cdf5237729c1b5e89af777ac15bf08845b9ea1c7943ad834b02e638f3810bfdfd92210f346df8a8795b6410f1b2c582502
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
# 0.11.13
|
2
|
-
*
|
2
|
+
* Add Padrino support
|
3
|
+
* Add Rake task monitoring
|
3
4
|
* Add http proxy support
|
5
|
+
* Configure Net::HTTP to only use TLS
|
4
6
|
* Don't send queue if there is no content
|
7
|
+
* Don't retry transmission when response code is 400 (no content)
|
8
|
+
* Display warning message when attempting to send a non-exception to `send_exception`
|
9
|
+
* Fix capistrano 2 detection
|
10
|
+
* Fix issue with Sinatra integration attempting to attach an exception to a transaction that doesn't exist.
|
5
11
|
|
6
12
|
# 0.11.12
|
7
13
|
* Sanitizer will no longer inspect unknown objects, since implementations of inspect sometimes trigger unexpected behavior.
|
data/lib/appsignal.rb
CHANGED
@@ -102,6 +102,10 @@ module Appsignal
|
|
102
102
|
|
103
103
|
def send_exception(exception, tags=nil)
|
104
104
|
return if !active? || is_ignored_exception?(exception)
|
105
|
+
unless exception.is_a?(Exception)
|
106
|
+
logger.error('Can\'t send exception, given value is not an exception')
|
107
|
+
return
|
108
|
+
end
|
105
109
|
transaction = Appsignal::Transaction.create(SecureRandom.uuid, ENV)
|
106
110
|
transaction.add_exception(exception)
|
107
111
|
transaction.set_tags(tags) if tags
|
data/lib/appsignal/agent.rb
CHANGED
@@ -203,6 +203,9 @@ module Appsignal
|
|
203
203
|
Appsignal.logger.error 'API token cannot be authorized'
|
204
204
|
shutdown(false, 401)
|
205
205
|
true
|
206
|
+
when 400
|
207
|
+
Appsignal.logger.error 'Empty body sent'
|
208
|
+
true
|
206
209
|
else
|
207
210
|
Appsignal.logger.error "Unknown Appsignal response code: '#{code}'"
|
208
211
|
false
|
data/lib/appsignal/capistrano.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'appsignal'
|
2
|
+
require 'capistrano/version'
|
2
3
|
|
3
|
-
if defined?(Capistrano::VERSION)
|
4
|
+
if defined?(Capistrano::VERSION) && Gem::Version.new(Capistrano::VERSION) >= Gem::Version.new(3)
|
4
5
|
# Capistrano 3+
|
5
6
|
load File.expand_path('../integrations/capistrano/appsignal.cap', __FILE__)
|
6
7
|
else
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'appsignal'
|
2
|
+
|
3
|
+
module Appsignal::Integrations
|
4
|
+
module PadrinoPlugin
|
5
|
+
def self.init
|
6
|
+
Appsignal.logger.info("Loading Padrino (#{Padrino::VERSION}) integration")
|
7
|
+
|
8
|
+
root = Padrino.mounted_root
|
9
|
+
Appsignal.config = Appsignal::Config.new(root, Padrino.env)
|
10
|
+
|
11
|
+
Appsignal.start_logger(File.join(root, 'log'))
|
12
|
+
Appsignal.start
|
13
|
+
|
14
|
+
if Appsignal.active?
|
15
|
+
Padrino.use(Appsignal::Rack::Listener)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Padrino::Routing::InstanceMethods
|
22
|
+
alias route_without_appsignal route!
|
23
|
+
|
24
|
+
def route!(base = settings, pass_block = nil)
|
25
|
+
if env['sinatra.static_file']
|
26
|
+
route_without_appsignal(base, pass_block)
|
27
|
+
else
|
28
|
+
payload = {
|
29
|
+
:params => request.params,
|
30
|
+
:session => request.session,
|
31
|
+
:method => request.request_method,
|
32
|
+
:path => request.path
|
33
|
+
}
|
34
|
+
ActiveSupport::Notifications.instrument('process_action.padrino', payload) do |payload|
|
35
|
+
begin
|
36
|
+
route_without_appsignal(base, pass_block)
|
37
|
+
rescue => e
|
38
|
+
Appsignal.add_exception(e); raise e
|
39
|
+
ensure
|
40
|
+
payload[:action] = "#{settings.name}:#{request.controller}##{request.action}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Padrino.after_load do
|
48
|
+
Appsignal::Integrations::PadrinoPlugin.init
|
49
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Rake
|
2
|
+
class Task
|
3
|
+
alias_method :invoke_without_appsignal, :invoke
|
4
|
+
|
5
|
+
def invoke(*args)
|
6
|
+
transaction = Appsignal::Transaction.create(SecureRandom.uuid, ENV)
|
7
|
+
transaction.set_kind('background_job')
|
8
|
+
transaction.set_action(name)
|
9
|
+
|
10
|
+
invoke_without_appsignal(*args)
|
11
|
+
rescue => exception
|
12
|
+
unless Appsignal.is_ignored_exception?(exception)
|
13
|
+
transaction.add_exception(exception)
|
14
|
+
end
|
15
|
+
raise exception
|
16
|
+
ensure
|
17
|
+
transaction.complete!
|
18
|
+
Appsignal.agent.send_queue if Appsignal.active?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -7,6 +7,14 @@ module Appsignal
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def call(env)
|
10
|
+
if Appsignal.active?
|
11
|
+
call_with_appsignal_monitoring(env)
|
12
|
+
else
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def call_with_appsignal_monitoring(env)
|
10
18
|
ActiveSupport::Notifications.instrument(
|
11
19
|
'process_action.sinatra',
|
12
20
|
raw_payload(env)
|
@@ -68,6 +68,14 @@ module Appsignal
|
|
68
68
|
@paused = false
|
69
69
|
end
|
70
70
|
|
71
|
+
def set_kind(kind)
|
72
|
+
@kind = kind
|
73
|
+
end
|
74
|
+
|
75
|
+
def set_action(action)
|
76
|
+
@action = action
|
77
|
+
end
|
78
|
+
|
71
79
|
def set_process_action_event(event)
|
72
80
|
return unless event && event.payload
|
73
81
|
@process_action_event = event.dup
|
@@ -95,7 +103,7 @@ module Appsignal
|
|
95
103
|
def add_exception(ex=nil)
|
96
104
|
return unless ex
|
97
105
|
Appsignal.logger.debug("Adding #{ex.class.name} to transaction: #{request_id}")
|
98
|
-
@time
|
106
|
+
@time = Time.now.utc.to_f
|
99
107
|
@exception = {
|
100
108
|
:exception => ex.class.name,
|
101
109
|
:message => ex.message,
|
data/lib/appsignal/version.rb
CHANGED
@@ -560,7 +560,7 @@ describe Appsignal::Agent do
|
|
560
560
|
end
|
561
561
|
|
562
562
|
context "return values" do
|
563
|
-
%w( 200 420 413 429 406 402 401 ).each do |code|
|
563
|
+
%w( 200 420 413 429 406 402 401 400 ).each do |code|
|
564
564
|
it "should return true for '#{code}'" do
|
565
565
|
subject.send(:handle_result, code).should be_true
|
566
566
|
end
|
@@ -83,10 +83,16 @@ describe Appsignal::Aggregator::PostProcessor do
|
|
83
83
|
subject.exists?(Appsignal::Aggregator::Middleware::DeleteBlanks).should be_true
|
84
84
|
if rails_present?
|
85
85
|
subject.exists?(Appsignal::Aggregator::Middleware::ActionViewSanitizer).should be_true
|
86
|
-
|
86
|
+
|
87
|
+
if active_record_present?
|
88
|
+
subject.exists?(Appsignal::Aggregator::Middleware::ActiveRecordSanitizer).should be_true
|
89
|
+
end
|
87
90
|
else
|
88
91
|
subject.exists?(Appsignal::Aggregator::Middleware::ActionViewSanitizer).should be_false
|
89
|
-
|
92
|
+
|
93
|
+
if active_record_present?
|
94
|
+
subject.exists?(Appsignal::Aggregator::Middleware::ActiveRecordSanitizer).should be_false
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
if padrino_present?
|
4
|
+
describe "Padrino integration" do
|
5
|
+
require File.expand_path('lib/appsignal/integrations/padrino.rb')
|
6
|
+
|
7
|
+
class ClassWithRouter
|
8
|
+
include Padrino::Routing
|
9
|
+
end
|
10
|
+
|
11
|
+
before :all do
|
12
|
+
@events = []
|
13
|
+
@subscriber = ActiveSupport::Notifications.subscribe do |*args|
|
14
|
+
@events << ActiveSupport::Notifications::Event.new(*args)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
after :all do
|
18
|
+
ActiveSupport::Notifications.unsubscribe(@subscriber)
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "Appsignal::Integrations::PadrinoPlugin" do
|
22
|
+
before do
|
23
|
+
Appsignal.stub(
|
24
|
+
:active? => true,
|
25
|
+
:start => true,
|
26
|
+
:start_logger => true
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should start the logger on init" do
|
31
|
+
expect( Appsignal ).to receive(:start_logger)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should start appsignal on init" do
|
35
|
+
expect( Appsignal ).to receive(:start)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should add the Listener middleware to the stack" do
|
39
|
+
expect( Padrino ).to receive(:use).with(Appsignal::Rack::Listener)
|
40
|
+
end
|
41
|
+
|
42
|
+
context "when not active" do
|
43
|
+
before { Appsignal.stub(:active? => false) }
|
44
|
+
|
45
|
+
it "should not add the Listener middleware to the stack" do
|
46
|
+
expect( Padrino ).to_not receive(:use)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
after { Appsignal::Integrations::PadrinoPlugin.init }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "Padrino::Routing::InstanceMethods" do
|
54
|
+
let(:base) { double }
|
55
|
+
let(:router) { ClassWithRouter.new }
|
56
|
+
let(:env) { {} }
|
57
|
+
let(:settings) { double(:name => 'TestApp') }
|
58
|
+
|
59
|
+
let(:request) do
|
60
|
+
double(
|
61
|
+
:params => {'id' => 1},
|
62
|
+
:session => {'user_id' => 123},
|
63
|
+
:request_method => 'GET',
|
64
|
+
:path => '/users/1',
|
65
|
+
:controller => 'users',
|
66
|
+
:action => 'show'
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
before do
|
71
|
+
router.stub(
|
72
|
+
:route_without_appsignal => true,
|
73
|
+
:request => request,
|
74
|
+
:env => env,
|
75
|
+
:settings => settings
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
context "when Sinatra tells us it's a static file" do
|
80
|
+
let(:env) { {'sinatra.static_file' => true} }
|
81
|
+
|
82
|
+
it "should call the original method" do
|
83
|
+
expect( router ).to receive(:route_without_appsignal)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should not instrument the request" do
|
87
|
+
expect( ActiveSupport::Notifications ).to_not receive(:instrument)
|
88
|
+
end
|
89
|
+
|
90
|
+
after { router.route!(base) }
|
91
|
+
end
|
92
|
+
|
93
|
+
context "with a dynamic request" do
|
94
|
+
|
95
|
+
it "should call the original method" do
|
96
|
+
expect( router ).to receive(:route_without_appsignal)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should instrument the action" do
|
100
|
+
expect( ActiveSupport::Notifications ).to receive(:instrument).with(
|
101
|
+
'process_action.padrino',
|
102
|
+
{
|
103
|
+
:params => {'id' => 1},
|
104
|
+
:session => {'user_id' => 123},
|
105
|
+
:method => 'GET',
|
106
|
+
:path => '/users/1'
|
107
|
+
}
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
after { router.route!(base) }
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should add the action to the payload" do
|
115
|
+
router.route!(base)
|
116
|
+
|
117
|
+
expect( @events.first.payload[:action] ).to eql('TestApp:users#show')
|
118
|
+
end
|
119
|
+
|
120
|
+
context "with an exception" do
|
121
|
+
before { router.stub(:route_without_appsignal).and_raise(VerySpecificError) }
|
122
|
+
|
123
|
+
it "should add the exception to the current transaction" do
|
124
|
+
expect( Appsignal ).to receive(:add_exception)
|
125
|
+
|
126
|
+
router.route!(base) rescue VerySpecificError
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rake'
|
3
|
+
describe "Rack integration" do
|
4
|
+
let(:file) { File.expand_path('lib/appsignal/integrations/rake.rb') }
|
5
|
+
let(:app) { double(:current_scope => nil) }
|
6
|
+
let(:task) { Rake::Task.new('task', app) }
|
7
|
+
before do
|
8
|
+
load file
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#invoke" do
|
12
|
+
before do
|
13
|
+
task.stub(
|
14
|
+
:name => 'task:name',
|
15
|
+
:invoke_without_appsignal => true
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should create a transaction" do
|
20
|
+
expect( Appsignal::Transaction ).to receive(:create)
|
21
|
+
end
|
22
|
+
|
23
|
+
context "with transaction" do
|
24
|
+
let!(:transaction) { Appsignal::Transaction.new('123', {}) }
|
25
|
+
let!(:agent) { double('Agent', :send_queue => true) }
|
26
|
+
before do
|
27
|
+
Appsignal::Transaction.stub(:create => transaction)
|
28
|
+
Appsignal.stub(:agent => agent, :active? => true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should set the kind" do
|
32
|
+
expect( transaction ).to receive(:set_kind).with('background_job')
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should set the action" do
|
36
|
+
expect( transaction ).to receive(:set_action).with('task:name')
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should call the original task" do
|
40
|
+
expect( task ).to receive(:invoke_without_appsignal).with('foo')
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should complete the transaction" do
|
44
|
+
expect( transaction ).to receive(:complete!)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should send the queue" do
|
48
|
+
expect( Appsignal.agent ).to receive(:send_queue)
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when Appsignal is not active" do
|
52
|
+
before { Appsignal.stub(:active? => false) }
|
53
|
+
|
54
|
+
it "should not send the queue" do
|
55
|
+
expect( Appsignal.agent ).to_not receive(:send_queue)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context "with an exception" do
|
60
|
+
let(:exception) { VerySpecificError.new }
|
61
|
+
|
62
|
+
before do
|
63
|
+
task.stub(:invoke_without_appsignal).and_raise(exception)
|
64
|
+
Appsignal.stub(:is_ignored_exception? => false )
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should add the exception to the transaction" do
|
68
|
+
expect( transaction ).to receive(:add_exception).with(exception)
|
69
|
+
end
|
70
|
+
|
71
|
+
context "when ignored" do
|
72
|
+
before { Appsignal.stub(:is_ignored_exception? => true ) }
|
73
|
+
|
74
|
+
it "should NOT add the exception to the transaction" do
|
75
|
+
expect( transaction ).to_not receive(:add_exception)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
after { task.invoke('foo') rescue VerySpecificError }
|
82
|
+
end
|
83
|
+
end
|
@@ -23,6 +23,34 @@ if defined?(::Sinatra)
|
|
23
23
|
let(:middleware) { Appsignal::Rack::SinatraInstrumentation.new(app, {}) }
|
24
24
|
|
25
25
|
describe "#call" do
|
26
|
+
before do
|
27
|
+
middleware.stub(:raw_payload => {})
|
28
|
+
end
|
29
|
+
|
30
|
+
context "when appsignal is active" do
|
31
|
+
before { Appsignal.stub(:active? => true) }
|
32
|
+
|
33
|
+
it "should call with monitoring" do
|
34
|
+
expect( middleware ).to receive(:call_with_appsignal_monitoring).with(env)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when appsignal is not active" do
|
39
|
+
before { Appsignal.stub(:active? => false) }
|
40
|
+
|
41
|
+
it "should not call with monitoring" do
|
42
|
+
expect( middleware ).to_not receive(:call_with_appsignal_monitoring)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should call the stack" do
|
46
|
+
expect( app ).to receive(:call).with(env)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
after { middleware.call(env) }
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#call_with_appsignal_monitoring" do
|
26
54
|
before do
|
27
55
|
middleware.stub(:raw_payload => {})
|
28
56
|
env['sinatra.route'] = 'GET /'
|
@@ -31,7 +59,7 @@ if defined?(::Sinatra)
|
|
31
59
|
it "should instrument the call" do
|
32
60
|
app.should_receive(:call).with(env)
|
33
61
|
|
34
|
-
middleware.
|
62
|
+
middleware.call_with_appsignal_monitoring(env)
|
35
63
|
|
36
64
|
process_action_event = @events.last
|
37
65
|
process_action_event.name.should == 'process_action.sinatra'
|
@@ -42,7 +70,7 @@ if defined?(::Sinatra)
|
|
42
70
|
app.should_receive(:call).with(env).and_raise('the roof')
|
43
71
|
|
44
72
|
lambda {
|
45
|
-
middleware.
|
73
|
+
middleware.call_with_appsignal_monitoring(env)
|
46
74
|
}.should raise_error
|
47
75
|
|
48
76
|
process_action_event = @events.last
|
@@ -60,7 +88,7 @@ if defined?(::Sinatra)
|
|
60
88
|
transaction.should_receive(:add_exception).with(exception)
|
61
89
|
Appsignal::Transaction.stub(:current => transaction)
|
62
90
|
|
63
|
-
middleware.
|
91
|
+
middleware.call_with_appsignal_monitoring(env)
|
64
92
|
end
|
65
93
|
end
|
66
94
|
|
@@ -56,6 +56,30 @@ describe Appsignal::Transaction::Formatter do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
context "with a background request without payload" do
|
60
|
+
let(:transaction) do
|
61
|
+
Appsignal::Transaction.new('123', {}).tap do |transaction|
|
62
|
+
transaction.set_kind('web')
|
63
|
+
transaction.set_action('foo#bar')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should get the kind and action from the transaction" do
|
68
|
+
subject.to_hash.should == {
|
69
|
+
:request_id => '123',
|
70
|
+
:log_entry => {
|
71
|
+
:path => '/foo',
|
72
|
+
:kind => 'web',
|
73
|
+
:action => 'foo#bar',
|
74
|
+
:time => nil,
|
75
|
+
:environment => {},
|
76
|
+
:session_data => {},
|
77
|
+
:revision => nil},
|
78
|
+
:failed => false
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
59
83
|
context "with an exception request" do
|
60
84
|
let(:transaction) { transaction_with_exception }
|
61
85
|
|
@@ -189,6 +189,22 @@ describe Appsignal::Transaction do
|
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
192
|
+
describe "#set_kind" do
|
193
|
+
it "should set the kind" do
|
194
|
+
expect{
|
195
|
+
transaction.set_kind('web')
|
196
|
+
}.to change(transaction, :kind).from(nil).to('web')
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "#set_action" do
|
201
|
+
it "should set the action" do
|
202
|
+
expect{
|
203
|
+
transaction.set_action('foo#bar')
|
204
|
+
}.to change(transaction, :action).from(nil).to('foo#bar')
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
192
208
|
context "using exceptions" do
|
193
209
|
let(:exception) do
|
194
210
|
double(
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -403,8 +403,9 @@ describe Appsignal do
|
|
403
403
|
end
|
404
404
|
|
405
405
|
describe ".send_exception" do
|
406
|
-
|
407
|
-
let(:
|
406
|
+
let(:tags) { nil }
|
407
|
+
let(:exception) { VerySpecificError.new }
|
408
|
+
before { Appsignal::IPC.stub(:current => false) }
|
408
409
|
|
409
410
|
it "should send the exception to AppSignal" do
|
410
411
|
agent = double(:shutdown => true, :active? => true)
|
@@ -430,13 +431,21 @@ describe Appsignal do
|
|
430
431
|
Appsignal::Transaction.should_not_receive(:create)
|
431
432
|
end
|
432
433
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
Appsignal.
|
434
|
+
context "when given class is not an exception" do
|
435
|
+
let(:exception) { double }
|
436
|
+
|
437
|
+
it "should log a message" do
|
438
|
+
expect( Appsignal.logger ).to receive(:error).with('Can\'t send exception, given value is not an exception')
|
439
|
+
end
|
440
|
+
|
441
|
+
it "should not send the exception" do
|
442
|
+
expect( Appsignal::Transaction ).to_not receive(:create)
|
438
443
|
end
|
439
444
|
end
|
445
|
+
|
446
|
+
after do
|
447
|
+
Appsignal.send_exception(exception, tags) rescue Exception
|
448
|
+
end
|
440
449
|
end
|
441
450
|
|
442
451
|
describe ".listen_for_exception" do
|
data/spec/spec_helper.rb
CHANGED
@@ -20,6 +20,13 @@ def rails_present?
|
|
20
20
|
RAILS_PRESENT
|
21
21
|
end
|
22
22
|
|
23
|
+
def active_record_present?
|
24
|
+
require 'active_record'
|
25
|
+
true
|
26
|
+
rescue LoadError
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
23
30
|
def running_jruby?
|
24
31
|
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
25
32
|
end
|
@@ -45,6 +52,13 @@ rescue LoadError
|
|
45
52
|
false
|
46
53
|
end
|
47
54
|
|
55
|
+
def padrino_present?
|
56
|
+
require 'padrino'
|
57
|
+
true
|
58
|
+
rescue LoadError
|
59
|
+
false
|
60
|
+
end
|
61
|
+
|
48
62
|
require 'appsignal'
|
49
63
|
|
50
64
|
Dir[File.expand_path(File.join(File.dirname(__FILE__), 'support/helpers','*.rb'))].each {|f| require f}
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appsignal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.13.beta.
|
5
|
-
prerelease: 8
|
4
|
+
version: 0.11.13.beta.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Robert Beekman
|
@@ -13,118 +12,104 @@ authors:
|
|
13
12
|
autorequire:
|
14
13
|
bindir: bin
|
15
14
|
cert_chain: []
|
16
|
-
date: 2015-07-
|
15
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
17
16
|
dependencies:
|
18
17
|
- !ruby/object:Gem::Dependency
|
19
18
|
name: rack
|
20
19
|
requirement: !ruby/object:Gem::Requirement
|
21
|
-
none: false
|
22
20
|
requirements:
|
23
|
-
- -
|
21
|
+
- - ">="
|
24
22
|
- !ruby/object:Gem::Version
|
25
23
|
version: '0'
|
26
24
|
type: :runtime
|
27
25
|
prerelease: false
|
28
26
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
27
|
requirements:
|
31
|
-
- -
|
28
|
+
- - ">="
|
32
29
|
- !ruby/object:Gem::Version
|
33
30
|
version: '0'
|
34
31
|
- !ruby/object:Gem::Dependency
|
35
32
|
name: thread_safe
|
36
33
|
requirement: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
34
|
requirements:
|
39
|
-
- -
|
35
|
+
- - ">="
|
40
36
|
- !ruby/object:Gem::Version
|
41
37
|
version: '0'
|
42
38
|
type: :runtime
|
43
39
|
prerelease: false
|
44
40
|
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
41
|
requirements:
|
47
|
-
- -
|
42
|
+
- - ">="
|
48
43
|
- !ruby/object:Gem::Version
|
49
44
|
version: '0'
|
50
45
|
- !ruby/object:Gem::Dependency
|
51
46
|
name: rake
|
52
47
|
requirement: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
48
|
requirements:
|
55
|
-
- -
|
49
|
+
- - ">="
|
56
50
|
- !ruby/object:Gem::Version
|
57
51
|
version: '0'
|
58
52
|
type: :development
|
59
53
|
prerelease: false
|
60
54
|
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
55
|
requirements:
|
63
|
-
- -
|
56
|
+
- - ">="
|
64
57
|
- !ruby/object:Gem::Version
|
65
58
|
version: '0'
|
66
59
|
- !ruby/object:Gem::Dependency
|
67
60
|
name: rspec
|
68
61
|
requirement: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
62
|
requirements:
|
71
|
-
- - ~>
|
63
|
+
- - "~>"
|
72
64
|
- !ruby/object:Gem::Version
|
73
65
|
version: 2.14.1
|
74
66
|
type: :development
|
75
67
|
prerelease: false
|
76
68
|
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
69
|
requirements:
|
79
|
-
- - ~>
|
70
|
+
- - "~>"
|
80
71
|
- !ruby/object:Gem::Version
|
81
72
|
version: 2.14.1
|
82
73
|
- !ruby/object:Gem::Dependency
|
83
74
|
name: pry
|
84
75
|
requirement: !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
76
|
requirements:
|
87
|
-
- -
|
77
|
+
- - ">="
|
88
78
|
- !ruby/object:Gem::Version
|
89
79
|
version: '0'
|
90
80
|
type: :development
|
91
81
|
prerelease: false
|
92
82
|
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
83
|
requirements:
|
95
|
-
- -
|
84
|
+
- - ">="
|
96
85
|
- !ruby/object:Gem::Version
|
97
86
|
version: '0'
|
98
87
|
- !ruby/object:Gem::Dependency
|
99
88
|
name: timecop
|
100
89
|
requirement: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
90
|
requirements:
|
103
|
-
- -
|
91
|
+
- - ">="
|
104
92
|
- !ruby/object:Gem::Version
|
105
93
|
version: '0'
|
106
94
|
type: :development
|
107
95
|
prerelease: false
|
108
96
|
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
97
|
requirements:
|
111
|
-
- -
|
98
|
+
- - ">="
|
112
99
|
- !ruby/object:Gem::Version
|
113
100
|
version: '0'
|
114
101
|
- !ruby/object:Gem::Dependency
|
115
102
|
name: webmock
|
116
103
|
requirement: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
104
|
requirements:
|
119
|
-
- -
|
105
|
+
- - ">="
|
120
106
|
- !ruby/object:Gem::Version
|
121
107
|
version: '0'
|
122
108
|
type: :development
|
123
109
|
prerelease: false
|
124
110
|
version_requirements: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
111
|
requirements:
|
127
|
-
- -
|
112
|
+
- - ">="
|
128
113
|
- !ruby/object:Gem::Version
|
129
114
|
version: '0'
|
130
115
|
description: The official appsignal.com gem
|
@@ -135,9 +120,9 @@ executables:
|
|
135
120
|
extensions: []
|
136
121
|
extra_rdoc_files: []
|
137
122
|
files:
|
138
|
-
- .gitignore
|
139
|
-
- .rspec
|
140
|
-
- .travis.yml
|
123
|
+
- ".gitignore"
|
124
|
+
- ".rspec"
|
125
|
+
- ".travis.yml"
|
141
126
|
- CHANGELOG.md
|
142
127
|
- Gemfile
|
143
128
|
- LICENSE
|
@@ -149,6 +134,7 @@ files:
|
|
149
134
|
- gemfiles/capistrano2.gemfile
|
150
135
|
- gemfiles/capistrano3.gemfile
|
151
136
|
- gemfiles/no_dependencies.gemfile
|
137
|
+
- gemfiles/padrino-0.13.gemfile
|
152
138
|
- gemfiles/rails-3.0.gemfile
|
153
139
|
- gemfiles/rails-3.1.gemfile
|
154
140
|
- gemfiles/rails-3.2.gemfile
|
@@ -177,8 +163,10 @@ files:
|
|
177
163
|
- lib/appsignal/integrations/capistrano/capistrano_2_tasks.rb
|
178
164
|
- lib/appsignal/integrations/capistrano/careful_logger.rb
|
179
165
|
- lib/appsignal/integrations/delayed_job.rb
|
166
|
+
- lib/appsignal/integrations/padrino.rb
|
180
167
|
- lib/appsignal/integrations/passenger.rb
|
181
168
|
- lib/appsignal/integrations/rails.rb
|
169
|
+
- lib/appsignal/integrations/rake.rb
|
182
170
|
- lib/appsignal/integrations/resque.rb
|
183
171
|
- lib/appsignal/integrations/sequel.rb
|
184
172
|
- lib/appsignal/integrations/sidekiq.rb
|
@@ -223,8 +211,10 @@ files:
|
|
223
211
|
- spec/lib/appsignal/integrations/capistrano2_spec.rb
|
224
212
|
- spec/lib/appsignal/integrations/capistrano3_spec.rb
|
225
213
|
- spec/lib/appsignal/integrations/delayed_job_spec.rb
|
214
|
+
- spec/lib/appsignal/integrations/padrino_spec.rb
|
226
215
|
- spec/lib/appsignal/integrations/passenger_spec.rb
|
227
216
|
- spec/lib/appsignal/integrations/rails_spec.rb
|
217
|
+
- spec/lib/appsignal/integrations/rake_spec.rb
|
228
218
|
- spec/lib/appsignal/integrations/resque_spec.rb
|
229
219
|
- spec/lib/appsignal/integrations/sequel_spec.rb
|
230
220
|
- spec/lib/appsignal/integrations/sidekiq_spec.rb
|
@@ -259,27 +249,26 @@ files:
|
|
259
249
|
homepage: https://github.com/appsignal/appsignal
|
260
250
|
licenses:
|
261
251
|
- MIT
|
252
|
+
metadata: {}
|
262
253
|
post_install_message:
|
263
254
|
rdoc_options: []
|
264
255
|
require_paths:
|
265
256
|
- lib
|
266
257
|
required_ruby_version: !ruby/object:Gem::Requirement
|
267
|
-
none: false
|
268
258
|
requirements:
|
269
|
-
- -
|
259
|
+
- - ">="
|
270
260
|
- !ruby/object:Gem::Version
|
271
261
|
version: '1.9'
|
272
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
|
-
none: false
|
274
263
|
requirements:
|
275
|
-
- -
|
264
|
+
- - ">"
|
276
265
|
- !ruby/object:Gem::Version
|
277
266
|
version: 1.3.1
|
278
267
|
requirements: []
|
279
268
|
rubyforge_project:
|
280
|
-
rubygems_version:
|
269
|
+
rubygems_version: 2.4.5
|
281
270
|
signing_key:
|
282
|
-
specification_version:
|
271
|
+
specification_version: 4
|
283
272
|
summary: Logs performance and exception data from your app to appsignal.com
|
284
273
|
test_files:
|
285
274
|
- spec/lib/appsignal/agent_spec.rb
|
@@ -298,8 +287,10 @@ test_files:
|
|
298
287
|
- spec/lib/appsignal/integrations/capistrano2_spec.rb
|
299
288
|
- spec/lib/appsignal/integrations/capistrano3_spec.rb
|
300
289
|
- spec/lib/appsignal/integrations/delayed_job_spec.rb
|
290
|
+
- spec/lib/appsignal/integrations/padrino_spec.rb
|
301
291
|
- spec/lib/appsignal/integrations/passenger_spec.rb
|
302
292
|
- spec/lib/appsignal/integrations/rails_spec.rb
|
293
|
+
- spec/lib/appsignal/integrations/rake_spec.rb
|
303
294
|
- spec/lib/appsignal/integrations/resque_spec.rb
|
304
295
|
- spec/lib/appsignal/integrations/sequel_spec.rb
|
305
296
|
- spec/lib/appsignal/integrations/sidekiq_spec.rb
|