Module: Rollbar::Truncation

Extended by:
Mixin
Defined in:
lib/rollbar/truncation.rb,
lib/rollbar/truncation/mixin.rb,
lib/rollbar/truncation/raw_strategy.rb,
lib/rollbar/truncation/frames_strategy.rb,
lib/rollbar/truncation/strings_strategy.rb,
lib/rollbar/truncation/min_body_strategy.rb,
lib/rollbar/truncation/remove_extra_strategy.rb,
lib/rollbar/truncation/remove_any_key_strategy.rb,
lib/rollbar/truncation/remove_request_strategy.rb

Defined Under Namespace

Modules: Mixin Classes: FramesStrategy, MinBodyStrategy, RawStrategy, RemoveAnyKeyStrategy, RemoveExtraStrategy, RemoveRequestStrategy, StringsStrategy

Constant Summary collapse

MAX_PAYLOAD_SIZE =

512kb

512 * 1024
STRATEGIES =
[RawStrategy,
FramesStrategy,
StringsStrategy,
MinBodyStrategy,
RemoveRequestStrategy,
RemoveExtraStrategy,
RemoveAnyKeyStrategy].freeze

Class Method Summary collapse

Methods included from Mixin

dump, select_frames, truncate?

Class Method Details

.truncate(payload, attempts = []) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rollbar/truncation.rb', line 24

def self.truncate(payload, attempts = [])
  result = nil

  STRATEGIES.each do |strategy|
    result = strategy.call(payload)
    attempts << result.bytesize
    break unless truncate?(result)
  end

  result
end