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

Method attributesMatched

tempodb/encoding/vparquet3/block_traceql.go:658–691  ·  view source on GitHub ↗

attributesMatched counts all attributes in the map as well as metadata fields like start/end/id

()

Source from the content-addressed store, hash-verified

656
657// attributesMatched counts all attributes in the map as well as metadata fields like start/end/id
658func (s *span) attributesMatched() int {
659 count := 0
660 // todo: attributesMatced is called a lot. we could cache this count on set
661 for _, st := range s.spanAttrs {
662 if st.s.Type != traceql.TypeNil {
663 count++
664 }
665 }
666 for _, st := range s.resourceAttrs {
667 if st.s.Type != traceql.TypeNil {
668 count++
669 }
670 }
671 for _, st := range s.traceAttrs {
672 if st.s.Type != traceql.TypeNil {
673 count++
674 }
675 }
676 if s.startTimeUnixNanos != 0 {
677 count++
678 }
679 // don't count duration nanos b/c it is added to the attributes as well as the span struct
680 // if s.durationNanos != 0 {
681 // count++
682 // }
683 if len(s.id) > 0 {
684 count++
685 }
686 if s.nestedSetLeft > 0 || s.nestedSetRight > 0 || s.nestedSetParent != 0 { // nestedSetParent can be -1 meaning it is a root span
687 count++
688 }
689
690 return count
691}
692
693// todo: this sync pool currently massively reduces allocations by pooling spans for certain queries.
694// it currently catches spans discarded:

Callers 2

KeepGroupMethod · 0.95
KeepGroupMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected