rollbar 2.22.1 → 2.27.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +25 -0
- data/.rubocop.yml +136 -0
- data/.travis.yml +33 -30
- data/Gemfile +2 -0
- data/README.md +1 -1
- data/data/rollbar.snippet.js +1 -1
- data/docs/configuration.md +8 -0
- data/gemfiles/rails42.gemfile +4 -0
- data/gemfiles/rails50.gemfile +6 -2
- data/gemfiles/rails51.gemfile +6 -2
- data/gemfiles/rails60.gemfile +1 -1
- data/lib/rails/rollbar_runner.rb +3 -1
- data/lib/rollbar/capistrano.rb +1 -1
- data/lib/rollbar/capistrano_tasks.rb +10 -1
- data/lib/rollbar/configuration.rb +28 -6
- data/lib/rollbar/delay/girl_friday.rb +3 -7
- data/lib/rollbar/delay/resque.rb +2 -3
- data/lib/rollbar/delay/sidekiq.rb +2 -4
- data/lib/rollbar/delay/sucker_punch.rb +3 -4
- data/lib/rollbar/delay/thread.rb +14 -0
- data/lib/rollbar/deploy.rb +2 -0
- data/lib/rollbar/encoding/encoder.rb +10 -3
- data/lib/rollbar/item/backtrace.rb +12 -2
- data/lib/rollbar/item/frame.rb +2 -0
- data/lib/rollbar/item/locals.rb +45 -1
- data/lib/rollbar/item.rb +22 -14
- data/lib/rollbar/json.rb +1 -0
- data/lib/rollbar/middleware/js.rb +13 -3
- data/lib/rollbar/notifier.rb +154 -61
- data/lib/rollbar/plugins/active_job.rb +6 -2
- data/lib/rollbar/plugins/delayed_job/plugin.rb +11 -1
- data/lib/rollbar/plugins/error_context.rb +11 -0
- data/lib/rollbar/rake_tasks.rb +1 -1
- data/lib/rollbar/request_data_extractor.rb +7 -1
- data/lib/rollbar/rollbar_test.rb +6 -117
- data/lib/rollbar/scrubbers/url.rb +10 -5
- data/lib/rollbar/scrubbers.rb +1 -5
- data/lib/rollbar/truncation/frames_strategy.rb +1 -1
- data/lib/rollbar/truncation/mixin.rb +1 -1
- data/lib/rollbar/truncation/strings_strategy.rb +4 -2
- data/lib/rollbar/util.rb +4 -0
- data/lib/rollbar/version.rb +1 -1
- data/rollbar.gemspec +1 -0
- data/spec/support/rollbar_api.rb +67 -0
- metadata +6 -4
@@ -6,7 +6,7 @@ module Rollbar
|
|
6
6
|
class StringsStrategy
|
7
7
|
include ::Rollbar::Truncation::Mixin
|
8
8
|
|
9
|
-
STRING_THRESHOLDS = [1024, 512, 256].freeze
|
9
|
+
STRING_THRESHOLDS = [1024, 512, 256, 128].freeze
|
10
10
|
|
11
11
|
def self.call(payload)
|
12
12
|
new.call(payload)
|
@@ -29,7 +29,9 @@ module Rollbar
|
|
29
29
|
|
30
30
|
def truncate_strings_proc(threshold)
|
31
31
|
proc do |value|
|
32
|
-
|
32
|
+
# Rollbar::Util.truncate will operate on characters, not bytes,
|
33
|
+
# so use value.length, not bytesize.
|
34
|
+
if value.is_a?(String) && value.length > threshold
|
33
35
|
Rollbar::Util.truncate(value, threshold)
|
34
36
|
else
|
35
37
|
value
|
data/lib/rollbar/util.rb
CHANGED
@@ -2,6 +2,10 @@ require 'rollbar/util/hash'
|
|
2
2
|
|
3
3
|
module Rollbar
|
4
4
|
module Util # :nodoc:
|
5
|
+
def self.iterate_and_update_with_block(obj, &block)
|
6
|
+
iterate_and_update(obj, block)
|
7
|
+
end
|
8
|
+
|
5
9
|
def self.iterate_and_update(obj, block, seen = {})
|
6
10
|
return if obj.frozen? || seen[obj.object_id]
|
7
11
|
|
data/lib/rollbar/version.rb
CHANGED
data/rollbar.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.homepage = 'https://rollbar.com'
|
14
14
|
gem.license = 'MIT'
|
15
15
|
gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
gem.files += ['spec/support/rollbar_api.rb'] # useful helper for app spec/tests.
|
16
17
|
gem.name = 'rollbar'
|
17
18
|
gem.require_paths = ['lib']
|
18
19
|
gem.required_ruby_version = '>= 1.9.3'
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rack/request'
|
2
|
+
|
3
|
+
class RollbarAPI
|
4
|
+
UNAUTHORIZED_ACCESS_TOKEN = 'unauthorized'.freeze
|
5
|
+
|
6
|
+
def call(env)
|
7
|
+
request = Rack::Request.new(env)
|
8
|
+
json = JSON.parse(request.body.read)
|
9
|
+
|
10
|
+
return unauthorized unless authorized?(json, request)
|
11
|
+
|
12
|
+
return bad_request(json) unless valid_data?(json, request)
|
13
|
+
|
14
|
+
success(json, request)
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def authorized?(_json, request)
|
20
|
+
request.env['HTTP_X_ROLLBAR_ACCESS_TOKEN'] != UNAUTHORIZED_ACCESS_TOKEN
|
21
|
+
end
|
22
|
+
|
23
|
+
def response_headers
|
24
|
+
{
|
25
|
+
'Content-Type' => 'application/json'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def valid_data?(_json, request)
|
30
|
+
!!request.env['HTTP_X_ROLLBAR_ACCESS_TOKEN']
|
31
|
+
end
|
32
|
+
|
33
|
+
def unauthorized
|
34
|
+
[401, response_headers, [unauthorized_body]]
|
35
|
+
end
|
36
|
+
|
37
|
+
def bad_request(_json)
|
38
|
+
[400, response_headers, [bad_request_body]]
|
39
|
+
end
|
40
|
+
|
41
|
+
def success(json, request)
|
42
|
+
[200, response_headers, [success_body(json, request)]]
|
43
|
+
end
|
44
|
+
|
45
|
+
def unauthorized_body
|
46
|
+
result(1, nil, 'invalid access token')
|
47
|
+
end
|
48
|
+
|
49
|
+
def bad_request_body
|
50
|
+
result(1, nil, 'bad request')
|
51
|
+
end
|
52
|
+
|
53
|
+
def success_body(json, _request)
|
54
|
+
result(0, {
|
55
|
+
:id => rand(1_000_000),
|
56
|
+
:uuid => json['data']['uuid']
|
57
|
+
}, nil)
|
58
|
+
end
|
59
|
+
|
60
|
+
def result(err, body, message)
|
61
|
+
{
|
62
|
+
:err => err,
|
63
|
+
:result => body,
|
64
|
+
:message => message
|
65
|
+
}.to_json
|
66
|
+
end
|
67
|
+
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: 2.
|
4
|
+
version: 2.27.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:
|
11
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easy and powerful exception tracking for Ruby
|
14
14
|
email:
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- ".codeclimate.yml"
|
22
|
+
- ".github/pull_request_template.md"
|
22
23
|
- ".gitignore"
|
23
24
|
- ".gitmodules"
|
24
25
|
- ".rubocop.yml"
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- lib/rollbar/plugins/delayed_job.rb
|
96
97
|
- lib/rollbar/plugins/delayed_job/job_data.rb
|
97
98
|
- lib/rollbar/plugins/delayed_job/plugin.rb
|
99
|
+
- lib/rollbar/plugins/error_context.rb
|
98
100
|
- lib/rollbar/plugins/goalie.rb
|
99
101
|
- lib/rollbar/plugins/rack.rb
|
100
102
|
- lib/rollbar/plugins/rails.rb
|
@@ -133,6 +135,7 @@ files:
|
|
133
135
|
- lib/tasks/benchmark.rake
|
134
136
|
- lib/tasks/tasks.rake
|
135
137
|
- rollbar.gemspec
|
138
|
+
- spec/support/rollbar_api.rb
|
136
139
|
homepage: https://rollbar.com
|
137
140
|
licenses:
|
138
141
|
- MIT
|
@@ -157,8 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
160
|
- !ruby/object:Gem::Version
|
158
161
|
version: '0'
|
159
162
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.7.7
|
163
|
+
rubygems_version: 3.1.2
|
162
164
|
signing_key:
|
163
165
|
specification_version: 4
|
164
166
|
summary: Reports exceptions to Rollbar
|