Skip to content

Commit

Permalink
improve AttributeFor
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <number101010@gmail.com>
  • Loading branch information
joe-elliott committed Nov 13, 2023
1 parent 3f9f142 commit 7ec20b3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tempodb/encoding/vparquet3/block_traceql.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,14 @@ func (s *span) AttributeFor(a traceql.Attribute) (traceql.Static, bool) {
if attr := find(a, s.resourceAttrs); attr != nil {
return *attr, true
}
return traceql.Static{}, false
}

if a.Scope == traceql.AttributeScopeSpan {
if attr := find(a, s.spanAttrs); attr != nil {
return *attr, true
}
return traceql.Static{}, false
}

if a.Intrinsic != traceql.IntrinsicNone {
Expand All @@ -137,24 +139,20 @@ func (s *span) AttributeFor(a traceql.Attribute) (traceql.Static, bool) {
if attr := find(a, s.traceAttrs); attr != nil {
return *attr, true
}

}

// span attrs brute force
// name search in span and then resource to give precedence to span
// we don't need to do a name search at the trace level b/c it is intrinsics only
if attr := findName(a.Name, s.spanAttrs); attr != nil {
return *attr, true
}

// resource attrs brute force
if attr := findName(a.Name, s.resourceAttrs); attr != nil {
return *attr, true
}

// trace attrs brute force
if attr := findName(a.Name, s.traceAttrs); attr != nil {
return *attr, true
}

return traceql.NewStaticNil(), false
return traceql.Static{}, false
}

func (s *span) ID() []byte {
Expand Down

0 comments on commit 7ec20b3

Please sign in to comment.