appsignal 0.11.8.beta.2 → 0.11.8.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/appsignal/integrations/rails.rb +15 -9
- data/lib/appsignal/rack/js_exception_catcher.rb +3 -7
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/integrations/rails_spec.rb +57 -25
- data/spec/lib/appsignal/rack/js_exception_catcher_spec.rb +0 -17
- data/spec/support/rails/my_app.rb +0 -7
- metadata +24 -40
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 41eb79c820f9d67a1344387af4fc6397d11dcfaa
|
4
|
+
data.tar.gz: 26ea28e40d99d4f8a33eb9604620fcbc1caada42
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 112b6cf13f7ac013141d1d3e351c373c727d6826d82d339f98904db17183bcb4fa6e5dc6b19f54b08de774a49b1db590bb515b15716fefba75f1916bcd1dc609
|
7
|
+
data.tar.gz: 480404bb50bbbdc7fbc9ad8cc76bf3487a90f8eef1cfe28e1e425d4986d7744c3262b58f6fdc73fa51ce40b41221e7b76327f379276fa96b6c520db59e3b1bb3
|
@@ -5,17 +5,10 @@ if defined?(::Rails)
|
|
5
5
|
module Integrations
|
6
6
|
class Railtie < ::Rails::Railtie
|
7
7
|
initializer 'appsignal.configure_rails_initialization' do |app|
|
8
|
-
|
9
|
-
ActionDispatch::RemoteIp,
|
10
|
-
Appsignal::Rack::JSExceptionCatcher
|
11
|
-
)
|
12
|
-
app.middleware.insert_after(
|
13
|
-
Appsignal::Rack::JSExceptionCatcher,
|
14
|
-
Appsignal::Rack::Listener
|
15
|
-
)
|
8
|
+
Appsignal::Integrations::Railtie.initialize_appsignal(app)
|
16
9
|
end
|
17
10
|
|
18
|
-
|
11
|
+
def self.initialize_appsignal(app)
|
19
12
|
# Start logger
|
20
13
|
Appsignal.start_logger(Rails.root.join('log'))
|
21
14
|
|
@@ -26,6 +19,19 @@ if defined?(::Rails)
|
|
26
19
|
:name => Rails.application.class.parent_name
|
27
20
|
)
|
28
21
|
|
22
|
+
app.middleware.insert_before(
|
23
|
+
ActionDispatch::RemoteIp,
|
24
|
+
Appsignal::Rack::Listener
|
25
|
+
)
|
26
|
+
|
27
|
+
if Appsignal.config.active? &&
|
28
|
+
Appsignal.config[:enable_frontend_error_catching] == true
|
29
|
+
app.middleware.insert_before(
|
30
|
+
Appsignal::Rack::Listener,
|
31
|
+
Appsignal::Rack::JSExceptionCatcher,
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
29
35
|
Appsignal.start
|
30
36
|
end
|
31
37
|
end
|
@@ -8,13 +8,9 @@ module Appsignal
|
|
8
8
|
|
9
9
|
def call(env)
|
10
10
|
if env['PATH_INFO'] == Appsignal.config[:frontend_error_catching_path]
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
body = JSON.parse(env['rack.input'].read)
|
15
|
-
transaction = JSExceptionTransaction.new(body)
|
16
|
-
transaction.complete!
|
17
|
-
end
|
11
|
+
body = JSON.parse(env['rack.input'].read)
|
12
|
+
transaction = JSExceptionTransaction.new(body)
|
13
|
+
transaction.complete!
|
18
14
|
return [ 200, {}, []]
|
19
15
|
else
|
20
16
|
@app.call(env)
|
data/lib/appsignal/version.rb
CHANGED
@@ -3,18 +3,27 @@ require 'spec_helper'
|
|
3
3
|
if rails_present?
|
4
4
|
describe Appsignal::Integrations::Railtie do
|
5
5
|
context "after initializing the app" do
|
6
|
-
|
6
|
+
it "should call initialize_appsignal" do
|
7
|
+
expect( Appsignal::Integrations::Railtie ).to receive(:initialize_appsignal)
|
8
|
+
|
7
9
|
MyApp::Application.config.root = project_fixture_path
|
8
10
|
MyApp::Application.initialize!
|
9
11
|
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#initialize_appsignal" do
|
15
|
+
let(:app) { MyApp::Application }
|
16
|
+
before { app.middleware.stub(:insert_before => true) }
|
10
17
|
|
11
18
|
context "logger" do
|
19
|
+
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
12
20
|
subject { Appsignal.logger }
|
13
21
|
|
14
22
|
it { should be_a Logger }
|
15
23
|
end
|
16
24
|
|
17
25
|
context "config" do
|
26
|
+
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
18
27
|
subject { Appsignal.config }
|
19
28
|
|
20
29
|
it { should be_a(Appsignal::Config) }
|
@@ -24,45 +33,68 @@ if rails_present?
|
|
24
33
|
its([:name]) { should == 'TestApp' }
|
25
34
|
|
26
35
|
context "initial config" do
|
36
|
+
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
27
37
|
subject { Appsignal.config.initial_config }
|
28
38
|
|
29
39
|
its([:name]) { should == 'MyApp' }
|
30
40
|
end
|
31
|
-
end
|
32
41
|
|
33
|
-
|
34
|
-
|
42
|
+
context "with APPSIGNAL_APP_ENV ENV var set" do
|
43
|
+
around do |sample|
|
44
|
+
ENV['APPSIGNAL_APP_ENV'] = 'env_test'
|
45
|
+
sample.run
|
46
|
+
ENV.delete('APPSIGNAL_APP_ENV')
|
47
|
+
end
|
35
48
|
|
36
|
-
it { should be_a(Appsignal::Agent) }
|
37
|
-
end
|
38
49
|
|
39
|
-
|
40
|
-
|
50
|
+
its(:env) { should == 'env_test' }
|
51
|
+
end
|
41
52
|
end
|
42
53
|
|
43
|
-
|
44
|
-
|
45
|
-
|
54
|
+
context "agent" do
|
55
|
+
before { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
56
|
+
subject { Appsignal.agent }
|
46
57
|
|
47
|
-
|
48
|
-
MyApp::Application.middleware.to_a.should_not include Appsignal::Rack::Instrumentation
|
58
|
+
it { should be_a(Appsignal::Agent) }
|
49
59
|
end
|
50
|
-
end
|
51
60
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
61
|
+
context "listener middleware" do
|
62
|
+
it "should have added the listener middleware" do
|
63
|
+
expect( app.middleware ).to receive(:insert_before).with(
|
64
|
+
ActionDispatch::RemoteIp,
|
65
|
+
Appsignal::Rack::Listener
|
66
|
+
)
|
67
|
+
end
|
58
68
|
|
59
|
-
|
69
|
+
context "when frontend_error_catching is enabled" do
|
70
|
+
let(:config) do
|
71
|
+
Appsignal::Config.new(
|
72
|
+
project_fixture_path,
|
73
|
+
'test',
|
74
|
+
:name => 'MyApp',
|
75
|
+
:enable_frontend_error_catching => true
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
before do
|
80
|
+
Appsignal.stub(:config => config)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should have added the listener and JSExceptionCatcher middleware" do
|
84
|
+
expect( app.middleware ).to receive(:insert_before).with(
|
85
|
+
ActionDispatch::RemoteIp,
|
86
|
+
Appsignal::Rack::Listener
|
87
|
+
)
|
88
|
+
|
89
|
+
expect( app.middleware ).to receive(:insert_before).with(
|
90
|
+
Appsignal::Rack::Listener,
|
91
|
+
Appsignal::Rack::JSExceptionCatcher
|
92
|
+
)
|
93
|
+
end
|
94
|
+
end
|
60
95
|
|
61
|
-
|
96
|
+
after { Appsignal::Integrations::Railtie.initialize_appsignal(app) }
|
62
97
|
end
|
63
|
-
subject { Appsignal.config }
|
64
|
-
|
65
|
-
its(:env) { should == 'env_test' }
|
66
98
|
end
|
67
99
|
end
|
68
100
|
end
|
@@ -49,26 +49,9 @@ describe Appsignal::Rack::JSExceptionCatcher do
|
|
49
49
|
expect( transaction ).to receive(:complete!)
|
50
50
|
end
|
51
51
|
|
52
|
-
context "when appsignal is not active" do
|
53
|
-
let(:active) { false }
|
54
|
-
|
55
|
-
it "should not create a transaction" do
|
56
|
-
expect( Appsignal::JSExceptionTransaction ).to_not receive(:new)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "when `enable_frontend_error_catching` is disabled" do
|
61
|
-
let(:config_options) { {:enable_frontend_error_catching => false} }
|
62
|
-
|
63
|
-
it "should not create a transaction" do
|
64
|
-
expect( Appsignal::JSExceptionTransaction ).to_not receive(:new)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
52
|
context "when `frontend_error_catching_path` is different" do
|
69
53
|
let(:config_options) do
|
70
54
|
{
|
71
|
-
:enable_frontend_error_catching => true,
|
72
55
|
:frontend_error_catching_path => '/foo'
|
73
56
|
}
|
74
57
|
end
|
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.8.beta.
|
5
|
-
prerelease: 7
|
4
|
+
version: 0.11.8.beta.3
|
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-03-
|
15
|
+
date: 2015-03-20 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
|
@@ -257,27 +242,26 @@ files:
|
|
257
242
|
homepage: https://github.com/appsignal/appsignal
|
258
243
|
licenses:
|
259
244
|
- MIT
|
245
|
+
metadata: {}
|
260
246
|
post_install_message:
|
261
247
|
rdoc_options: []
|
262
248
|
require_paths:
|
263
249
|
- lib
|
264
250
|
required_ruby_version: !ruby/object:Gem::Requirement
|
265
|
-
none: false
|
266
251
|
requirements:
|
267
|
-
- -
|
252
|
+
- - ">="
|
268
253
|
- !ruby/object:Gem::Version
|
269
254
|
version: '1.9'
|
270
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
|
-
none: false
|
272
256
|
requirements:
|
273
|
-
- -
|
257
|
+
- - ">"
|
274
258
|
- !ruby/object:Gem::Version
|
275
259
|
version: 1.3.1
|
276
260
|
requirements: []
|
277
261
|
rubyforge_project:
|
278
|
-
rubygems_version:
|
262
|
+
rubygems_version: 2.2.2
|
279
263
|
signing_key:
|
280
|
-
specification_version:
|
264
|
+
specification_version: 4
|
281
265
|
summary: Logs performance and exception data from your app to appsignal.com
|
282
266
|
test_files:
|
283
267
|
- spec/lib/appsignal/agent_spec.rb
|