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

Function mkBatch

pkg/querier/batch/stream_test.go:60–76  ·  view source on GitHub ↗
(from int64, enc encoding.Encoding)

Source from the content-addressed store, hash-verified

58}
59
60func mkBatch(from int64, enc encoding.Encoding) promchunk.Batch {
61 var result promchunk.Batch
62 for i := range int64(promchunk.BatchSize) {
63 result.Timestamps[i] = from + i
64 switch enc {
65 case encoding.PrometheusXorChunk:
66 result.Values[i] = float64(from + i)
67 case encoding.PrometheusHistogramChunk:
68 result.Histograms[i] = testHistogram(int(from+i), 5, 20)
69 case encoding.PrometheusFloatHistogramChunk:
70 result.FloatHistograms[i] = testHistogram(int(from+i), 5, 20).ToFloat(nil)
71 }
72 }
73 result.Length = promchunk.BatchSize
74 result.ValType = enc.ChunkValueType()
75 return result
76}
77
78func testHistogram(count, numSpans, numBuckets int) *histogram.Histogram {
79 bucketsPerSide := numBuckets / 2

Callers 1

TestStreamFunction · 0.85

Calls 2

testHistogramFunction · 0.85
ChunkValueTypeMethod · 0.80

Tested by

no test coverage detected