Sha256: e737964facafb8845d1853ab7e754d8951cae0ed227c2310dd8f1fcb69bdca68
Contents?: true
Size: 1.3 KB
Versions: 20
Compression:
Stored size: 1.3 KB
Contents
module Skylight module Normalizers module Coach class HandlerFinish < Normalizer begin require "coach/version" version = Gem::Version.new(::Coach::VERSION) rescue LoadError # rubocop:disable Lint/SuppressedException end if version && version < Gem::Version.new("1.0") register "coach.handler.finish" else register "finish_handler.coach" end CAT = "app.coach.handler".freeze # See information on the events Coach emits here: # https://github.com/gocardless/coach#instrumentation # Run when the handler first starts, we need to set the trace endpoint to be the # handler name. # # We can expect the payload to have the :middleware key. def normalize(trace, _name, payload) trace.endpoint = payload[:middleware] [CAT, payload[:middleware], nil] end def normalize_after(trace, _span, _name, payload) return unless config.enable_segments? segments = [] response_status = payload.fetch(:response, {}).fetch(:status, "").to_s segments << "error" if response_status.start_with?("4", "5") trace.segment = segments.join("+") if segments.any? end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems