class Rollbar::Truncation::MinBodyStrategy

Public Class Methods

call(payload) click to toggle source
# File lib/rollbar/truncation/min_body_strategy.rb, line 9
def self.call(payload)
  new.call(payload)
end

Public Instance Methods

call(payload) click to toggle source
# File lib/rollbar/truncation/min_body_strategy.rb, line 13
def call(payload)
  body = payload['data']['body']

  if body['trace_chain']
    body['trace_chain'] = body['trace_chain'].map do |trace_data|
      truncate_trace_data(trace_data)
    end
  elsif body['trace']
    body['trace'] = truncate_trace_data(body['trace'])
  end

  dump(payload)
end
truncate_trace_data(trace_data) click to toggle source
# File lib/rollbar/truncation/min_body_strategy.rb, line 27
def truncate_trace_data(trace_data)
  trace_data['exception'].delete('description')
  trace_data['exception']['message'] = trace_data['exception']['message'][0, 255]
  trace_data['frames'] = select_frames(trace_data['frames'], 1)

  trace_data
end