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

Function testHistogram

pkg/querier/batch/stream_test.go:78–104  ·  view source on GitHub ↗
(count, numSpans, numBuckets int)

Source from the content-addressed store, hash-verified

76}
77
78func testHistogram(count, numSpans, numBuckets int) *histogram.Histogram {
79 bucketsPerSide := numBuckets / 2
80 spanLength := uint32(bucketsPerSide / numSpans)
81 h := &histogram.Histogram{
82 CounterResetHint: histogram.GaugeType,
83 Count: uint64(count),
84 ZeroCount: uint64(count),
85 ZeroThreshold: 1e-128,
86 Sum: 18.4 * float64(count+1),
87 Schema: 2,
88 NegativeSpans: make([]histogram.Span, numSpans),
89 PositiveSpans: make([]histogram.Span, numSpans),
90 NegativeBuckets: make([]int64, bucketsPerSide),
91 PositiveBuckets: make([]int64, bucketsPerSide),
92 }
93 for j := range numSpans {
94 s := histogram.Span{Offset: 1, Length: spanLength}
95 h.NegativeSpans[j] = s
96 h.PositiveSpans[j] = s
97 }
98
99 for j := range bucketsPerSide {
100 h.NegativeBuckets[j] = 1
101 h.PositiveBuckets[j] = 1
102 }
103 return h
104}

Callers 1

mkBatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected