Sha256: 80728239d3f8a295ef67b615d5506f699cd8506d4ae1388aae8768db28dc2b65
Contents?: true
Size: 1.05 KB
Versions: 7
Compression:
Stored size: 1.05 KB
Contents
module Skylight module Normalizers module Coach class HandlerFinish < Normalizer register "coach.handler.finish" 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') if segments.any? trace.endpoint += "<sk-segment>#{segments.join("+")}</sk-segment>" end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems