Sha256: 47b7202f62f1a49aaa202a1b195d2978253667b8ae9ad28d751a9bd1d61c7bc5

Contents?: true

Size: 1.03 KB

Versions: 31

Compression:

Stored size: 1.03 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 = Rollbar::Util.deep_copy(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

31 entries across 31 versions & 1 rubygems

Version Path
rollbar-2.22.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.22.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.21.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.20.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.20.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.20.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.19.4 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.19.3 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.19.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.19.1 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.19.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.18.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.18.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.17.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.16.4 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.16.3 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.16.2 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.16.0 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.15.6 lib/rollbar/truncation/frames_strategy.rb
rollbar-2.15.5 lib/rollbar/truncation/frames_strategy.rb