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

Method addSpanset

pkg/traceql/combine.go:125–146  ·  view source on GitHub ↗

addSpanset adds a new spanset to the combiner. It only performs the asTraceSearchMetadata conversion if the spanset will be added

(ss *Spanset)

Source from the content-addressed store, hash-verified

123// addSpanset adds a new spanset to the combiner. It only performs the asTraceSearchMetadata
124// conversion if the spanset will be added
125func (c *mostRecentCombiner) addSpanset(ss *Spanset) {
126 // if we're not configured to keep most recent then just add it
127 if c.keepMostRecent == 0 || c.Count() < c.keepMostRecent {
128 c.AddMetadata(asTraceSearchMetadata(ss))
129 return
130 }
131
132 // else let's see if it's worth converting this to a metadata and adding it
133 // if it's already in the list, then we should add it
134 if _, ok := c.trs[util.TraceIDToHexString(ss.TraceID)]; ok {
135 c.AddMetadata(asTraceSearchMetadata(ss))
136 return
137 }
138
139 // if it's within range
140 if c.OldestTimestampNanos() <= ss.StartTimeUnixNanos {
141 c.AddMetadata(asTraceSearchMetadata(ss))
142 return
143 }
144
145 // this spanset is too old to bother converting and adding it
146}
147
148// AddMetadata adds the new metadata to the map. if it already exists
149// use CombineSearchResults to combine the two

Callers

nothing calls this directly

Calls 5

CountMethod · 0.95
AddMetadataMethod · 0.95
OldestTimestampNanosMethod · 0.95
TraceIDToHexStringFunction · 0.92
asTraceSearchMetadataFunction · 0.85

Tested by

no test coverage detected