Class: ScoutApm::LayerConverters::ErrorConverter

Inherits:
ConverterBase show all
Defined in:
lib/scout_apm/layer_converters/error_converter.rb

Constant Summary

Constants inherited from ConverterBase

ConverterBase::MAX_METRICS

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?, #register_hooks, #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



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/scout_apm/layer_converters/error_converter.rb', line 4

def record!
  # Should we mark a request as errored out if a middleware raises?
  # How does that interact w/ a tool like Sentry or Honeybadger?
  return unless scope_layer
  return unless request.error?

  meta = MetricMeta.new("Errors/#{scope_layer.legacy_metric_name}", {})
  stat = MetricStats.new
  stat.update!(1)
  metrics = { meta => stat }
  
  @store.track!(metrics)
  metrics # this result must be returned so it can be accessed by transaction callback extensions
end