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

Method Decode

pkg/ingest/encoding.go:168–189  ·  view source on GitHub ↗

Decode implements GeneratorCodec.

(data []byte)

Source from the content-addressed store, hash-verified

166
167// Decode implements GeneratorCodec.
168func (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.
192type OTLPDecoder struct {

Callers 1

Calls 5

ResetMethod · 0.95
UnmarshalMethod · 0.95
ReuseByteSlicesFunction · 0.92
ResetMethod · 0.65
DecodeMethod · 0.65

Tested by 1