Class: Rollbar::Truncation::MinBodyStrategy
- Inherits:
-
Object
- Object
- Rollbar::Truncation::MinBodyStrategy
show all
- Includes:
- Mixin
- Defined in:
- lib/rollbar/truncation/min_body_strategy.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Mixin
#dump, #select_frames, #truncate?
Class Method Details
.call(payload) ⇒ Object
9
10
11
|
# File 'lib/rollbar/truncation/min_body_strategy.rb', line 9
def self.call(payload)
new.call(payload)
end
|
Instance Method Details
#call(payload) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/rollbar/truncation/min_body_strategy.rb', line 13
def call(payload)
new_payload = Rollbar::Util.deep_copy(payload)
body = new_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(new_payload)
end
|
#truncate_trace_data(trace_data) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/rollbar/truncation/min_body_strategy.rb', line 28
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
|