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

Method KeepGroup

tempodb/encoding/vparquet5/block_traceql.go:3746–3819  ·  view source on GitHub ↗
(res *parquetquery.IteratorResult)

Source from the content-addressed store, hash-verified

3744}
3745
3746func (c *eventCollector) KeepGroup(res *parquetquery.IteratorResult) bool {
3747 var ev *event
3748
3749 // look for existing event first
3750 for _, e := range res.OtherEntries {
3751 if v, ok := e.Value.(*event); ok {
3752 ev = v
3753 break
3754 }
3755 }
3756
3757 // if not found create a new one
3758 if ev == nil {
3759 ev = getEvent()
3760 }
3761
3762 // extract from attribute collector
3763 for _, e := range res.OtherEntries {
3764 if v, ok := e.Value.(traceql.Static); ok {
3765 ev.attrs = append(ev.attrs, attrVal{
3766 a: newEventAttr(e.Key),
3767 s: v,
3768 })
3769 }
3770 }
3771
3772 for _, e := range res.Entries {
3773 switch e.Key {
3774 case ColumnPathEventName:
3775 ev.attrs = append(ev.attrs, attrVal{
3776 a: traceql.IntrinsicEventNameAttribute,
3777 s: traceql.NewStaticString(unsafeToString(e.Value.Bytes())),
3778 })
3779 case columnPathEventTimeSinceStart:
3780 ev.attrs = append(ev.attrs, attrVal{
3781 a: traceql.IntrinsicEventTimeSinceStartAttribute,
3782 s: traceql.NewStaticDuration(time.Duration(e.Value.Int64())),
3783 })
3784 default:
3785 // TODO - This exists for span-level dedicated columns like http.status_code
3786 // Are nils possible here?
3787 switch e.Value.Kind() {
3788 case parquet.Boolean:
3789 ev.attrs = append(ev.attrs, attrVal{a: newEventAttr(e.Key), s: traceql.NewStaticBool(e.Value.Boolean())})
3790 case parquet.Int32, parquet.Int64:
3791 ev.attrs = append(ev.attrs, attrVal{a: newEventAttr(e.Key), s: traceql.NewStaticInt(int(e.Value.Int64()))})
3792 case parquet.Float:
3793 ev.attrs = append(ev.attrs, attrVal{a: newEventAttr(e.Key), s: traceql.NewStaticFloat(e.Value.Double())})
3794 case parquet.ByteArray:
3795 ev.attrs = append(ev.attrs, attrVal{a: newEventAttr(e.Key), s: traceql.NewStaticString(unsafeToString(e.Value.Bytes()))})
3796 default:
3797 // null value indicates attribute doesn't exist
3798 if e.Value.IsNull() {
3799 ev.attrs = append(ev.attrs, attrVal{
3800 a: newEventAttr(e.Key),
3801 s: traceql.NewStaticString("nil"),
3802 })
3803 }

Callers

nothing calls this directly

Calls 14

NewStaticStringFunction · 0.92
NewStaticDurationFunction · 0.92
NewStaticBoolFunction · 0.92
NewStaticIntFunction · 0.92
NewStaticFloatFunction · 0.92
BytesMethod · 0.80
DurationMethod · 0.80
KindMethod · 0.80
AppendOtherValueMethod · 0.80
getEventFunction · 0.70
newEventAttrFunction · 0.70
unsafeToStringFunction · 0.70

Tested by

no test coverage detected