rollbar 1.2.0 → 1.2.1
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.rb +3 -22
- data/lib/rollbar/middleware/rails/rollbar.rb +1 -3
- data/lib/rollbar/version.rb +1 -1
- data/spec/rollbar_spec.rb +0 -69
- 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: 3cfe303ae73dcfd7cfaff61a78a3d189205b7bcc
|
4
|
+
data.tar.gz: 327509998ddc5c03907fd30190ac7f087de12187
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95207004e19203386da2851e762a0301694e7e7d6385608cd2acdcc04076fb9c6ee0ba4be4ac8d37fcd1697936f5797d2559c92ba0a87b546db6c0cb4b4d7e0e
|
7
|
+
data.tar.gz: 70541207c0df4a50eac2ee39622ffb806f7561684ce1bdfcd9c8731fb0197411674adf058e2cb2deac4f02991336228f41162a963e9a7d29e0de0acb88682ea0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
**1.2.1**
|
4
|
+
- Revert change made as part of 1.2.0 where all procs in the payload would be evaluated. See [#143](https://github.com/rollbar/rollbar-gem/pull/143).
|
5
|
+
|
3
6
|
**1.2.0**
|
4
7
|
- Added new, much nicer interface for sending exceptions and messages to Rollbar. This is a backwards-compatible release: the old interface (`report_message`, `report_exception`, `report_message_with_request`) is deprecated but will continue to work at least until 2.0.
|
5
8
|
|
data/lib/rollbar.rb
CHANGED
@@ -207,11 +207,13 @@ module Rollbar
|
|
207
207
|
|
208
208
|
payload = build_payload(level, message, exception, extra)
|
209
209
|
data = payload['data']
|
210
|
-
evaluate_payload(data)
|
211
210
|
|
212
211
|
if data[:person]
|
213
212
|
person_id = data[:person][configuration.person_id_method.to_sym]
|
214
213
|
return 'ignored' if configuration.ignored_person_ids.include?(person_id)
|
214
|
+
|
215
|
+
is_proc = data[:person].respond_to?(:call)
|
216
|
+
data[:person] = data[:person].call if is_proc
|
215
217
|
end
|
216
218
|
|
217
219
|
schedule_payload(payload)
|
@@ -364,27 +366,6 @@ module Rollbar
|
|
364
366
|
data
|
365
367
|
end
|
366
368
|
|
367
|
-
# Walks the entire payload and replaces callable values with
|
368
|
-
# their results
|
369
|
-
def evaluate_payload(payload)
|
370
|
-
evaluator = proc do |key, value|
|
371
|
-
result = value
|
372
|
-
|
373
|
-
if value.respond_to? :call
|
374
|
-
begin
|
375
|
-
result = value.call
|
376
|
-
rescue
|
377
|
-
log_error "[Rollbar] Error while evaluating callable in payload for key #{key}"
|
378
|
-
result = nil
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
|
-
result
|
383
|
-
end
|
384
|
-
|
385
|
-
Rollbar::Util.iterate_and_update_hash(payload, evaluator)
|
386
|
-
end
|
387
|
-
|
388
369
|
def enforce_valid_utf8(payload)
|
389
370
|
normalizer = lambda do |object|
|
390
371
|
is_symbol = object.is_a?(Symbol)
|
@@ -44,9 +44,7 @@ module Rollbar
|
|
44
44
|
block = proc { extract_person_data_from_controller(env) }
|
45
45
|
return block unless defined?(ActiveRecord::Base)
|
46
46
|
|
47
|
-
proc
|
48
|
-
ActiveRecord::Base.connection_pool.with_connection(&block)
|
49
|
-
end
|
47
|
+
proc { ActiveRecord::Base.connection_pool.with_connection(&block) }
|
50
48
|
end
|
51
49
|
|
52
50
|
def context(request_data)
|
data/lib/rollbar/version.rb
CHANGED
data/spec/rollbar_spec.rb
CHANGED
@@ -250,16 +250,6 @@ describe Rollbar do
|
|
250
250
|
result = notifier.send(:report, 'info', 'message', nil, nil)
|
251
251
|
result.should == 'ignored'
|
252
252
|
end
|
253
|
-
|
254
|
-
it 'should evaluate callables in the payload' do
|
255
|
-
notifier.should receive(:schedule_payload) do |payload|
|
256
|
-
data = payload['data']
|
257
|
-
data[:body][:message][:extra][:callable].should == 2
|
258
|
-
end
|
259
|
-
|
260
|
-
callable = proc { 1 + 1 }
|
261
|
-
notifier.send(:report, 'warning', 'message', nil, { :callable => callable })
|
262
|
-
end
|
263
253
|
end
|
264
254
|
|
265
255
|
context 'build_payload' do
|
@@ -616,65 +606,6 @@ describe Rollbar do
|
|
616
606
|
end
|
617
607
|
end
|
618
608
|
|
619
|
-
context 'evaluate_payload' do
|
620
|
-
let(:notifier) do
|
621
|
-
notifier = Rollbar.notifier
|
622
|
-
|
623
|
-
notifier.configure do |config|
|
624
|
-
config.logger = logger_mock
|
625
|
-
end
|
626
|
-
|
627
|
-
notifier
|
628
|
-
end
|
629
|
-
|
630
|
-
let(:logger_mock) { double("Rails.logger").as_null_object }
|
631
|
-
|
632
|
-
before(:each) do
|
633
|
-
configure
|
634
|
-
notifier.configure do |config|
|
635
|
-
config.logger = logger_mock
|
636
|
-
end
|
637
|
-
end
|
638
|
-
|
639
|
-
it 'should evaluate callables and store the result' do
|
640
|
-
a = 'some string'
|
641
|
-
|
642
|
-
payload = {
|
643
|
-
:evaluate1 => lambda { 1 + 1 },
|
644
|
-
:evaluate2 => Proc.new { 2 + 2 },
|
645
|
-
:hash => {
|
646
|
-
:inner_evaluate1 => a.method(:to_s),
|
647
|
-
:inner_evaluate2 => lambda { {:key => 'value'} }
|
648
|
-
}
|
649
|
-
}
|
650
|
-
|
651
|
-
payload_copy = payload.clone
|
652
|
-
notifier.send(:evaluate_payload, payload_copy)
|
653
|
-
|
654
|
-
payload_copy[:evaluate1].should == 2
|
655
|
-
payload_copy[:evaluate2].should == 4
|
656
|
-
payload_copy[:hash][:inner_evaluate1].should == 'some string'
|
657
|
-
payload_copy[:hash][:inner_evaluate2][:key].should == 'value'
|
658
|
-
end
|
659
|
-
|
660
|
-
it 'should not crash when the callable raises an exception' do
|
661
|
-
logger_mock.should_receive(:error).with("[Rollbar] Error while evaluating callable in payload for key evaluate1")
|
662
|
-
|
663
|
-
payload = {
|
664
|
-
:evaluate1 => lambda { a = b },
|
665
|
-
:evaluate2 => Proc.new { 2 + 2 },
|
666
|
-
:key => 'value'
|
667
|
-
}
|
668
|
-
|
669
|
-
payload_copy = payload.clone
|
670
|
-
notifier.send(:evaluate_payload, payload_copy)
|
671
|
-
|
672
|
-
payload_copy[:evaluate1].should be_nil
|
673
|
-
payload_copy[:evaluate2].should == 4
|
674
|
-
payload_copy[:key].should == 'value'
|
675
|
-
end
|
676
|
-
end
|
677
|
-
|
678
609
|
context 'enforce_valid_utf8' do
|
679
610
|
it 'should replace invalid utf8 values' do
|
680
611
|
payload = {
|
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.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|