rollbar 0.11.5 → 0.11.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rollbar/middleware/rails/rollbar_request_store.rb +25 -0
- data/lib/rollbar/railtie.rb +6 -0
- data/lib/rollbar/request_data_extractor.rb +1 -2
- data/lib/rollbar/version.rb +1 -1
- data/spec/controllers/home_controller_spec.rb +12 -0
- data/spec/dummyapp/app/controllers/home_controller.rb +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbb658a771dc1cbad8de7954d57946917e118850
|
4
|
+
data.tar.gz: 105c6f0298070083eabd46665a6311331c40918f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 792ff9b09527b95a6bd284da0df1fea31671fe2cd2140d2aac334edf3e5009af703ef57d4ff03d37c1137b7967d406bc307269b987b4cca81c0d3fe9ae3d545f
|
7
|
+
data.tar.gz: e9b9cc45ed82b74a4bc02189c86dd2a27f5644108615f2d33bc72b7a5d4c291bdbf54328be4a4cb2ea2515c541d41c3b226a7e5dc57634bc96f6007b320907ff
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Rollbar
|
2
|
+
module Middleware
|
3
|
+
module Rails
|
4
|
+
# Middleware that ensures any database calls to load data for exception reports
|
5
|
+
# are done before connections are cleaned up by the rake connection pool middleware
|
6
|
+
class RollbarRequestStore
|
7
|
+
def initialize(app)
|
8
|
+
@app = app
|
9
|
+
end
|
10
|
+
|
11
|
+
def call(env)
|
12
|
+
begin
|
13
|
+
@app.call(env)
|
14
|
+
rescue
|
15
|
+
controller = env["action_controller.instance"]
|
16
|
+
if controller
|
17
|
+
env['rollbar.person_data'] = controller.try(Rollbar.configuration.person_method)
|
18
|
+
end
|
19
|
+
raise
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/rollbar/railtie.rb
CHANGED
@@ -6,6 +6,12 @@ module Rollbar
|
|
6
6
|
rake_tasks do
|
7
7
|
require 'rollbar/rake_tasks'
|
8
8
|
end
|
9
|
+
|
10
|
+
initializer 'rollbar.middleware.rails' do |app|
|
11
|
+
require 'rollbar/middleware/rails/rollbar_request_store'
|
12
|
+
app.config.middleware.insert_after ActiveRecord::ConnectionAdapters::ConnectionManagement,
|
13
|
+
Rollbar::Middleware::Rails::RollbarRequestStore
|
14
|
+
end
|
9
15
|
|
10
16
|
config.after_initialize do
|
11
17
|
Rollbar.configure do |config|
|
@@ -6,8 +6,7 @@ module Rollbar
|
|
6
6
|
].freeze
|
7
7
|
|
8
8
|
def extract_person_data_from_controller(env)
|
9
|
-
|
10
|
-
person_data = controller ? controller.try(:rollbar_person_data) : {}
|
9
|
+
person_data = env['rollbar.person_data'] || {}
|
11
10
|
end
|
12
11
|
|
13
12
|
def extract_request_data_from_rack(env)
|
data/lib/rollbar/version.rb
CHANGED
@@ -278,6 +278,18 @@ describe HomeController do
|
|
278
278
|
|
279
279
|
get 'cause_exception'
|
280
280
|
end
|
281
|
+
|
282
|
+
it 'rollbar request store should extract person data and put it into the reqest' do
|
283
|
+
Rollbar.configure do |config|
|
284
|
+
config.person_method = 'custom_current_user'
|
285
|
+
end
|
286
|
+
|
287
|
+
get 'cause_exception'
|
288
|
+
|
289
|
+
user = request.env['rollbar.person_data']
|
290
|
+
user.id.should == 123
|
291
|
+
user.name.should == 'test'
|
292
|
+
end
|
281
293
|
end
|
282
294
|
end
|
283
295
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Rue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/rollbar/goalie.rb
|
158
158
|
- lib/rollbar/middleware/rack/builder.rb
|
159
159
|
- lib/rollbar/middleware/rack/test_session.rb
|
160
|
+
- lib/rollbar/middleware/rails/rollbar_request_store.rb
|
160
161
|
- lib/rollbar/middleware/rails/show_exceptions.rb
|
161
162
|
- lib/rollbar/rack.rb
|
162
163
|
- lib/rollbar/rails.rb
|