Class: ScoutApm::LimitedLayer
- Inherits:
-
Object
- Object
- ScoutApm::LimitedLayer
- Defined in:
- lib/scout_apm/limited_layer.rb
Overview
A LimitedLayer is a lossy-compression approach to fall back on once we max out the number of detailed layer objects we store. See LayerChildrenSet for the logic on when that change over happens
QUESTION: What do we do if we attempt to merge an item that has children?
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #absorb(layer) ⇒ Object
-
#add_child ⇒ Object
Many methods don’t make any sense on a limited layer.
- #annotate_layer ⇒ Object
- #annotations ⇒ Object
- #backtrace ⇒ Object
- #caller_array ⇒ Object
- #capture_backtrace! ⇒ Object
- #children ⇒ Object
- #count ⇒ Object
- #desc ⇒ Object
- #desc= ⇒ Object
-
#initialize(type) ⇒ LimitedLayer
constructor
A new instance of LimitedLayer.
-
#legacy_metric_name ⇒ Object
This is the old style name.
- #limited? ⇒ Boolean
- #record_allocations! ⇒ Object
- #record_stop_time! ⇒ Object
- #subscopable! ⇒ Object
-
#subscopable? ⇒ Boolean
Stub out some methods with static default values #.
- #to_s ⇒ Object
- #total_allocations ⇒ Object
- #total_call_time ⇒ Object
- #total_exclusive_allocations ⇒ Object
- #total_exclusive_time ⇒ Object
Constructor Details
#initialize(type) ⇒ LimitedLayer
Returns a new instance of LimitedLayer.
10 11 12 13 14 15 16 17 18 |
# File 'lib/scout_apm/limited_layer.rb', line 10 def initialize(type) @type = type @total_call_time = 0 @total_exclusive_time = 0 @total_allocations = 0 @total_exclusive_allocations = 0 @total_layers = 0 end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/scout_apm/limited_layer.rb', line 8 def type @type end |
Instance Method Details
#absorb(layer) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/scout_apm/limited_layer.rb', line 20 def absorb(layer) @total_layers += 1 @total_call_time += layer.total_call_time @total_exclusive_time += layer.total_exclusive_time @total_allocations += layer.total_allocations @total_exclusive_allocations += layer.total_exclusive_allocations end |
#add_child ⇒ Object
Many methods don’t make any sense on a limited layer. Raise errors #
aggressively for now to detect mistaken calls #
94 95 96 |
# File 'lib/scout_apm/limited_layer.rb', line 94 def add_child raise "Should never call add_child on a limited_layer" end |
#annotate_layer ⇒ Object
110 111 112 |
# File 'lib/scout_apm/limited_layer.rb', line 110 def annotate_layer(*) raise "Should never call annotate_layer on a limited_layer" end |
#annotations ⇒ Object
61 62 63 |
# File 'lib/scout_apm/limited_layer.rb', line 61 def annotations nil end |
#backtrace ⇒ Object
84 85 86 |
# File 'lib/scout_apm/limited_layer.rb', line 84 def backtrace nil end |
#caller_array ⇒ Object
122 123 124 |
# File 'lib/scout_apm/limited_layer.rb', line 122 def caller_array raise "Should never call caller_array on a limited_layer" end |
#capture_backtrace! ⇒ Object
118 119 120 |
# File 'lib/scout_apm/limited_layer.rb', line 118 def capture_backtrace! raise "Should never call capture_backtrace on a limited_layer" end |
#children ⇒ Object
57 58 59 |
# File 'lib/scout_apm/limited_layer.rb', line 57 def children Set.new end |
#count ⇒ Object
46 47 48 |
# File 'lib/scout_apm/limited_layer.rb', line 46 def count @total_layers end |
#desc ⇒ Object
80 81 82 |
# File 'lib/scout_apm/limited_layer.rb', line 80 def desc nil end |
#desc= ⇒ Object
106 107 108 |
# File 'lib/scout_apm/limited_layer.rb', line 106 def desc=(*) raise "Should never call desc on a limited_layer" end |
#legacy_metric_name ⇒ Object
This is the old style name. This function is used for now, but should be removed, and the new type & name split should be enforced through the app.
53 54 55 |
# File 'lib/scout_apm/limited_layer.rb', line 53 def legacy_metric_name "#{type}/Limited" end |
#limited? ⇒ Boolean
69 70 71 |
# File 'lib/scout_apm/limited_layer.rb', line 69 def limited? true end |
#record_allocations! ⇒ Object
102 103 104 |
# File 'lib/scout_apm/limited_layer.rb', line 102 def record_allocations! raise "Should never call record_allocations! on a limited_layer" end |
#record_stop_time! ⇒ Object
98 99 100 |
# File 'lib/scout_apm/limited_layer.rb', line 98 def record_stop_time!(*) raise "Should never call record_stop_time! on a limited_layer" end |
#subscopable! ⇒ Object
114 115 116 |
# File 'lib/scout_apm/limited_layer.rb', line 114 def subscopable! raise "Should never call subscopable! on a limited_layer" end |
#subscopable? ⇒ Boolean
Stub out some methods with static default values #
76 77 78 |
# File 'lib/scout_apm/limited_layer.rb', line 76 def subscopable? false end |
#to_s ⇒ Object
65 66 67 |
# File 'lib/scout_apm/limited_layer.rb', line 65 def to_s "<LimitedLayer type=#{type} count=#{count}>" end |
#total_allocations ⇒ Object
38 39 40 |
# File 'lib/scout_apm/limited_layer.rb', line 38 def total_allocations @total_allocations end |
#total_call_time ⇒ Object
30 31 32 |
# File 'lib/scout_apm/limited_layer.rb', line 30 def total_call_time @total_call_time end |
#total_exclusive_allocations ⇒ Object
42 43 44 |
# File 'lib/scout_apm/limited_layer.rb', line 42 def total_exclusive_allocations @total_exclusive_allocations end |
#total_exclusive_time ⇒ Object
34 35 36 |
# File 'lib/scout_apm/limited_layer.rb', line 34 def total_exclusive_time @total_exclusive_time end |