HistogramSamples appends histogram samples in rec to the given slice.
(rec []byte, histograms []RefHistogramSample)
| 528 | |
| 529 | // HistogramSamples appends histogram samples in rec to the given slice. |
| 530 | func (d *Decoder) HistogramSamples(rec []byte, histograms []RefHistogramSample) ([]RefHistogramSample, error) { |
| 531 | dec := encoding.Decbuf{B: rec} |
| 532 | switch typ := Type(dec.Byte()); typ { |
| 533 | case HistogramSamples, CustomBucketsHistogramSamples: |
| 534 | return d.histogramSamplesV1(&dec, histograms) |
| 535 | case HistogramSamplesV2: |
| 536 | return d.histogramSamplesV2(&dec, histograms) |
| 537 | default: |
| 538 | return nil, fmt.Errorf("invalid record type %v", typ) |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | // histogramSamplesV1 decodes V1 int-histogram records (BE64 baseRef/baseTime, varint deltas). |
| 543 | func (d *Decoder) histogramSamplesV1(dec *encoding.Decbuf, histograms []RefHistogramSample) ([]RefHistogramSample, error) { |