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

Method attributesMatched

tempodb/encoding/vparquet4/block_traceql.go:769–817  ·  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

767
768// attributesMatched counts all attributes in the map as well as metadata fields like start/end/id
769func (s *span) attributesMatched() int {
770 count := 0
771 // todo: attributesMatced is called a lot. we could cache this count on set
772 for _, st := range s.spanAttrs {
773 if st.s.Type != traceql.TypeNil {
774 count++
775 }
776 }
777 for _, st := range s.resourceAttrs {
778 if st.s.Type != traceql.TypeNil {
779 count++
780 }
781 }
782 for _, st := range s.traceAttrs {
783 if st.s.Type != traceql.TypeNil {
784 count++
785 }
786 }
787 for _, st := range s.eventAttrs {
788 if st.s.Type != traceql.TypeNil {
789 count++
790 }
791 }
792 for _, st := range s.linkAttrs {
793 if st.s.Type != traceql.TypeNil {
794 count++
795 }
796 }
797 for _, st := range s.instrumentationAttrs {
798 if st.s.Type != traceql.TypeNil {
799 count++
800 }
801 }
802 if s.startTimeUnixNanos != 0 {
803 count++
804 }
805 // don't count duration nanos b/c it is added to the attributes as well as the span struct
806 // if s.durationNanos != 0 {
807 // count++
808 // }
809 if len(s.id) > 0 {
810 count++
811 }
812 if s.nestedSetLeft > 0 || s.nestedSetRight > 0 || s.nestedSetParent != 0 { // nestedSetParent can be -1 meaning it is a root span
813 count++
814 }
815
816 return count
817}
818
819// todo: this sync pool currently massively reduces allocations by pooling spans for certain queries.
820// it currently catches spans discarded:

Callers 2

KeepGroupMethod · 0.95
KeepGroupMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected