rollbar 2.20.0 → 2.20.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rollbar/item.rb +3 -6
- data/lib/rollbar/truncation.rb +5 -1
- data/lib/rollbar/truncation/min_body_strategy.rb +2 -3
- data/lib/rollbar/truncation/remove_extra_strategy.rb +35 -0
- data/lib/rollbar/truncation/remove_request_strategy.rb +21 -0
- data/lib/rollbar/truncation/strings_strategy.rb +3 -4
- data/lib/rollbar/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 026a0a98287641d8695b930dc08f7adbd1581db6e2b294ecbccc833b508e1274
|
4
|
+
data.tar.gz: 8c382057788fbe095a59581fcb7e67f0031ca3a134846ea9dfa96a8f0a7eac30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70090a6a9eb74ee019ef307efb9fd5b2f61e96f59385a36bf63f952f187ec34d5f63f5b1f2d888a815eb079962a7b1c66d227349a01a8e4509801e7ad5118f95
|
7
|
+
data.tar.gz: 78060e237ee0dad7d0e0e5a5ccb22ecd74e5b936cbaed148bc5e2f2142a61d1d6180bcbeb2dece8f28692c8a7dff2695256ee397097e06cc7e567c4cc63fa50a
|
data/lib/rollbar/item.rb
CHANGED
@@ -121,7 +121,7 @@ module Rollbar
|
|
121
121
|
host = stringified_payload['data'].fetch('server', {})['host']
|
122
122
|
|
123
123
|
notifier.send_failsafe(
|
124
|
-
too_large_payload_string(
|
124
|
+
too_large_payload_string(attempts),
|
125
125
|
nil,
|
126
126
|
uuid,
|
127
127
|
host
|
@@ -129,12 +129,9 @@ module Rollbar
|
|
129
129
|
logger.error("[Rollbar] Payload too large to be sent for UUID #{uuid}: #{Rollbar::JSON.dump(payload)}")
|
130
130
|
end
|
131
131
|
|
132
|
-
def too_large_payload_string(
|
133
|
-
original_size = Rollbar::JSON.dump(stringified_payload).bytesize
|
134
|
-
final_size = final_payload.bytesize
|
135
|
-
|
132
|
+
def too_large_payload_string(attempts)
|
136
133
|
'Could not send payload due to it being too large after truncating attempts. ' \
|
137
|
-
"Original size: #{
|
134
|
+
"Original size: #{attempts.first} Attempts: #{attempts.join(', ')} Final size: #{attempts.last}"
|
138
135
|
end
|
139
136
|
|
140
137
|
def ignored?
|
data/lib/rollbar/truncation.rb
CHANGED
@@ -4,6 +4,8 @@ require 'rollbar/truncation/raw_strategy'
|
|
4
4
|
require 'rollbar/truncation/frames_strategy'
|
5
5
|
require 'rollbar/truncation/strings_strategy'
|
6
6
|
require 'rollbar/truncation/min_body_strategy'
|
7
|
+
require 'rollbar/truncation/remove_request_strategy'
|
8
|
+
require 'rollbar/truncation/remove_extra_strategy'
|
7
9
|
|
8
10
|
module Rollbar
|
9
11
|
module Truncation
|
@@ -13,7 +15,9 @@ module Rollbar
|
|
13
15
|
STRATEGIES = [RawStrategy,
|
14
16
|
FramesStrategy,
|
15
17
|
StringsStrategy,
|
16
|
-
MinBodyStrategy
|
18
|
+
MinBodyStrategy,
|
19
|
+
RemoveRequestStrategy,
|
20
|
+
RemoveExtraStrategy].freeze
|
17
21
|
|
18
22
|
def self.truncate(payload, attempts = [])
|
19
23
|
result = nil
|
@@ -11,8 +11,7 @@ module Rollbar
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def call(payload)
|
14
|
-
|
15
|
-
body = new_payload['data']['body']
|
14
|
+
body = payload['data']['body']
|
16
15
|
|
17
16
|
if body['trace_chain']
|
18
17
|
body['trace_chain'] = body['trace_chain'].map do |trace_data|
|
@@ -22,7 +21,7 @@ module Rollbar
|
|
22
21
|
body['trace'] = truncate_trace_data(body['trace'])
|
23
22
|
end
|
24
23
|
|
25
|
-
dump(
|
24
|
+
dump(payload)
|
26
25
|
end
|
27
26
|
|
28
27
|
def truncate_trace_data(trace_data)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rollbar/util'
|
2
|
+
|
3
|
+
module Rollbar
|
4
|
+
module Truncation
|
5
|
+
class RemoveExtraStrategy
|
6
|
+
include ::Rollbar::Truncation::Mixin
|
7
|
+
|
8
|
+
def self.call(payload)
|
9
|
+
new.call(payload)
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(payload)
|
13
|
+
body = payload['data']['body']
|
14
|
+
|
15
|
+
delete_message_extra(body)
|
16
|
+
delete_trace_chain_extra(body)
|
17
|
+
delete_trace_extra(body)
|
18
|
+
|
19
|
+
dump(payload)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete_message_extra(body)
|
23
|
+
body['message'].delete('extra') if body['message'] && body['message']['extra']
|
24
|
+
end
|
25
|
+
|
26
|
+
def delete_trace_chain_extra(body)
|
27
|
+
body['trace_chain'][0].delete('extra') if body['trace_chain'] && body['trace_chain'][0]['extra']
|
28
|
+
end
|
29
|
+
|
30
|
+
def delete_trace_extra(body)
|
31
|
+
body['trace'].delete('extra') if body['trace'] && body['trace']['extra']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rollbar/util'
|
2
|
+
|
3
|
+
module Rollbar
|
4
|
+
module Truncation
|
5
|
+
class RemoveRequestStrategy
|
6
|
+
include ::Rollbar::Truncation::Mixin
|
7
|
+
|
8
|
+
def self.call(payload)
|
9
|
+
new.call(payload)
|
10
|
+
end
|
11
|
+
|
12
|
+
def call(payload)
|
13
|
+
data = payload['data']
|
14
|
+
|
15
|
+
data.delete('request') if data['request']
|
16
|
+
|
17
|
+
dump(payload)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -6,7 +6,7 @@ module Rollbar
|
|
6
6
|
class StringsStrategy
|
7
7
|
include ::Rollbar::Truncation::Mixin
|
8
8
|
|
9
|
-
STRING_THRESHOLDS = [1024, 512, 256
|
9
|
+
STRING_THRESHOLDS = [1024, 512, 256].freeze
|
10
10
|
|
11
11
|
def self.call(payload)
|
12
12
|
new.call(payload)
|
@@ -14,13 +14,12 @@ module Rollbar
|
|
14
14
|
|
15
15
|
def call(payload)
|
16
16
|
result = nil
|
17
|
-
new_payload = Rollbar::Util.deep_copy(payload)
|
18
17
|
|
19
18
|
STRING_THRESHOLDS.each do |threshold|
|
20
19
|
truncate_proc = truncate_strings_proc(threshold)
|
21
20
|
|
22
|
-
::Rollbar::Util.iterate_and_update(
|
23
|
-
result = dump(
|
21
|
+
::Rollbar::Util.iterate_and_update(payload, truncate_proc)
|
22
|
+
result = dump(payload)
|
24
23
|
|
25
24
|
break unless truncate?(result)
|
26
25
|
end
|
data/lib/rollbar/version.rb
CHANGED
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.20.
|
4
|
+
version: 2.20.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: 2019-05-
|
11
|
+
date: 2019-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -136,6 +136,8 @@ files:
|
|
136
136
|
- lib/rollbar/truncation/min_body_strategy.rb
|
137
137
|
- lib/rollbar/truncation/mixin.rb
|
138
138
|
- lib/rollbar/truncation/raw_strategy.rb
|
139
|
+
- lib/rollbar/truncation/remove_extra_strategy.rb
|
140
|
+
- lib/rollbar/truncation/remove_request_strategy.rb
|
139
141
|
- lib/rollbar/truncation/strings_strategy.rb
|
140
142
|
- lib/rollbar/util.rb
|
141
143
|
- lib/rollbar/util/hash.rb
|