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

Method KeepGroup

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

Source from the content-addressed store, hash-verified

3850}
3851
3852func (c *linkCollector) KeepGroup(res *parquetquery.IteratorResult) bool {
3853 var l *link
3854
3855 // look for existing link first
3856 for _, e := range res.OtherEntries {
3857 if v, ok := e.Value.(*link); ok {
3858 l = v
3859 break
3860 }
3861 }
3862
3863 // if not found create a new one
3864 if l == nil {
3865 l = getLink()
3866 }
3867
3868 // extract from attribute collector
3869 for _, e := range res.OtherEntries {
3870 if v, ok := e.Value.(traceql.Static); ok {
3871 l.attrs = append(l.attrs, attrVal{
3872 a: newLinkAttr(e.Key),
3873 s: v,
3874 })
3875 }
3876 }
3877
3878 for _, e := range res.Entries {
3879 switch e.Key {
3880 case columnPathLinkTraceID:
3881 l.attrs = append(l.attrs, attrVal{
3882 a: traceql.NewIntrinsic(traceql.IntrinsicLinkTraceID),
3883 s: traceql.NewStaticString(util.TraceIDToHexString(e.Value.Bytes())),
3884 })
3885 case columnPathLinkSpanID:
3886 l.attrs = append(l.attrs, attrVal{
3887 a: traceql.NewIntrinsic(traceql.IntrinsicLinkSpanID),
3888 s: traceql.NewStaticString(util.SpanIDToHexString(e.Value.Bytes())),
3889 })
3890 default:
3891 // null value indicates attribute doesn't exist
3892 if e.Value.IsNull() {
3893 l.attrs = append(l.attrs, attrVal{
3894 a: newLinkAttr(e.Key),
3895 s: traceql.NewStaticString("nil"),
3896 })
3897 }
3898 }
3899 }
3900
3901 if c.minAttributes > 0 {
3902 if len(l.attrs) < c.minAttributes {
3903 putLink(l)
3904 return false
3905 }
3906 }
3907
3908 res.Reset()
3909 res.AppendOtherValue(otherEntryLinkKey, l)

Callers

nothing calls this directly

Calls 10

NewIntrinsicFunction · 0.92
NewStaticStringFunction · 0.92
TraceIDToHexStringFunction · 0.92
SpanIDToHexStringFunction · 0.92
BytesMethod · 0.80
AppendOtherValueMethod · 0.80
getLinkFunction · 0.70
newLinkAttrFunction · 0.70
putLinkFunction · 0.70
ResetMethod · 0.65

Tested by

no test coverage detected