Class: ScoutApm::LayerConverters::MetricConverter
- Inherits:
-
ConverterBase
- Object
- ConverterBase
- ScoutApm::LayerConverters::MetricConverter
- Defined in:
- lib/scout_apm/layer_converters/metric_converter.rb
Constant Summary
Constants inherited from ConverterBase
Instance Attribute Summary
Attributes inherited from ConverterBase
#context, #layer_finder, #request, #root_layer
Instance Method Summary collapse
Methods inherited from ConverterBase
#attach_backtraces, #initialize, #limited?, #make_meta_options, #make_meta_options_desc_hash, #make_meta_options_scope, #over_metric_limit?, #scope_layer, #skip_layer?, #store_aggregate_metric, #store_backtrace, #store_specific_metric, #subscope_name, #subscoped?
Constructor Details
This class inherits a constructor from ScoutApm::LayerConverters::ConverterBase
Instance Method Details
#record! ⇒ Object
39 40 41 42 |
# File 'lib/scout_apm/layer_converters/metric_converter.rb', line 39 def record! @store.track!(@metrics) @metrics # this result must be returned so it can be accessed by transaction callback extensions end |
#register_hooks(walker) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/scout_apm/layer_converters/metric_converter.rb', line 11 def register_hooks(walker) super @metrics = {} return unless scope_layer walker.on do |layer| next if skip_layer?(layer) = if layer == scope_layer # We don't scope the controller under itself {} else {:scope => scope_layer.legacy_metric_name} end # we don't need to use the full metric name for scoped metrics as we only display metrics aggregrated # by type. metric_name = .has_key?(:scope) ? layer.type : layer.legacy_metric_name = MetricMeta.new(metric_name, ) @metrics[] ||= MetricStats.new( .has_key?(:scope) ) stat = @metrics[] stat.update!(layer.total_call_time, layer.total_exclusive_time) end end |