mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-01 14:47:38 +00:00
lib/promscrape: respect 0
value for series_limit
param (#5663)
* lib/promscrape: respect `0` value for `series_limit` param Respect `0` value for `series_limit` param in `scrape_config` even if global limit was set via `-promscrape.seriesLimitPerTarget`. Previously, `0` value will be ignored in favor of `-promscrape.seriesLimitPerTarget`. This behavior aligns with possibility to override `series_limit` value via relabeling with `__series_limit__` label. Signed-off-by: hagen1778 <roman@victoriametrics.com> * Update docs/CHANGELOG.md --------- Signed-off-by: hagen1778 <roman@victoriametrics.com> Co-authored-by: Aliaksandr Valialkin <valyala@victoriametrics.com>
This commit is contained in:
parent
394c41773c
commit
a1548d56e6
3 changed files with 27 additions and 3 deletions
|
@ -16,6 +16,7 @@ The following tip changes can be tested by building VictoriaMetrics components f
|
||||||
## v1.87.x long-time support release (LTS)
|
## v1.87.x long-time support release (LTS)
|
||||||
|
|
||||||
* BUGFIX: properly return errors from [export APIs](https://docs.victoriametrics.com/#how-to-export-time-series). Previously these errors were silently suppressed. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5649).
|
* BUGFIX: properly return errors from [export APIs](https://docs.victoriametrics.com/#how-to-export-time-series). Previously these errors were silently suppressed. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5649).
|
||||||
|
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): respect explicitly set `series_limit: 0` in [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This allows removing [`series_limit` restriction](https://docs.victoriametrics.com/vmagent.html#cardinality-limiter) on a per-`scrape_config` basis when global limit is set via `-promscrape.seriesLimitPerTarget`. Previously, `0` value was ignored in favor of `-promscrape.seriesLimitPerTarget`.
|
||||||
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly process queries with too big lookbehind window such as `foo[100y]`. Previously, such queries could return empty responses even if `foo` is present in database. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5553).
|
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly process queries with too big lookbehind window such as `foo[100y]`. Previously, such queries could return empty responses even if `foo` is present in database. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5553).
|
||||||
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle possible negative results caused by float operations precision error in rollup functions like rate() or increase(). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5571).
|
* BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle possible negative results caused by float operations precision error in rollup functions like rate() or increase(). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5571).
|
||||||
|
|
||||||
|
|
|
@ -275,7 +275,7 @@ type ScrapeConfig struct {
|
||||||
StreamParse bool `yaml:"stream_parse,omitempty"`
|
StreamParse bool `yaml:"stream_parse,omitempty"`
|
||||||
ScrapeAlignInterval *promutils.Duration `yaml:"scrape_align_interval,omitempty"`
|
ScrapeAlignInterval *promutils.Duration `yaml:"scrape_align_interval,omitempty"`
|
||||||
ScrapeOffset *promutils.Duration `yaml:"scrape_offset,omitempty"`
|
ScrapeOffset *promutils.Duration `yaml:"scrape_offset,omitempty"`
|
||||||
SeriesLimit int `yaml:"series_limit,omitempty"`
|
SeriesLimit *int `yaml:"series_limit,omitempty"`
|
||||||
NoStaleMarkers *bool `yaml:"no_stale_markers,omitempty"`
|
NoStaleMarkers *bool `yaml:"no_stale_markers,omitempty"`
|
||||||
ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"`
|
ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"`
|
||||||
|
|
||||||
|
@ -960,8 +960,8 @@ func getScrapeWorkConfig(sc *ScrapeConfig, baseDir string, globalCfg *GlobalConf
|
||||||
noStaleTracking = *sc.NoStaleMarkers
|
noStaleTracking = *sc.NoStaleMarkers
|
||||||
}
|
}
|
||||||
seriesLimit := *seriesLimitPerTarget
|
seriesLimit := *seriesLimitPerTarget
|
||||||
if sc.SeriesLimit > 0 {
|
if sc.SeriesLimit != nil {
|
||||||
seriesLimit = sc.SeriesLimit
|
seriesLimit = *sc.SeriesLimit
|
||||||
}
|
}
|
||||||
swc := &scrapeWorkConfig{
|
swc := &scrapeWorkConfig{
|
||||||
scrapeInterval: scrapeInterval,
|
scrapeInterval: scrapeInterval,
|
||||||
|
|
|
@ -1289,6 +1289,29 @@ scrape_configs:
|
||||||
jobNameOriginal: "foo",
|
jobNameOriginal: "foo",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
defaultSeriesLimitPerTarget := *seriesLimitPerTarget
|
||||||
|
*seriesLimitPerTarget = 1e3
|
||||||
|
f(`
|
||||||
|
scrape_configs:
|
||||||
|
- job_name: foo
|
||||||
|
series_limit: 0
|
||||||
|
static_configs:
|
||||||
|
- targets: ["foo.bar:1234"]
|
||||||
|
`, []*ScrapeWork{
|
||||||
|
{
|
||||||
|
ScrapeURL: "http://foo.bar:1234/metrics",
|
||||||
|
ScrapeInterval: defaultScrapeInterval,
|
||||||
|
ScrapeTimeout: defaultScrapeTimeout,
|
||||||
|
jobNameOriginal: "foo",
|
||||||
|
Labels: promutils.NewLabelsFromMap(map[string]string{
|
||||||
|
"instance": "foo.bar:1234",
|
||||||
|
"job": "foo",
|
||||||
|
}),
|
||||||
|
SeriesLimit: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
*seriesLimitPerTarget = defaultSeriesLimitPerTarget
|
||||||
}
|
}
|
||||||
|
|
||||||
func equalStaticConfigForScrapeWorks(a, b []*ScrapeWork) bool {
|
func equalStaticConfigForScrapeWorks(a, b []*ScrapeWork) bool {
|
||||||
|
|
Loading…
Reference in a new issue