rollbar 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +21 -3
- data/THANKS.md +2 -0
- data/lib/rollbar.rb +7 -2
- data/lib/rollbar/sidekiq.rb +7 -9
- data/lib/rollbar/tasks/rollbar.cap +4 -4
- data/lib/rollbar/version.rb +1 -1
- data/spec/rollbar_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5014d11d0ce47ae5f2e50751236a81404148c787
|
4
|
+
data.tar.gz: 12aa1c0e3509ebdb622083e4d90ca20b731414d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83428ce3fb1b1a7287a81e1f22a862b5d3c2d429e4f133c7c7e005927724f184b4123e4446e0d2a7777e23ac7856d0b769e4e9d7ffb1cf05ee29c930b25eadbc
|
7
|
+
data.tar.gz: de80c650cde9ba6e3909d3b45a4b4fb6346a2b49cec49298449e2cb7201bfcf0d32b44c2dd73a3afdea35295abbead953b86015fcf03082f08fc71c6a4c8a86b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 1.4.3
|
4
|
+
|
5
|
+
New features:
|
6
|
+
|
7
|
+
- The current thread's scope can now be modified using `Rollbar.scope!`. This can be used to provide context data which will be included if the current request/job/etc. later throws an exception. See [#212](https://github.com/rollbar/rollbar-gem/pull/212)
|
8
|
+
|
9
|
+
Bug fixes:
|
10
|
+
|
11
|
+
- Remove duplicate `#configure` definition. See [#207](https://github.com/rollbar/rollbar-gem/pull/207)
|
12
|
+
- In the capistrano task, don't override set variables. See [#210](https://github.com/rollbar/rollbar-gem/pull/210)
|
13
|
+
- Style fix in sidekiq handler. See [#209](https://github.com/rollbar/rollbar-gem/pull/209)
|
14
|
+
|
3
15
|
## 1.4.2
|
4
16
|
|
5
17
|
Bug fixes:
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v1.4.
|
1
|
+
# Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v1.4.3)](https://travis-ci.org/rollbar/rollbar-gem/branches)
|
2
2
|
|
3
3
|
<!-- RemoveNext -->
|
4
4
|
Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https://rollbar.com).
|
@@ -9,7 +9,7 @@ Ruby gem for reporting exceptions, errors, and log messages to [Rollbar](https:/
|
|
9
9
|
|
10
10
|
Add this line to your application's Gemfile:
|
11
11
|
|
12
|
-
gem 'rollbar', '~> 1.4.
|
12
|
+
gem 'rollbar', '~> 1.4.3'
|
13
13
|
|
14
14
|
And then execute:
|
15
15
|
|
@@ -184,7 +184,7 @@ notifier = notifier.scope({
|
|
184
184
|
notifier.info('Jobs processed')
|
185
185
|
```
|
186
186
|
|
187
|
-
If you don't want to work with a new `Notifier` instance
|
187
|
+
If you don't want to work with a new `Notifier` instance `.scoped` will do it for you:
|
188
188
|
|
189
189
|
```ruby
|
190
190
|
while job
|
@@ -208,6 +208,24 @@ while job
|
|
208
208
|
end
|
209
209
|
```
|
210
210
|
|
211
|
+
To modify the current scope (rather than creating a new one), use `Rollbar.scope!`. You can use this to add additional context data from inside a web request, background job, etc.
|
212
|
+
|
213
|
+
```ruby
|
214
|
+
class NotificationJob
|
215
|
+
include Sidekiq::Worker
|
216
|
+
|
217
|
+
def perform(user_id)
|
218
|
+
Rollbar.scope!(:person => { :id => :user_id })
|
219
|
+
|
220
|
+
# If this next line causes an exception, the reported exception (which will
|
221
|
+
# be reported by Rollbar's standard Sidekiq instrumentation) will also
|
222
|
+
# include the above person information.
|
223
|
+
Notification.send_to_user(user_id)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
```
|
227
|
+
|
228
|
+
|
211
229
|
## Person tracking
|
212
230
|
|
213
231
|
Rollbar will send information about the current user (called a "person" in Rollbar parlance) along with each error report, when available. This works by calling the ```current_user``` controller method. The return value should be an object with an ```id``` method and, optionally, ```username``` and ```email``` methods.
|
data/THANKS.md
CHANGED
@@ -7,6 +7,7 @@ Huge thanks to the following contributors (by github username). For the most up-
|
|
7
7
|
- [antico5](https://github.com/antico5)
|
8
8
|
- [arr-ee](https://github.com/arr-ee)
|
9
9
|
- [awmichel](https://github.com/awmichel)
|
10
|
+
- [blaet](https://github.com/blaet)
|
10
11
|
- [bradx3](https://github.com/bradx3)
|
11
12
|
- [chrisb](https://github.com/chrisb)
|
12
13
|
- [derekrockwell](https://github.com/derekrockwell)
|
@@ -28,6 +29,7 @@ Huge thanks to the following contributors (by github username). For the most up-
|
|
28
29
|
- [JoshuaOSHickman](https://github.com/JoshuaOSHickman)
|
29
30
|
- [juggler](https://github.com/juggler)
|
30
31
|
- [kavu](https://github.com/kavu)
|
32
|
+
- [kdonovan](https://github.com/kdonovan)
|
31
33
|
- [kroky](https://github.com/kroky)
|
32
34
|
- [lanej](https://github.com/lanej)
|
33
35
|
- [lesliev-figured](https://github.com/lesliev-figured)
|
data/lib/rollbar.rb
CHANGED
@@ -71,8 +71,9 @@ module Rollbar
|
|
71
71
|
self.class.new(self, options)
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
75
|
-
|
74
|
+
def scope!(options = {})
|
75
|
+
Rollbar::Util.deep_merge(@configuration.payload_options, options)
|
76
|
+
self
|
76
77
|
end
|
77
78
|
|
78
79
|
# Turns off reporting for the given block.
|
@@ -757,6 +758,10 @@ module Rollbar
|
|
757
758
|
self.notifier = old_notifier
|
758
759
|
end
|
759
760
|
|
761
|
+
def scope!(options = {})
|
762
|
+
notifier.scope!(options)
|
763
|
+
end
|
764
|
+
|
760
765
|
# Backwards compatibility methods
|
761
766
|
|
762
767
|
def report_exception(exception, request_data = nil, person_data = nil, level = 'error')
|
data/lib/rollbar/sidekiq.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
PARAM_BLACKLIST = [
|
3
|
+
PARAM_BLACKLIST = %w[backtrace error_backtrace error_message error_class]
|
4
4
|
|
5
5
|
if Sidekiq::VERSION < '3'
|
6
6
|
module Rollbar
|
7
7
|
class Sidekiq
|
8
8
|
def call(worker, msg, queue)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
scope = { :request => { :params => params } }
|
9
|
+
yield
|
10
|
+
rescue Exception => e
|
11
|
+
params = msg.reject{ |k| PARAM_BLACKLIST.include?(k) }
|
12
|
+
scope = { :request => { :params => params } }
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
end
|
14
|
+
Rollbar.scope(scope).error(e, :use_exception_level_filters => true)
|
15
|
+
raise
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
@@ -34,9 +34,9 @@ end
|
|
34
34
|
|
35
35
|
namespace :load do
|
36
36
|
task :defaults do
|
37
|
-
set :rollbar_user, Proc.new { ENV['USER'] || ENV['USERNAME'] }
|
38
|
-
set :rollbar_env, Proc.new { fetch :rails_env, 'production' }
|
39
|
-
set :rollbar_token, Proc.new { abort "Please specify the Rollbar access token, set :rollbar_token, 'your token'" }
|
40
|
-
set :rollbar_role, Proc.new { :app }
|
37
|
+
set :rollbar_user, fetch(:rollbar_user, Proc.new { ENV['USER'] || ENV['USERNAME'] } )
|
38
|
+
set :rollbar_env, fetch(:rollbar_env, Proc.new { fetch :rails_env, 'production' } )
|
39
|
+
set :rollbar_token, fetch(:rollbar_token, Proc.new { abort "Please specify the Rollbar access token, set :rollbar_token, 'your token'" } )
|
40
|
+
set :rollbar_role, fetch(:rollbar_role, Proc.new { :app } )
|
41
41
|
end
|
42
42
|
end
|
data/lib/rollbar/version.rb
CHANGED
data/spec/rollbar_spec.rb
CHANGED
@@ -1581,6 +1581,21 @@ describe Rollbar do
|
|
1581
1581
|
end
|
1582
1582
|
end
|
1583
1583
|
|
1584
|
+
describe '.scope!' do
|
1585
|
+
let(:new_scope) do
|
1586
|
+
{ :person => { :id => 1 } }
|
1587
|
+
end
|
1588
|
+
|
1589
|
+
before { reconfigure_notifier }
|
1590
|
+
|
1591
|
+
it 'adds the new scope to the payload options' do
|
1592
|
+
configuration = Rollbar.notifier.configuration
|
1593
|
+
Rollbar.scope!(new_scope)
|
1594
|
+
|
1595
|
+
expect(configuration.payload_options).to be_eql(new_scope)
|
1596
|
+
end
|
1597
|
+
end
|
1598
|
+
|
1584
1599
|
describe '.reset_notifier' do
|
1585
1600
|
it 'resets the notifier' do
|
1586
1601
|
notifier1_id = Rollbar.notifier.object_id
|
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: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|