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

Method KeepGroup

tempodb/encoding/vparquet4/block_traceql.go:3655–3712  ·  view source on GitHub ↗
(res *parquetquery.IteratorResult)

Source from the content-addressed store, hash-verified

3653}
3654
3655func (c *eventCollector) KeepGroup(res *parquetquery.IteratorResult) bool {
3656 var ev *event
3657
3658 // look for existing event first
3659 for _, e := range res.OtherEntries {
3660 if v, ok := e.Value.(*event); ok {
3661 ev = v
3662 break
3663 }
3664 }
3665
3666 // if not found create a new one
3667 if ev == nil {
3668 ev = getEvent()
3669 }
3670
3671 // extract from attribute collector
3672 for _, e := range res.OtherEntries {
3673 if v, ok := e.Value.(traceql.Static); ok {
3674 ev.attrs = append(ev.attrs, attrVal{
3675 a: newEventAttr(e.Key),
3676 s: v,
3677 })
3678 }
3679 }
3680
3681 for _, e := range res.Entries {
3682 switch e.Key {
3683 case ColumnPathEventName:
3684 ev.attrs = append(ev.attrs, attrVal{
3685 a: traceql.IntrinsicEventNameAttribute,
3686 s: traceql.NewStaticString(unsafeToString(e.Value.Bytes())),
3687 })
3688 case columnPathEventTimeSinceStart:
3689 ev.attrs = append(ev.attrs, attrVal{
3690 a: traceql.IntrinsicEventTimeSinceStartAttribute,
3691 s: traceql.NewStaticDuration(time.Duration(e.Value.Int64())),
3692 })
3693 default:
3694 // This is a null value, indicating the attribute doesn't exist
3695 if e.Value.IsNull() {
3696 ev.attrs = append(ev.attrs, attrVal{newEventAttr(e.Key), traceql.NewStaticString("nil")})
3697 }
3698 }
3699 }
3700
3701 if c.minAttributes > 0 {
3702 if len(ev.attrs) < c.minAttributes {
3703 putEvent(ev)
3704 return false
3705 }
3706 }
3707
3708 res.Reset()
3709 res.AppendOtherValue(otherEntryEventKey, ev)
3710
3711 return true
3712}

Callers

nothing calls this directly

Calls 10

NewStaticStringFunction · 0.92
NewStaticDurationFunction · 0.92
BytesMethod · 0.80
DurationMethod · 0.80
AppendOtherValueMethod · 0.80
getEventFunction · 0.70
newEventAttrFunction · 0.70
unsafeToStringFunction · 0.70
putEventFunction · 0.70
ResetMethod · 0.65

Tested by

no test coverage detected