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

Method attributesMatched

tempodb/encoding/vparquet5/block_traceql.go:774–822  ·  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

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

Callers 2

KeepGroupMethod · 0.95
KeepGroupMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected