in enrichments/trace/internal/elastic/span.go [394:412]
func (s *spanEnrichmentContext) setEventOutcome(span ptrace.Span) {
// default to success outcome
outcome := "success"
successCount := getRepresentativeCount(span.TraceState().AsRaw())
switch {
case s.spanStatusCode == ptrace.StatusCodeError:
outcome = "failure"
successCount = 0
case s.spanStatusCode == ptrace.StatusCodeOk:
// keep the default success outcome
case s.httpStatusCode >= http.StatusInternalServerError:
// TODO (lahsivjar): Handle GRPC status code? - not handled in apm-data
// TODO (lahsivjar): Move to HTTPResponseStatusCode? Backward compatibility?
outcome = "failure"
successCount = 0
}
span.Attributes().PutStr(elasticattr.EventOutcome, outcome)
span.Attributes().PutInt(elasticattr.SuccessCount, int64(successCount))
}