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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92f097c75f3cb5932b906b826e27419c976f21a2
4
- data.tar.gz: 428482c69eefc4a6a98edd0b2c6d549f45d816b4
3
+ metadata.gz: bbb658a771dc1cbad8de7954d57946917e118850
4
+ data.tar.gz: 105c6f0298070083eabd46665a6311331c40918f
5
5
  SHA512:
6
- metadata.gz: d247e87607a92f30fb146b8ddb07b86f7cc1ffe6224d55a84643c087cb32909fc550e3629a77066126dd7437fbda15433cef398425746ff73cde30f2069e5fbf
7
- data.tar.gz: 1584aeb1cf872ab96222d7dc77b2ee6fd40fe1b2c5a152db92294e6a9796b89bf9e825990766859b957bb15d75938c57000b31004be607b50a67b849b7380a8a
6
+ metadata.gz: 792ff9b09527b95a6bd284da0df1fea31671fe2cd2140d2aac334edf3e5009af703ef57d4ff03d37c1137b7967d406bc307269b987b4cca81c0d3fe9ae3d545f
7
+ data.tar.gz: e9b9cc45ed82b74a4bc02189c86dd2a27f5644108615f2d33bc72b7a5d4c291bdbf54328be4a4cb2ea2515c541d41c3b226a7e5dc57634bc96f6007b320907ff
@@ -1,5 +1,8 @@
1
1
  # Change Log
2
2
 
3
+ **0.11.6**
4
+ - Adding new middleware that grabs possible database-hitting person data before the rake connection pool cleanup middleware
5
+
3
6
  **0.11.5**
4
7
  - Fix rake test task when Authlogic is present
5
8
 
@@ -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
@@ -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
- controller = env['action_controller.instance']
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)
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "0.11.5"
2
+ VERSION = "0.11.6"
3
3
  end
@@ -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
 
@@ -22,4 +22,11 @@ class HomeController < ApplicationController
22
22
  def current_user
23
23
  User.find_by_encrypted_password(cookies[:session_id])
24
24
  end
25
+
26
+ def custom_current_user
27
+ user = User.new
28
+ user.id = 123
29
+ user.name = 'test'
30
+ user
31
+ end
25
32
  end
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.5
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-18 00:00:00.000000000 Z
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