rollbar 0.12.19 → 0.12.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rollbar/configuration.rb +5 -8
- data/lib/rollbar/delay/sidekiq.rb +1 -1
- data/lib/rollbar/version.rb +1 -1
- data/spec/rollbar_spec.rb +59 -30
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a174b1d884a3719e380c721e3f31176157b55895
|
4
|
+
data.tar.gz: 8a848c8705970c1ff53a45f763a89068b3f6f6c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f00108d55e33e68bc513f6f7493b7707a3b87e8d4bbdeeb2190172829e091f410acd5bac8533232b6297311a98639e5c60ed58bc7076cafb23738fef74104f7
|
7
|
+
data.tar.gz: 59414c7223324364962285a981007b5a0934ea3aef2c3d68b435a7aacfc56d8d416ec05a55bbd096f031b80e0ffdd14c7564f60f653de4e85ab7f9e5552dc6c1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
**0.12.20**
|
4
|
+
- Fix asynchronous reports with sidekiq version < 2.3.2
|
5
|
+
- Support for specifying multiple project_gems with regex [#114](https://github.com/rollbar/rollbar-gem/pull/114)
|
6
|
+
|
3
7
|
**0.12.19**
|
4
8
|
- Fix rake test task in production
|
5
9
|
- Report an additional simple error message in the rake test task
|
@@ -104,14 +104,11 @@ module Rollbar
|
|
104
104
|
@project_gem_paths = []
|
105
105
|
|
106
106
|
gems.each { |name|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
rescue Gem::LoadError
|
113
|
-
puts "[Rollbar] #{name} gem not found"
|
114
|
-
end
|
107
|
+
Gem::Specification.find_all_by_name(name).tap{ |results|
|
108
|
+
puts "[Rollbar] No gems found matching #{name.inspect}" if results.empty?
|
109
|
+
}.each{ |gem|
|
110
|
+
@project_gem_paths.push gem.gem_dir
|
111
|
+
}
|
115
112
|
}
|
116
113
|
end
|
117
114
|
|
@@ -3,7 +3,7 @@ require 'sidekiq'
|
|
3
3
|
module Rollbar
|
4
4
|
module Delay
|
5
5
|
class Sidekiq
|
6
|
-
OPTIONS = { 'queue' => 'rollbar', 'class' =>
|
6
|
+
OPTIONS = { 'queue' => 'rollbar', 'class' => Rollbar::Delay::Sidekiq }.freeze
|
7
7
|
|
8
8
|
def initialize(*args)
|
9
9
|
@options = (opts = args.shift) ? OPTIONS.merge(opts) : OPTIONS
|
data/lib/rollbar/version.rb
CHANGED
data/spec/rollbar_spec.rb
CHANGED
@@ -145,14 +145,14 @@ describe Rollbar do
|
|
145
145
|
}
|
146
146
|
Rollbar.report_exception(@exception, {}, person_data)
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
it 'should not ignore non-ignored persons' do
|
150
150
|
Rollbar.configure do |config|
|
151
151
|
config.ignored_person_ids += [1]
|
152
152
|
end
|
153
|
-
|
153
|
+
|
154
154
|
Rollbar.last_report = nil
|
155
|
-
|
155
|
+
|
156
156
|
person_data = {
|
157
157
|
:id => 1,
|
158
158
|
:username => "test",
|
@@ -160,7 +160,7 @@ describe Rollbar do
|
|
160
160
|
}
|
161
161
|
Rollbar.report_exception(@exception, {}, person_data)
|
162
162
|
Rollbar.last_report.should be_nil
|
163
|
-
|
163
|
+
|
164
164
|
person_data = {
|
165
165
|
:id => 2,
|
166
166
|
:username => "test2",
|
@@ -248,13 +248,13 @@ describe Rollbar do
|
|
248
248
|
Rollbar.stub(:schedule_payload) do |*args|
|
249
249
|
payload = MultiJson.load(args[0])
|
250
250
|
end
|
251
|
-
|
251
|
+
|
252
252
|
Rollbar.report_exception(@exception)
|
253
|
-
|
253
|
+
|
254
254
|
payload["data"]["level"].should == 'error'
|
255
|
-
|
255
|
+
|
256
256
|
Rollbar.report_exception(@exception, nil, nil, 'debug')
|
257
|
-
|
257
|
+
|
258
258
|
payload["data"]["level"].should == 'debug'
|
259
259
|
end
|
260
260
|
end
|
@@ -324,7 +324,7 @@ describe Rollbar do
|
|
324
324
|
end
|
325
325
|
end
|
326
326
|
end
|
327
|
-
|
327
|
+
|
328
328
|
context 'report_message_with_request' do
|
329
329
|
before(:each) do
|
330
330
|
configure
|
@@ -340,32 +340,32 @@ describe Rollbar do
|
|
340
340
|
logger_mock.should_receive(:info).with('[Rollbar] Scheduling payload')
|
341
341
|
logger_mock.should_receive(:info).with('[Rollbar] Success')
|
342
342
|
Rollbar.report_message_with_request("Test message")
|
343
|
-
|
343
|
+
|
344
344
|
Rollbar.last_report[:request].should be_nil
|
345
345
|
Rollbar.last_report[:person].should be_nil
|
346
346
|
end
|
347
|
-
|
347
|
+
|
348
348
|
it 'should report messages with request, person data and extra data' do
|
349
349
|
Rollbar.last_report = nil
|
350
|
-
|
350
|
+
|
351
351
|
logger_mock.should_receive(:info).with('[Rollbar] Scheduling payload')
|
352
352
|
logger_mock.should_receive(:info).with('[Rollbar] Success')
|
353
|
-
|
353
|
+
|
354
354
|
request_data = {
|
355
355
|
:params => {:foo => 'bar'}
|
356
356
|
}
|
357
|
-
|
357
|
+
|
358
358
|
person_data = {
|
359
359
|
:id => 123,
|
360
360
|
:username => 'username'
|
361
361
|
}
|
362
|
-
|
362
|
+
|
363
363
|
extra_data = {
|
364
364
|
:extra_foo => 'extra_bar'
|
365
365
|
}
|
366
|
-
|
366
|
+
|
367
367
|
Rollbar.report_message_with_request("Test message", 'info', request_data, person_data, extra_data)
|
368
|
-
|
368
|
+
|
369
369
|
Rollbar.last_report[:request].should == request_data
|
370
370
|
Rollbar.last_report[:person].should == person_data
|
371
371
|
Rollbar.last_report[:body][:message][:extra_foo].should == 'extra_bar'
|
@@ -658,35 +658,35 @@ describe Rollbar do
|
|
658
658
|
config.logger = logger_mock
|
659
659
|
end
|
660
660
|
end
|
661
|
-
|
661
|
+
|
662
662
|
let(:logger_mock) { double("Rails.logger").as_null_object }
|
663
|
-
|
663
|
+
|
664
664
|
it 'should build valid json' do
|
665
665
|
json = Rollbar.send(:build_payload, {:foo => {:bar => "baz"}})
|
666
666
|
hash = MultiJson.load(json)
|
667
667
|
hash["data"]["foo"]["bar"].should == "baz"
|
668
668
|
end
|
669
|
-
|
669
|
+
|
670
670
|
it 'should truncate large strings if the payload is too big' do
|
671
671
|
json = Rollbar.send(:build_payload, {:foo => {:bar => "baz"}, :large => 'a' * (128 * 1024), :small => 'b' * 1024})
|
672
672
|
hash = MultiJson.load(json)
|
673
673
|
hash["data"]["large"].should == '%s...' % ('a' * 1021)
|
674
674
|
hash["data"]["small"].should == 'b' * 1024
|
675
675
|
end
|
676
|
-
|
676
|
+
|
677
677
|
it 'should send a failsafe message if the payload cannot be reduced enough' do
|
678
678
|
logger_mock.should_receive(:error).with(/Sending failsafe response due to Could not send payload due to it being too large after truncating attempts/)
|
679
679
|
logger_mock.should_receive(:info).with('[Rollbar] Success')
|
680
|
-
|
680
|
+
|
681
681
|
orig_max = Rollbar::MAX_PAYLOAD_SIZE
|
682
|
-
|
682
|
+
|
683
683
|
Rollbar::MAX_PAYLOAD_SIZE = 1
|
684
684
|
Rollbar.report_exception(@exception)
|
685
|
-
|
685
|
+
|
686
686
|
Rollbar::MAX_PAYLOAD_SIZE = orig_max
|
687
687
|
end
|
688
688
|
end
|
689
|
-
|
689
|
+
|
690
690
|
context 'truncate_payload' do
|
691
691
|
it 'should truncate all nested strings in the payload' do
|
692
692
|
payload = {
|
@@ -698,26 +698,26 @@ describe Rollbar do
|
|
698
698
|
:array => ['12345678', '12', {:inner_inner => '123456789'}]
|
699
699
|
}
|
700
700
|
}
|
701
|
-
|
701
|
+
|
702
702
|
payload_copy = payload.clone
|
703
703
|
Rollbar.send(:truncate_payload, payload_copy, 6)
|
704
|
-
|
704
|
+
|
705
705
|
payload_copy[:truncated].should == '123...'
|
706
706
|
payload_copy[:not_truncated].should == '123456'
|
707
707
|
payload_copy[:hash][:inner_truncated].should == '123...'
|
708
708
|
payload_copy[:hash][:inner_not_truncated].should == '567'
|
709
709
|
payload_copy[:hash][:array].should == ['123...', '12', {:inner_inner => '123...'}]
|
710
710
|
end
|
711
|
-
|
711
|
+
|
712
712
|
it 'should truncate utf8 strings properly' do
|
713
713
|
payload = {
|
714
714
|
:truncated => 'Ŝǻмρļẻ śţяịņģ',
|
715
715
|
:not_truncated => '123456',
|
716
716
|
}
|
717
|
-
|
717
|
+
|
718
718
|
payload_copy = payload.clone
|
719
719
|
Rollbar.send(:truncate_payload, payload_copy, 6)
|
720
|
-
|
720
|
+
|
721
721
|
payload_copy[:truncated].should == "Ŝǻм..."
|
722
722
|
payload_copy[:not_truncated].should == '123456'
|
723
723
|
end
|
@@ -813,6 +813,35 @@ describe Rollbar do
|
|
813
813
|
path.should == gem_paths[index]
|
814
814
|
}
|
815
815
|
end
|
816
|
+
|
817
|
+
it "should handle regex gem patterns" do
|
818
|
+
gems = ["rack", /rspec/]
|
819
|
+
gem_paths = []
|
820
|
+
|
821
|
+
Rollbar.configure do |config|
|
822
|
+
config.project_gems = gems
|
823
|
+
end
|
824
|
+
|
825
|
+
gem_paths = gems.map{|gem| Gem::Specification.find_all_by_name(gem).map(&:gem_dir) }.flatten.compact.uniq
|
826
|
+
gem_paths.length.should > 1
|
827
|
+
|
828
|
+
data = Rollbar.send(:message_data, 'test', 'info', {})
|
829
|
+
data[:project_package_paths].kind_of?(Array).should == true
|
830
|
+
data[:project_package_paths].length.should == gem_paths.length
|
831
|
+
(data[:project_package_paths] - gem_paths).length.should == 0
|
832
|
+
end
|
833
|
+
|
834
|
+
it "should not break on non-existent gems" do
|
835
|
+
gems = ["this_gem_does_not_exist", "rack"]
|
836
|
+
|
837
|
+
Rollbar.configure do |config|
|
838
|
+
config.project_gems = gems
|
839
|
+
end
|
840
|
+
|
841
|
+
data = Rollbar.send(:message_data, 'test', 'info', {})
|
842
|
+
data[:project_package_paths].kind_of?(Array).should == true
|
843
|
+
data[:project_package_paths].length.should == 1
|
844
|
+
end
|
816
845
|
end
|
817
846
|
|
818
847
|
context "report_internal_error" do
|