MCPcopy
hub / github.com/grafana/tempo / logSpans

Function logSpans

modules/distributor/distributor.go:868–891  ·  view source on GitHub ↗
(batches []*v1.ResourceSpans, cfg *LogSpansConfig, logger log.Logger)

Source from the content-addressed store, hash-verified

866}
867
868func logSpans(batches []*v1.ResourceSpans, cfg *LogSpansConfig, logger log.Logger) {
869 for _, b := range batches {
870 loggerWithAtts := logger
871
872 if cfg.IncludeAllAttributes {
873 for _, a := range b.Resource.GetAttributes() {
874 loggerWithAtts = log.With(
875 loggerWithAtts,
876 "span_"+strutil.SanitizeLabelName(a.GetKey()),
877 util.StringifyAnyValue(a.GetValue()))
878 }
879 }
880
881 for _, ils := range b.ScopeSpans {
882 for _, s := range ils.Spans {
883 if cfg.FilterByStatusError && s.Status.Code != v1.Status_STATUS_CODE_ERROR {
884 continue
885 }
886
887 logSpan(s, cfg.IncludeAllAttributes, loggerWithAtts)
888 }
889 }
890 }
891}
892
893func logSpan(s *v1.Span, allAttributes bool, logger log.Logger) {
894 if allAttributes {

Callers 2

logReceivedSpansFunction · 0.85

Calls 5

StringifyAnyValueFunction · 0.92
logSpanFunction · 0.85
GetKeyMethod · 0.80
GetAttributesMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected