Sha256: 1ae10c78e2c54fc8055270a17afbc7bc698a274a18321598b556dcc174b671f8

Contents?: true

Size: 1.01 KB

Versions: 27

Compression:

Stored size: 1.01 KB

Contents

require 'rollbar/truncation/mixin'
require 'rollbar/util'

module Rollbar
  module Truncation
    class FramesStrategy
      include ::Rollbar::Truncation::Mixin

      def self.call(payload)
        new.call(payload)
      end

      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

      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

      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
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
rollbar-3.6.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.5.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.5.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.5.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.4.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.4.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.4.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.3.3 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.3.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.3.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.3.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.2.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.1.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.1.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.1.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.0.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-3.0.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.27.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.27.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.26.1 lib/rollbar/truncation/frames_strategy.rb