addSpanset adds a new spanset to the combiner. It only performs the asTraceSearchMetadata conversion if the spanset will be added
(ss *Spanset)
| 123 | // addSpanset adds a new spanset to the combiner. It only performs the asTraceSearchMetadata |
| 124 | // conversion if the spanset will be added |
| 125 | func (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 |
nothing calls this directly
no test coverage detected