Class: ScoutApm::LayerConverters::ExternalServiceConverter
- Inherits:
-
ConverterBase
- Object
- ConverterBase
- ScoutApm::LayerConverters::ExternalServiceConverter
- Defined in:
- lib/scout_apm/layer_converters/external_service_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
-
#initialize ⇒ ExternalServiceConverter
constructor
A new instance of ExternalServiceConverter.
- #record! ⇒ Object
- #register_hooks(walker) ⇒ Object
- #skip_layer?(layer) ⇒ Boolean
Methods inherited from ConverterBase
#attach_backtraces, #limited?, #make_meta_options, #make_meta_options_desc_hash, #make_meta_options_scope, #over_metric_limit?, #scope_layer, #store_aggregate_metric, #store_backtrace, #store_specific_metric, #subscope_name, #subscoped?
Constructor Details
#initialize ⇒ ExternalServiceConverter
Returns a new instance of ExternalServiceConverter.
4 5 6 7 |
# File 'lib/scout_apm/layer_converters/external_service_converter.rb', line 4 def initialize(*) super @external_service_metric_set = ExternalServiceMetricSet.new(context) end |
Instance Method Details
#record! ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/scout_apm/layer_converters/external_service_converter.rb', line 27 def record! # Everything in the metric set here is from a single transaction, which # we want to keep track of. (One web call did a User#find 10 times, but # only due to 1 http request) @external_service_metric_set.increment_transaction_count! @store.track_external_service_metrics!(@external_service_metric_set) nil # not returning anything in the layer results ... not used end |
#register_hooks(walker) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/scout_apm/layer_converters/external_service_converter.rb', line 9 def register_hooks(walker) super return unless scope_layer walker.on do |layer| next if skip_layer?(layer) stat = ExternalServiceMetricStats.new( domain_name(layer), operation_name(layer), # operation name/verb. GET/POST/PUT etc. scope_layer.legacy_metric_name, # controller_scope 1, # count, this is a single call, so 1 layer.total_call_time ) @external_service_metric_set << stat end end |
#skip_layer?(layer) ⇒ Boolean
37 38 39 40 41 |
# File 'lib/scout_apm/layer_converters/external_service_converter.rb', line 37 def skip_layer?(layer) layer.type != 'HTTP' || layer.limited? || super end |