mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #14287 from krajorama/nhcb-suggest-fix
native histograms: only reduce resolution for exponential histograms
This commit is contained in:
commit
d3318c21a3
|
@ -365,7 +365,9 @@ 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 {
|
// Return with an early error if the histogram has too many buckets and the
|
||||||
|
// schema is not exponential, in which case we can't reduce the resolution.
|
||||||
|
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 +378,9 @@ 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 {
|
// Return with an early error if the histogram has too many buckets and the
|
||||||
|
// schema is not exponential, in which case we can't reduce the resolution.
|
||||||
|
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…
Reference in a new issue