Decode implements GeneratorCodec.
(data []byte)
| 199 | |
| 200 | // Decode implements GeneratorCodec. |
| 201 | func (d *OTLPDecoder) Decode(data []byte) (iter.Seq2[*tempopb.PushSpansRequest, error], error) { |
| 202 | d.trace.ResourceSpans = d.trace.ResourceSpans[:0] |
| 203 | err := d.trace.Unmarshal(data) |
| 204 | if err != nil { |
| 205 | return nil, err |
| 206 | } |
| 207 | |
| 208 | return func(yield func(*tempopb.PushSpansRequest, error) bool) { |
| 209 | yield(&tempopb.PushSpansRequest{ |
| 210 | Batches: d.trace.ResourceSpans, |
| 211 | // ptrace.Traces does not contain a flag that translates to this field, if we |
| 212 | // ever want to skip spans in this record type we'll need to propagate this via |
| 213 | // record metadata. |
| 214 | SkipMetricsGeneration: false, |
| 215 | }, nil) |
| 216 | }, nil |
| 217 | } |