Decode implements GeneratorCodec.
(data []byte)
| 166 | |
| 167 | // Decode implements GeneratorCodec. |
| 168 | func (d *PushBytesDecoder) Decode(data []byte) (iter.Seq2[*tempopb.PushSpansRequest, error], error) { |
| 169 | d.dec.Reset() |
| 170 | spanBytes, err := d.dec.Decode(data) |
| 171 | if err != nil { |
| 172 | return nil, err |
| 173 | } |
| 174 | |
| 175 | trace := tempopb.Trace{} |
| 176 | return func(yield func(*tempopb.PushSpansRequest, error) bool) { |
| 177 | for _, tr := range spanBytes.Traces { |
| 178 | trace.Reset() |
| 179 | err = trace.Unmarshal(tr.Slice) |
| 180 | |
| 181 | yield(&tempopb.PushSpansRequest{ |
| 182 | Batches: trace.ResourceSpans, |
| 183 | SkipMetricsGeneration: spanBytes.SkipMetricsGeneration, |
| 184 | }, err) |
| 185 | |
| 186 | tempopb.ReuseByteSlices([][]byte{tr.Slice}) |
| 187 | } |
| 188 | }, nil |
| 189 | } |
| 190 | |
| 191 | // OTLPDecoder unmarshals ptrace.Traces. |
| 192 | type OTLPDecoder struct { |