Class: RailsTracepointStack::Limits
- Inherits:
-
Object
- Object
- RailsTracepointStack::Limits
- Defined in:
- lib/rails_tracepoint_stack/limits.rb
Overview
How much a capture is allowed to keep. The defaults aim at an output a person or an agent can read in one go rather than at completeness: a single Rails request can easily produce tens of thousands of traces.
Constant Summary collapse
- DEFAULT_MAX_TRACES =
5_000- DEFAULT_MAX_STRING_LENGTH =
200- DEFAULT_MAX_COLLECTION_SIZE =
20
Instance Attribute Summary collapse
-
#capture_params ⇒ Object
readonly
Returns the value of attribute capture_params.
-
#capture_return ⇒ Object
readonly
Returns the value of attribute capture_return.
-
#max_collection_size ⇒ Object
readonly
Returns the value of attribute max_collection_size.
-
#max_depth ⇒ Object
readonly
Returns the value of attribute max_depth.
-
#max_string_length ⇒ Object
readonly
Returns the value of attribute max_string_length.
-
#max_traces ⇒ Object
readonly
Returns the value of attribute max_traces.
Instance Method Summary collapse
-
#initialize(max_depth: nil, max_traces: DEFAULT_MAX_TRACES, max_string_length: DEFAULT_MAX_STRING_LENGTH, max_collection_size: DEFAULT_MAX_COLLECTION_SIZE, capture_params: true, capture_return: true) ⇒ Limits
constructor
A new instance of Limits.
- #room_for?(count) ⇒ Boolean
- #too_deep?(depth) ⇒ Boolean
Constructor Details
#initialize(max_depth: nil, max_traces: DEFAULT_MAX_TRACES, max_string_length: DEFAULT_MAX_STRING_LENGTH, max_collection_size: DEFAULT_MAX_COLLECTION_SIZE, capture_params: true, capture_return: true) ⇒ Limits
Returns a new instance of Limits.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 17 def initialize( max_depth: nil, max_traces: DEFAULT_MAX_TRACES, max_string_length: DEFAULT_MAX_STRING_LENGTH, max_collection_size: DEFAULT_MAX_COLLECTION_SIZE, capture_params: true, capture_return: true ) @max_depth = max_depth @max_traces = max_traces @max_string_length = max_string_length @max_collection_size = max_collection_size @capture_params = capture_params @capture_return = capture_return end |
Instance Attribute Details
#capture_params ⇒ Object (readonly)
Returns the value of attribute capture_params.
10 11 12 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 10 def capture_params @capture_params end |
#capture_return ⇒ Object (readonly)
Returns the value of attribute capture_return.
10 11 12 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 10 def capture_return @capture_return end |
#max_collection_size ⇒ Object (readonly)
Returns the value of attribute max_collection_size.
10 11 12 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 10 def max_collection_size @max_collection_size end |
#max_depth ⇒ Object (readonly)
Returns the value of attribute max_depth.
10 11 12 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 10 def max_depth @max_depth end |
#max_string_length ⇒ Object (readonly)
Returns the value of attribute max_string_length.
10 11 12 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 10 def max_string_length @max_string_length end |
#max_traces ⇒ Object (readonly)
Returns the value of attribute max_traces.
10 11 12 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 10 def max_traces @max_traces end |
Instance Method Details
#room_for?(count) ⇒ Boolean
37 38 39 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 37 def room_for?(count) max_traces.nil? || count < max_traces end |
#too_deep?(depth) ⇒ Boolean
33 34 35 |
# File 'lib/rails_tracepoint_stack/limits.rb', line 33 def too_deep?(depth) !max_depth.nil? && !depth.nil? && depth > max_depth end |