native histograms: only reduce resolution for exponential histograms

Currently we can only reduce the resolution of exponential native
histograms, so checking the schema for that is slightly more precise
than checking against max schema.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
pull/14287/head
György Krajcsovits 6 months ago
parent 23cca90cac
commit 0793a26d96

@ -365,7 +365,7 @@ 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 && h.Schema > histogram.ExponentialSchemaMax { if len(h.PositiveBuckets)+len(h.NegativeBuckets) > app.limit && !histogram.IsExponentialSchema(h.Schema) {
return 0, errBucketLimit return 0, errBucketLimit
} }
for len(h.PositiveBuckets)+len(h.NegativeBuckets) > app.limit { for len(h.PositiveBuckets)+len(h.NegativeBuckets) > app.limit {
@ -376,7 +376,7 @@ func (app *bucketLimitAppender) AppendHistogram(ref storage.SeriesRef, lset labe
} }
} }
if fh != nil { if fh != nil {
if len(fh.PositiveBuckets)+len(fh.NegativeBuckets) > app.limit && fh.Schema > histogram.ExponentialSchemaMax { if len(fh.PositiveBuckets)+len(fh.NegativeBuckets) > app.limit && !histogram.IsExponentialSchema(fh.Schema) {
return 0, errBucketLimit return 0, errBucketLimit
} }
for len(fh.PositiveBuckets)+len(fh.NegativeBuckets) > app.limit { for len(fh.PositiveBuckets)+len(fh.NegativeBuckets) > app.limit {

Loading…
Cancel
Save