appsignal 1.3.5.beta.1 → 1.3.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1df981364fb99fb2a476f560e03d4daa641ed611
|
4
|
+
data.tar.gz: 2f0ce5ca8fbf1a6b71aba911969526bff71e25a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 089d7016d35c1bcde5db31d0030b7d35f8961f97f776121886d1d113ce775bdb0db77afea79b70cf64000ce141bb954af5c3a39c756fe4dbe9d8df8274c837c3
|
7
|
+
data.tar.gz: 535b644066102b0deecd804aea5fc5bab859c59b659e51f29ffa34ffbc8d9ba5509636fd18d0f03da7637ce0c85233703d350c7d645f85a4716aaff532fa2e0b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# 1.3.5
|
2
2
|
|
3
3
|
- Fix SSL certificate config in appsignal-agent. PR #151
|
4
|
+
- Remove mounted_at Sinatra middleware option. Now detected by default. PR #146
|
5
|
+
- Sinatra applications with middleware loading before AppSignal's middleware
|
6
|
+
would crash a request. Fixed in PR #156
|
4
7
|
|
5
8
|
# 1.3.4
|
6
9
|
|
@@ -29,7 +29,7 @@ module Appsignal
|
|
29
29
|
def initialize(app, options = {})
|
30
30
|
Appsignal.logger.debug 'Initializing Appsignal::Rack::SinatraInstrumentation'
|
31
31
|
@app, @options = app, options
|
32
|
-
@raise_errors_on = @app
|
32
|
+
@raise_errors_on = raise_errors?(@app)
|
33
33
|
end
|
34
34
|
|
35
35
|
def call(env)
|
@@ -75,16 +75,21 @@ module Appsignal
|
|
75
75
|
def action_name(env)
|
76
76
|
return unless env['sinatra.route']
|
77
77
|
|
78
|
-
if
|
79
|
-
method, route = env['sinatra.route'].split(" ")
|
80
|
-
"#{method} #{@options[:mounted_at]}#{route}"
|
81
|
-
elsif env['SCRIPT_NAME']
|
78
|
+
if env['SCRIPT_NAME']
|
82
79
|
method, route = env['sinatra.route'].split(" ")
|
83
80
|
"#{method} #{env['SCRIPT_NAME']}#{route}"
|
84
81
|
else
|
85
82
|
env['sinatra.route']
|
86
83
|
end
|
87
84
|
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def raise_errors?(app)
|
89
|
+
app.respond_to?(:settings) &&
|
90
|
+
app.settings.respond_to?(:raise_errors) &&
|
91
|
+
app.settings.raise_errors
|
92
|
+
end
|
88
93
|
end
|
89
94
|
end
|
90
95
|
end
|
data/lib/appsignal/version.rb
CHANGED
@@ -45,6 +45,40 @@ if defined?(::Sinatra)
|
|
45
45
|
let(:options) { {} }
|
46
46
|
let(:middleware) { Appsignal::Rack::SinatraBaseInstrumentation.new(app, options) }
|
47
47
|
|
48
|
+
describe "#initialize" do
|
49
|
+
context "with no settings method in the Sinatra app" do
|
50
|
+
let(:app) { double(:call => true) }
|
51
|
+
|
52
|
+
it "should not raise errors" do
|
53
|
+
expect( middleware.raise_errors_on ).to be(false)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "with no raise_errors setting in the Sinatra app" do
|
58
|
+
let(:app) { double(:call => true, :settings => double) }
|
59
|
+
|
60
|
+
it "should not raise errors" do
|
61
|
+
expect( middleware.raise_errors_on ).to be(false)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "with raise_errors turned off in the Sinatra app" do
|
66
|
+
let(:app) { double(:call => true, :settings => double(:raise_errors => false)) }
|
67
|
+
|
68
|
+
it "should raise errors" do
|
69
|
+
expect( middleware.raise_errors_on ).to be(false)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "with raise_errors turned on in the Sinatra app" do
|
74
|
+
let(:app) { double(:call => true, :settings => double(:raise_errors => true)) }
|
75
|
+
|
76
|
+
it "should raise errors" do
|
77
|
+
expect( middleware.raise_errors_on ).to be(true)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
48
82
|
describe "#call" do
|
49
83
|
before do
|
50
84
|
middleware.stub(:raw_payload => {})
|
@@ -139,22 +173,6 @@ if defined?(::Sinatra)
|
|
139
173
|
end
|
140
174
|
end
|
141
175
|
|
142
|
-
context "with option to set path a mounted_at prefix" do
|
143
|
-
let(:options) {{ :mounted_at => "/api/v2" }}
|
144
|
-
|
145
|
-
it "should call set_action with a prefix path" do
|
146
|
-
Appsignal::Transaction.any_instance.should_receive(:set_action).with("GET /api/v2/")
|
147
|
-
end
|
148
|
-
|
149
|
-
context "without 'sinatra.route' env" do
|
150
|
-
let(:env) { {:path => '/', :method => 'GET'} }
|
151
|
-
|
152
|
-
it "returns nil" do
|
153
|
-
Appsignal::Transaction.any_instance.should_receive(:set_action).with(nil)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
176
|
context "with mounted modular application" do
|
159
177
|
before { env['SCRIPT_NAME'] = '/api' }
|
160
178
|
|
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: 1.3.5
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -313,9 +313,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
313
313
|
version: '1.9'
|
314
314
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
315
315
|
requirements:
|
316
|
-
- - "
|
316
|
+
- - ">="
|
317
317
|
- !ruby/object:Gem::Version
|
318
|
-
version:
|
318
|
+
version: '0'
|
319
319
|
requirements: []
|
320
320
|
rubyforge_project:
|
321
321
|
rubygems_version: 2.5.1
|