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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e879b78b311e11b9d124caf5d30c8dc9e0d831409a80459430fd557320926cbf
4
- data.tar.gz: 5baf629685d3393055192355cf4974321004ed0a3e57b13f045eafe6631e4804
3
+ metadata.gz: 026a0a98287641d8695b930dc08f7adbd1581db6e2b294ecbccc833b508e1274
4
+ data.tar.gz: 8c382057788fbe095a59581fcb7e67f0031ca3a134846ea9dfa96a8f0a7eac30
5
5
  SHA512:
6
- metadata.gz: 69e943c6de574b2589a3230fdf69159e0378066fb2ec9757e9716f4c839273ec97450d11058dfdd250b7e244e9d70f28bfb0799916b9765e797e5f5ecccbd022
7
- data.tar.gz: 5213c8cd89294bd2ab4ac1e2ac9dacb43165449bed85d4dc7b8eae9d6f1b4beb1ac95e7526f5d2e11eb7633e2969c62330f577150732207e11004464384c8a2a
6
+ metadata.gz: 70090a6a9eb74ee019ef307efb9fd5b2f61e96f59385a36bf63f952f187ec34d5f63f5b1f2d888a815eb079962a7b1c66d227349a01a8e4509801e7ad5118f95
7
+ data.tar.gz: 78060e237ee0dad7d0e0e5a5ccb22ecd74e5b936cbaed148bc5e2f2142a61d1d6180bcbeb2dece8f28692c8a7dff2695256ee397097e06cc7e567c4cc63fa50a
@@ -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(stringified_payload, final_payload, attempts),
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(stringified_payload, final_payload, attempts)
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: #{original_size} Attempts: #{attempts.join(', ')} Final size: #{final_size}"
134
+ "Original size: #{attempts.first} Attempts: #{attempts.join(', ')} Final size: #{attempts.last}"
138
135
  end
139
136
 
140
137
  def ignored?
@@ -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].freeze
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
- new_payload = Rollbar::Util.deep_copy(payload)
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(new_payload)
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, 128, 64].freeze
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(new_payload, truncate_proc)
23
- result = dump(new_payload)
21
+ ::Rollbar::Util.iterate_and_update(payload, truncate_proc)
22
+ result = dump(payload)
24
23
 
25
24
  break unless truncate?(result)
26
25
  end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '2.20.0'.freeze
2
+ VERSION = '2.20.1'.freeze
3
3
  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.20.0
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-25 00:00:00.000000000 Z
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