Class: ScoutApm::LayerConverters::ErrorConverter

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

Instance Attribute Summary

Attributes inherited from ConverterBase

#request, #root_layer, #walker

Instance Method Summary collapse

Methods inherited from ConverterBase

#find_first_layer_of_type, #initialize, #scope_layer

Constructor Details

This class inherits a constructor from ScoutApm::LayerConverters::ConverterBase

Instance Method Details

#callObject



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 call
  scope = scope_layer

  # 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
  return {} unless request.error?

  meta = MetricMeta.new("Errors/#{scope.legacy_metric_name}", {})
  stat = MetricStats.new
  stat.update!(1)

  { meta => stat }
end