|
|
@ -366,13 +366,21 @@ type bucketLimitAppender struct {
|
|
|
|
|
|
|
|
|
|
|
|
func (app *bucketLimitAppender) AppendHistogram(ref storage.SeriesRef, lset labels.Labels, t int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
|
|
|
|
func (app *bucketLimitAppender) AppendHistogram(ref storage.SeriesRef, lset labels.Labels, t int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
|
|
|
|
if h != nil {
|
|
|
|
if h != nil {
|
|
|
|
if len(h.PositiveBuckets)+len(h.NegativeBuckets) > app.limit {
|
|
|
|
for len(h.PositiveBuckets)+len(h.NegativeBuckets) > app.limit {
|
|
|
|
return 0, errBucketLimit
|
|
|
|
lastSum := len(h.PositiveBuckets) + len(h.NegativeBuckets)
|
|
|
|
|
|
|
|
h = h.ReduceResolution(h.Schema - 1)
|
|
|
|
|
|
|
|
if len(h.PositiveBuckets)+len(h.NegativeBuckets) == lastSum {
|
|
|
|
|
|
|
|
return 0, errBucketLimit
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if fh != nil {
|
|
|
|
if fh != nil {
|
|
|
|
if len(fh.PositiveBuckets)+len(fh.NegativeBuckets) > app.limit {
|
|
|
|
for len(fh.PositiveBuckets)+len(fh.NegativeBuckets) > app.limit {
|
|
|
|
return 0, errBucketLimit
|
|
|
|
lastSum := len(fh.PositiveBuckets) + len(fh.NegativeBuckets)
|
|
|
|
|
|
|
|
fh = fh.ReduceResolution(fh.Schema - 1)
|
|
|
|
|
|
|
|
if len(fh.PositiveBuckets)+len(fh.NegativeBuckets) == lastSum {
|
|
|
|
|
|
|
|
return 0, errBucketLimit
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ref, err := app.Appender.AppendHistogram(ref, lset, t, h, fh)
|
|
|
|
ref, err := app.Appender.AppendHistogram(ref, lset, t, h, fh)
|
|
|
|