class Rollbar::Truncation::FramesStrategy

Public Class Methods

call(payload) click to toggle source
# File lib/rollbar/truncation/frames_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/frames_strategy.rb, line 13
def call(payload)
  new_payload = payload
  body = new_payload['data']['body']

  if body['trace_chain']
    truncate_trace_chain(body)
  elsif body['trace']
    truncate_trace(body)
  end

  dump(new_payload)
end
truncate_trace(body) click to toggle source
# File lib/rollbar/truncation/frames_strategy.rb, line 26
def truncate_trace(body)
  trace_data = body['trace']
  frames = trace_data['frames']
  trace_data['frames'] = select_frames(frames)

  body['trace']['frames'] = select_frames(body['trace']['frames'])
end
truncate_trace_chain(body) click to toggle source
# File lib/rollbar/truncation/frames_strategy.rb, line 34
def truncate_trace_chain(body)
  chain = body['trace_chain']

  body['trace_chain'] = chain.map do |trace_data|
    frames = trace_data['frames']
    trace_data['frames'] = select_frames(frames)
    trace_data
  end
end