rollbar 0.12.3 → 0.12.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: 44e090d61a9b70d5cbb17870bc0f5e34c95968db
4
- data.tar.gz: 39ff1049102e01994034bc3d16abc56b51a85a46
3
+ metadata.gz: 23c9d47e5d49503a01978ee4d8e4fa00816522de
4
+ data.tar.gz: fecba94515d4ed5a804d735d73b54dcdb048edd3
5
5
  SHA512:
6
- metadata.gz: 219ca368775abdeca9960080e684356f29994929f64091e9e1a7b76e620e0fe1e460c4fb9bd51dd900253c7778bae7a71f3a315fc590d7d45ad4fb310cdefa45
7
- data.tar.gz: 2bc902e4f9a8cfecbb2a37cd2e198ab309c0dcb4a68f8e6c7b14ffe0530eaf01a455c44df58d2755aa6238d1c9e2392c4d70c649e86faac4e8d5bd2247de0ff1
6
+ metadata.gz: 5cbab0b59a0cc48c1798c976d3891068a8ce43ed5c3b2419323adb7cd11f79fadf14577448f86890f08a5358284ed123211f585e4c08c3af95a66e835414db17
7
+ data.tar.gz: 022d97884a1ff339520f7492ce22fedc77536a710588b47ba2cf37a75e6646fb08d515a2edfeee5eac94040c6afd1a8c5fb3e360d14f2e8d215f1f3228414e74
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ **0.12.5**
4
+ - Fixed SIGSEGV with the delayed_job plugin and Ruby 2.1.0
5
+
6
+ **0.12.4**
7
+ - Record controller context (controller#action) in reported items
8
+
3
9
  **0.12.3**
4
10
  - Change rollbar_request_store middleware to only grab required person data properties by using rollbar_person_data
5
11
 
data/lib/rollbar.rb CHANGED
@@ -79,8 +79,13 @@ module Rollbar
79
79
 
80
80
  data = exception_data(exception, level ? level : filtered_level(exception))
81
81
  if request_data
82
+ if request_data[:route]
83
+ data[:context] = request_data[:route][:controller] + '#' + request_data[:route][:action]
84
+ end
85
+
82
86
  request_data[:env].reject!{|k, v| v.is_a?(IO) } if request_data[:env]
83
87
  data[:request] = request_data
88
+
84
89
  end
85
90
  data[:person] = person_data if person_data
86
91
 
@@ -3,19 +3,13 @@
3
3
  module Delayed
4
4
  module Plugins
5
5
  class Rollbar < Plugin
6
- module ReportErrors
7
- def error(job, error)
8
- # send the job object as the 'request data'
9
- ::Rollbar.report_exception(error, job)
10
- super if defined?(super)
11
- end
12
- end
13
-
14
6
  callbacks do |lifecycle|
15
- lifecycle.before(:invoke_job) do |job|
16
- payload = job.payload_object
17
- payload = payload.object if payload.is_a? Delayed::PerformableMethod
18
- payload.extend ReportErrors
7
+ lifecycle.around(:invoke_job) do |job, *args, &block|
8
+ begin
9
+ block.call(job, *args)
10
+ rescue Exception => e
11
+ ::Rollbar.report_exception(e, job)
12
+ end
19
13
  end
20
14
  end
21
15
  end
@@ -25,6 +25,7 @@ module Rollbar
25
25
  post_params = rollbar_filtered_params(sensitive_params, rollbar_post_params(rack_req))
26
26
  cookies = rollbar_filtered_params(sensitive_params, rollbar_request_cookies(rack_req))
27
27
  session = rollbar_filtered_params(sensitive_params, env['rack.session.options'])
28
+ route_params = rollbar_filtered_params(sensitive_params, rollbar_route_params(env))
28
29
 
29
30
  params = request_params.merge(get_params).merge(post_params)
30
31
 
@@ -35,7 +36,8 @@ module Rollbar
35
36
  :headers => rollbar_headers(env),
36
37
  :cookies => cookies,
37
38
  :session => session,
38
- :method => rollbar_request_method(env)
39
+ :method => rollbar_request_method(env),
40
+ :route => route_params
39
41
  }
40
42
  end
41
43
 
@@ -93,12 +95,16 @@ module Rollbar
93
95
  end
94
96
 
95
97
  def rollbar_request_params(env)
98
+ env['action_dispatch.request.parameters'] || {}
99
+ end
100
+
101
+ def rollbar_route_params(env)
96
102
  route = ::Rails.application.routes.recognize_path(env['PATH_INFO']) rescue {}
97
103
  {
98
104
  :controller => route[:controller],
99
105
  :action => route[:action],
100
- :format => route[:format],
101
- }.merge(env['action_dispatch.request.parameters'] || {})
106
+ :format => route[:format]
107
+ }
102
108
  end
103
109
 
104
110
  def rollbar_request_cookies(rack_req)
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "0.12.3"
2
+ VERSION = "0.12.5"
3
3
  end
@@ -49,6 +49,7 @@ describe HomeController do
49
49
  data.should have_key(:headers)
50
50
  data.should have_key(:session)
51
51
  data.should have_key(:method)
52
+ data.should have_key(:route)
52
53
  end
53
54
 
54
55
  it "should build empty person data when no one is logged-in" do
@@ -205,6 +206,31 @@ describe HomeController do
205
206
  controller.send(:rollbar_request_data)[:user_ip].should == '0.0.0.0'
206
207
  end
207
208
  end
209
+
210
+ context "rollbar_route_params" do
211
+ it "should save route params in request[:route]" do
212
+ route = controller.send(:rollbar_request_data)[:route]
213
+
214
+ route.should have_key(:controller)
215
+ route.should have_key(:action)
216
+ route.should have_key(:format)
217
+
218
+ route[:controller].should == 'home'
219
+ route[:action].should == 'index'
220
+ end
221
+
222
+ it "should save controller and action in the payload body" do
223
+ post 'report_exception'
224
+
225
+ route = controller.send(:rollbar_request_data)[:route]
226
+
227
+ route[:controller].should == 'home'
228
+ route[:action].should == 'report_exception'
229
+
230
+ Rollbar.last_report.should_not be_nil
231
+ Rollbar.last_report[:context].should == 'home#report_exception'
232
+ end
233
+ end
208
234
 
209
235
  end
210
236
 
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.12.3
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Rue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json