@@ -23,10 +23,9 @@ type Sample struct {
2323}
2424
2525type GenericRingBuffer struct {
26- ctx context.Context
27- items []Sample
28- tail []Sample
29- subquery bool
26+ ctx context.Context
27+ items []Sample
28+ tail []Sample
3029
3130 currentStep int64
3231 offset int64
@@ -35,19 +34,18 @@ type GenericRingBuffer struct {
3534 call FunctionCall
3635}
3736
38- func New (ctx context.Context , size int , selectRange , offset int64 , call FunctionCall , subquery bool ) * GenericRingBuffer {
39- return NewWithExtLookback (ctx , size , selectRange , offset , 0 , call , subquery )
37+ func New (ctx context.Context , size int , selectRange , offset int64 , call FunctionCall ) * GenericRingBuffer {
38+ return NewWithExtLookback (ctx , size , selectRange , offset , 0 , call )
4039}
4140
42- func NewWithExtLookback (ctx context.Context , size int , selectRange , offset , extLookback int64 , call FunctionCall , subquery bool ) * GenericRingBuffer {
41+ func NewWithExtLookback (ctx context.Context , size int , selectRange , offset , extLookback int64 , call FunctionCall ) * GenericRingBuffer {
4342 return & GenericRingBuffer {
4443 ctx : ctx ,
4544 items : make ([]Sample , 0 , size ),
4645 selectRange : selectRange ,
4746 offset : offset ,
4847 extLookback : extLookback ,
4948 call : call ,
50- subquery : subquery ,
5149 }
5250}
5351
@@ -93,28 +91,7 @@ func (r *GenericRingBuffer) Push(t int64, v Value) {
9391 if v .H != nil {
9492 if r .items [n ].V .H == nil {
9593 h := v .H .Copy ()
96- if r .subquery {
97- // Set any "NotCounterReset" and "CounterReset" hints in native
98- // histograms to "UnknownCounterReset" because we might
99- // otherwise miss a counter reset happening in samples not
100- // returned by the subquery, or we might over-detect counter
101- // resets if the sample with a counter reset is returned
102- // multiple times by a high-res subquery. This intentionally
103- // does not attempt to be clever (like detecting if we are
104- // really missing underlying samples or returning underlying
105- // samples multiple times) because subqueries on counters are
106- // inherently problematic WRT counter reset handling, so we
107- // cannot really solve the problem for good. We only want to
108- // avoid problems that happen due to the explicitly set counter
109- // reset hints and go back to the behavior we already know from
110- // float samples.
111- switch h .CounterResetHint {
112- case histogram .NotCounterReset , histogram .CounterReset :
113- h .CounterResetHint = histogram .UnknownCounterReset
114- }
115- }
11694 r .items [n ].V .H = h
117-
11895 } else {
11996 v .H .CopyTo (r .items [n ].V .H )
12097 }
0 commit comments