appsignal 0.11.13.beta.4 → 0.11.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939d3b7a54a4b39ec139e95f135fcd25565fac74
|
4
|
+
data.tar.gz: d186dc6f7a065ae88bff571e3963955dd0bf74a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8f57aee9899c31b32997a99652702c36f9e3234d35c1e29acfcfc40d19285bd28a1cc244818c0cdbc6fcf804fa3680c770a83929e51765f46c52ae2524807b2
|
7
|
+
data.tar.gz: d5f6ea1bcf79f0c5c23e169baff789e52a5c6ee8f0f75717ed285b3f84aa147694ae403f430a0007e967aae7b706a371c9b00b54174a577176dc77cf65d7a271
|
@@ -25,23 +25,38 @@ module Padrino::Routing::InstanceMethods
|
|
25
25
|
if env['sinatra.static_file']
|
26
26
|
route_without_appsignal(base, pass_block)
|
27
27
|
else
|
28
|
-
|
28
|
+
request_payload = {
|
29
29
|
:params => request.params,
|
30
30
|
:session => request.session,
|
31
31
|
:method => request.request_method,
|
32
32
|
:path => request.path
|
33
33
|
}
|
34
|
-
ActiveSupport::Notifications.instrument('process_action.padrino',
|
34
|
+
ActiveSupport::Notifications.instrument('process_action.padrino', request_payload) do |request_payload|
|
35
35
|
begin
|
36
36
|
route_without_appsignal(base, pass_block)
|
37
37
|
rescue => e
|
38
38
|
Appsignal.add_exception(e); raise e
|
39
39
|
ensure
|
40
|
-
|
40
|
+
request_payload[:action] = get_payload_action(request)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
+
|
46
|
+
def get_payload_action(request)
|
47
|
+
# Short-circut is there's no request object to obtain information from
|
48
|
+
return "#{settings.name}" if request.nil?
|
49
|
+
|
50
|
+
# Older versions of Padrino work with a route object
|
51
|
+
route_obj = defined?(request.route_obj) && request.route_obj
|
52
|
+
if route_obj && route_obj.respond_to?(:original_path)
|
53
|
+
return "#{settings.name}:#{request.route_obj.original_path}"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Newer versions expose the action / controller on the request class
|
57
|
+
request_data = request.respond_to?(:action) ? request.action : request.fullpath
|
58
|
+
"#{settings.name}:#{request.controller}##{request_data}"
|
59
|
+
end
|
45
60
|
end
|
46
61
|
|
47
62
|
Padrino.after_load do
|
data/lib/appsignal/version.rb
CHANGED
@@ -8,13 +8,13 @@ if padrino_present?
|
|
8
8
|
include Padrino::Routing
|
9
9
|
end
|
10
10
|
|
11
|
-
before
|
11
|
+
before do
|
12
12
|
@events = []
|
13
13
|
@subscriber = ActiveSupport::Notifications.subscribe do |*args|
|
14
14
|
@events << ActiveSupport::Notifications::Event.new(*args)
|
15
15
|
end
|
16
16
|
end
|
17
|
-
after
|
17
|
+
after do
|
18
18
|
ActiveSupport::Notifications.unsubscribe(@subscriber)
|
19
19
|
end
|
20
20
|
|
@@ -56,76 +56,116 @@ if padrino_present?
|
|
56
56
|
let(:env) { {} }
|
57
57
|
let(:settings) { double(:name => 'TestApp') }
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
59
|
+
describe "#route!" do
|
60
|
+
let(:request) do
|
61
|
+
double(
|
62
|
+
:params => {'id' => 1},
|
63
|
+
:session => {'user_id' => 123},
|
64
|
+
:request_method => 'GET',
|
65
|
+
:path => '/users/1',
|
66
|
+
:controller => 'users',
|
67
|
+
:action => 'show'
|
68
|
+
)
|
69
|
+
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
before do
|
72
|
+
router.stub(
|
73
|
+
:route_without_appsignal => true,
|
74
|
+
:request => request,
|
75
|
+
:env => env,
|
76
|
+
:settings => settings,
|
77
|
+
:get_payload_action => 'controller#action'
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
context "when Sinatra tells us it's a static file" do
|
82
|
+
let(:env) { {'sinatra.static_file' => true} }
|
83
|
+
|
84
|
+
it "should call the original method" do
|
85
|
+
expect( router ).to receive(:route_without_appsignal)
|
86
|
+
end
|
78
87
|
|
79
|
-
|
80
|
-
|
88
|
+
it "should not instrument the request" do
|
89
|
+
expect( ActiveSupport::Notifications ).to_not receive(:instrument)
|
90
|
+
end
|
81
91
|
|
82
|
-
|
83
|
-
expect( router ).to receive(:route_without_appsignal)
|
92
|
+
after { router.route!(base) }
|
84
93
|
end
|
85
94
|
|
86
|
-
|
87
|
-
|
95
|
+
context "with a dynamic request" do
|
96
|
+
|
97
|
+
it "should call the original method" do
|
98
|
+
expect( router ).to receive(:route_without_appsignal)
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should instrument the action" do
|
102
|
+
expect( ActiveSupport::Notifications ).to receive(:instrument).with(
|
103
|
+
'process_action.padrino',
|
104
|
+
{
|
105
|
+
:params => {'id' => 1},
|
106
|
+
:session => {'user_id' => 123},
|
107
|
+
:method => 'GET',
|
108
|
+
:path => '/users/1'
|
109
|
+
}
|
110
|
+
)
|
111
|
+
end
|
112
|
+
|
113
|
+
after { router.route!(base) }
|
88
114
|
end
|
89
115
|
|
90
|
-
|
91
|
-
|
116
|
+
it "should add the action to the payload" do
|
117
|
+
router.route!(base)
|
118
|
+
|
119
|
+
expect( @events.first.payload[:action] ).to eql('controller#action')
|
120
|
+
end
|
92
121
|
|
93
|
-
|
122
|
+
context "with an exception" do
|
123
|
+
before { router.stub(:route_without_appsignal).and_raise(VerySpecificError) }
|
94
124
|
|
95
|
-
|
96
|
-
|
125
|
+
it "should add the exception to the current transaction" do
|
126
|
+
expect( Appsignal ).to receive(:add_exception)
|
127
|
+
|
128
|
+
router.route!(base) rescue VerySpecificError
|
129
|
+
end
|
97
130
|
end
|
131
|
+
end
|
98
132
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
:path => '/users/1'
|
107
|
-
}
|
108
|
-
)
|
133
|
+
describe "#get_payload_action" do
|
134
|
+
before { router.stub(:settings => settings) }
|
135
|
+
|
136
|
+
context "when request is nil" do
|
137
|
+
it "should return the site" do
|
138
|
+
expect( router.get_payload_action(nil) ).to eql('TestApp')
|
139
|
+
end
|
109
140
|
end
|
110
141
|
|
111
|
-
|
112
|
-
|
142
|
+
context "when there's no route object" do
|
143
|
+
let(:request) { double(:controller => 'Controller', :action => 'action') }
|
113
144
|
|
114
|
-
|
115
|
-
|
145
|
+
it "should return the site name, controller and action" do
|
146
|
+
expect( router.get_payload_action(request) ).to eql('TestApp:Controller#action')
|
147
|
+
end
|
116
148
|
|
117
|
-
|
118
|
-
|
149
|
+
context "when there's no action" do
|
150
|
+
let(:request) { double(:controller => 'Controller', :fullpath => '/action') }
|
119
151
|
|
120
|
-
|
121
|
-
|
152
|
+
it "should return the site name, controller and fullpath" do
|
153
|
+
expect( router.get_payload_action(request) ).to eql('TestApp:Controller#/action')
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
122
157
|
|
123
|
-
|
124
|
-
|
158
|
+
context "when request has a route object" do
|
159
|
+
let(:request) { double }
|
160
|
+
let(:route_object) { double(:original_path => '/accounts/edit/:id') }
|
161
|
+
before { request.stub(:route_obj => route_object) }
|
125
162
|
|
126
|
-
|
163
|
+
it "should return the original path" do
|
164
|
+
expect( router.get_payload_action(request) ).to eql('TestApp:/accounts/edit/:id')
|
165
|
+
end
|
127
166
|
end
|
128
167
|
end
|
168
|
+
|
129
169
|
end
|
130
170
|
end
|
131
171
|
end
|
@@ -104,11 +104,11 @@ describe "Sidekiq integration" do
|
|
104
104
|
|
105
105
|
describe "#truncate" do
|
106
106
|
let(:very_long_text) do
|
107
|
-
"a" *
|
107
|
+
"a" * 400
|
108
108
|
end
|
109
109
|
|
110
|
-
it "should truncate the text to
|
111
|
-
plugin.truncate(very_long_text).should == "#{'a' *
|
110
|
+
it "should truncate the text to 200 chars max" do
|
111
|
+
plugin.truncate(very_long_text).should == "#{'a' * 197}..."
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
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.13
|
4
|
+
version: 0.11.13
|
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-08-
|
15
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rack
|
@@ -261,9 +261,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
261
261
|
version: '1.9'
|
262
262
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
263
|
requirements:
|
264
|
-
- - "
|
264
|
+
- - ">="
|
265
265
|
- !ruby/object:Gem::Version
|
266
|
-
version:
|
266
|
+
version: '0'
|
267
267
|
requirements: []
|
268
268
|
rubyforge_project:
|
269
269
|
rubygems_version: 2.4.5
|