(s *v1.Span, allAttributes bool, logger log.Logger)
| 891 | } |
| 892 | |
| 893 | func logSpan(s *v1.Span, allAttributes bool, logger log.Logger) { |
| 894 | if allAttributes { |
| 895 | for _, a := range s.GetAttributes() { |
| 896 | logger = log.With( |
| 897 | logger, |
| 898 | "span_"+strutil.SanitizeLabelName(a.GetKey()), |
| 899 | util.StringifyAnyValue(a.GetValue())) |
| 900 | } |
| 901 | |
| 902 | latencySeconds := float64(s.GetEndTimeUnixNano()-s.GetStartTimeUnixNano()) / float64(time.Second.Nanoseconds()) |
| 903 | logger = log.With( |
| 904 | logger, |
| 905 | "span_name", s.Name, |
| 906 | "span_duration_seconds", latencySeconds, |
| 907 | "span_kind", s.GetKind().String(), |
| 908 | "span_status", s.GetStatus().GetCode().String()) |
| 909 | } |
| 910 | |
| 911 | level.Info(logger).Log("spanid", hex.EncodeToString(s.SpanId), "traceid", hex.EncodeToString(s.TraceId)) |
| 912 | } |
| 913 | |
| 914 | // startEndFromSpan returns a unix epoch timestamp in seconds for the start and end of a span |
| 915 | func startEndFromSpan(span *v1.Span) (uint32, uint32) { |
no test coverage detected