mirror of
https://github.com/prometheus/prometheus
synced 2024-12-28 09:42:22 +00:00
scrape: Fix label_limits cache usage (#10370)
Fixes #10344 Signed-off-by: Jayapriya Pai <janantha@redhat.com>
This commit is contained in:
parent
da23c4649a
commit
edfe657b54
@ -1777,9 +1777,6 @@ func zeroConfig(c *config.ScrapeConfig) *config.ScrapeConfig {
|
||||
z.ScrapeInterval = 0
|
||||
z.ScrapeTimeout = 0
|
||||
z.SampleLimit = 0
|
||||
z.LabelLimit = 0
|
||||
z.LabelNameLengthLimit = 0
|
||||
z.LabelValueLengthLimit = 0
|
||||
z.HTTPClientConfig = config_util.HTTPClientConfig{}
|
||||
return &z
|
||||
}
|
||||
|
@ -2519,6 +2519,14 @@ func TestReuseScrapeCache(t *testing.T) {
|
||||
Name: "labelNew",
|
||||
Value: "nameNew",
|
||||
},
|
||||
labels.Label{
|
||||
Name: "labelNew1",
|
||||
Value: "nameNew1",
|
||||
},
|
||||
labels.Label{
|
||||
Name: "labelNew2",
|
||||
Value: "nameNew2",
|
||||
},
|
||||
},
|
||||
}
|
||||
proxyURL, _ = url.Parse("http://localhost:2128")
|
||||
@ -2595,6 +2603,49 @@ func TestReuseScrapeCache(t *testing.T) {
|
||||
MetricsPath: "/metrics2",
|
||||
},
|
||||
},
|
||||
{
|
||||
keep: false,
|
||||
newConfig: &config.ScrapeConfig{
|
||||
JobName: "Prometheus",
|
||||
ScrapeInterval: model.Duration(5 * time.Second),
|
||||
ScrapeTimeout: model.Duration(15 * time.Second),
|
||||
MetricsPath: "/metrics",
|
||||
LabelLimit: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
keep: false,
|
||||
newConfig: &config.ScrapeConfig{
|
||||
JobName: "Prometheus",
|
||||
ScrapeInterval: model.Duration(5 * time.Second),
|
||||
ScrapeTimeout: model.Duration(15 * time.Second),
|
||||
MetricsPath: "/metrics",
|
||||
LabelLimit: 15,
|
||||
},
|
||||
},
|
||||
{
|
||||
keep: false,
|
||||
newConfig: &config.ScrapeConfig{
|
||||
JobName: "Prometheus",
|
||||
ScrapeInterval: model.Duration(5 * time.Second),
|
||||
ScrapeTimeout: model.Duration(15 * time.Second),
|
||||
MetricsPath: "/metrics",
|
||||
LabelLimit: 15,
|
||||
LabelNameLengthLimit: 5,
|
||||
},
|
||||
},
|
||||
{
|
||||
keep: false,
|
||||
newConfig: &config.ScrapeConfig{
|
||||
JobName: "Prometheus",
|
||||
ScrapeInterval: model.Duration(5 * time.Second),
|
||||
ScrapeTimeout: model.Duration(15 * time.Second),
|
||||
MetricsPath: "/metrics",
|
||||
LabelLimit: 15,
|
||||
LabelNameLengthLimit: 5,
|
||||
LabelValueLengthLimit: 7,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cacheAddr := func(sp *scrapePool) map[uint64]string {
|
||||
|
Loading…
Reference in New Issue
Block a user