mirror of
https://github.com/prometheus/prometheus
synced 2025-01-12 09:40:00 +00:00
Update according to code review
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
parent
19a4f314f5
commit
40240c9c1c
@ -491,7 +491,7 @@ type ScrapeConfig struct {
|
||||
LabelValueLengthLimit uint `yaml:"label_value_length_limit,omitempty"`
|
||||
// More than this many buckets in a native histogram will cause the scrape to
|
||||
// fail.
|
||||
NativeHistogramBucketLimit uint `yaml:"bucket_limit,omitempty"`
|
||||
NativeHistogramBucketLimit uint `yaml:"native_histogram_bucket_limit,omitempty"`
|
||||
|
||||
// We cannot do proper Go type embedding below as the parser will then parse
|
||||
// values arbitrarily into the overflow maps of further-down types.
|
||||
|
@ -377,10 +377,10 @@ metric_relabel_configs:
|
||||
# change in the future.
|
||||
[ target_limit: <int> | default = 0 ]
|
||||
|
||||
# Limit on total number of positive and negative buckets allowed in a native
|
||||
# histogram. If this is exceeded, the entire scrape will be treated as failed.
|
||||
# 0 means no limit.
|
||||
[ sample_limit: <int> | default = 0 ]
|
||||
# Limit on total number of positive and negative buckets allowed in a single
|
||||
# native histogram. If this is exceeded, the entire scrape will be treated as
|
||||
# failed. 0 means no limit.
|
||||
[ native_histogram_bucket_limit: <int> | default = 0 ]
|
||||
```
|
||||
|
||||
Where `<job_name>` must be unique across all scrape configurations.
|
||||
|
@ -18,6 +18,7 @@ import (
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
|
||||
// Intentionally using client model to simulate client in tests.
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
)
|
||||
|
@ -193,8 +193,8 @@ var (
|
||||
)
|
||||
targetScrapeNativeHistogramBucketLimit = prometheus.NewCounter(
|
||||
prometheus.CounterOpts{
|
||||
Name: "prometheus_target_scrapes_histogram_exceeded_bucket_limit_total",
|
||||
Help: "Total number of scrapes that hit the native histograms bucket limit and were rejected.",
|
||||
Name: "prometheus_target_scrapes_exceeded_native_histogram_bucket_limit_total",
|
||||
Help: "Total number of scrapes that hit the native histogram bucket limit and were rejected.",
|
||||
},
|
||||
)
|
||||
)
|
||||
@ -744,17 +744,17 @@ func mutateReportSampleLabels(lset labels.Labels, target *Target) labels.Labels
|
||||
}
|
||||
|
||||
// appender returns an appender for ingested samples from the target.
|
||||
func appender(app storage.Appender, limit, bucketLimit int) storage.Appender {
|
||||
func appender(app storage.Appender, sampleLimit, bucketLimit int) storage.Appender {
|
||||
app = &timeLimitAppender{
|
||||
Appender: app,
|
||||
maxTime: timestamp.FromTime(time.Now().Add(maxAheadTime)),
|
||||
}
|
||||
|
||||
// The limit is applied after metrics are potentially dropped via relabeling.
|
||||
if limit > 0 {
|
||||
// The sampleLimit is applied after metrics are potentially dropped via relabeling.
|
||||
if sampleLimit > 0 {
|
||||
app = &limitAppender{
|
||||
Appender: app,
|
||||
limit: limit,
|
||||
limit: sampleLimit,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1707,7 +1707,7 @@ loop:
|
||||
}
|
||||
if bucketLimitErr != nil {
|
||||
if err == nil {
|
||||
err = bucketLimitErr // if sample limit is hit, that error takes precedence
|
||||
err = bucketLimitErr // If sample limit is hit, that error takes precedence.
|
||||
}
|
||||
// We only want to increment this once per scrape, so this is Inc'd outside the loop.
|
||||
targetScrapeNativeHistogramBucketLimit.Inc()
|
||||
|
Loading…
Reference in New Issue
Block a user