MCPcopy Create free account
hub / github.com/cortexproject/cortex / ToChunks

Function ToChunks

pkg/util/chunkcompat/compat.go:83–100  ·  view source on GitHub ↗

ToChunks converts []chunk.Chunk to []client.Chunk.

(in []chunk.Chunk)

Source from the content-addressed store, hash-verified

81
82// ToChunks converts []chunk.Chunk to []client.Chunk.
83func ToChunks(in []chunk.Chunk) ([]client.Chunk, error) {
84 out := make([]client.Chunk, 0, len(in))
85 for _, i := range in {
86 e, err := prom_chunk.FromPromChunkEncoding(i.Data.Encoding())
87 if err != nil {
88 return nil, err
89 }
90 wireChunk := client.Chunk{
91 StartTimestampMs: int64(i.From),
92 EndTimestampMs: int64(i.Through),
93 Encoding: int32(e),
94 Data: i.Data.Bytes(),
95 }
96
97 out = append(out, wireChunk)
98 }
99 return out, nil
100}

Callers 6

TestLimitsFunction · 0.92
mockDistibutorForFunction · 0.92
TestIngesterStreamingFunction · 0.92
ConvertToChunksFunction · 0.92

Calls 1

BytesMethod · 0.65

Tested by 5

TestLimitsFunction · 0.74
mockDistibutorForFunction · 0.74
TestIngesterStreamingFunction · 0.74