diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 226f782cd9..2b36f335ab 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -76,6 +76,7 @@ The sandbox cluster installation is running under the constant load generated by * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): properly assume role with [AWS IRSA authorization](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html). Previously role chaining was not supported. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3822) for details. * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): exit if there is config syntax error in [`scrape_config_files`](https://docs.victoriametrics.com/vmagent.html#loading-scrape-configs-from-multiple-files) when `-promscrape.config.strictParse=true`. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5508). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): properly discover targets for `role: endpoints` and `role: endpointslice` in [kubernetes_sd_configs](https://docs.victoriametrics.com/sd_configs.html#kubernetes_sd_configs). Previously some `endpoints` and `endpointslice` targets could be left undiscovered or some targets could have missing `__meta_*` labels when performing service discovery in busy Kubernetes clusters with large number of pods. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5557). +* 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: [vmui](https://docs.victoriametrics.com/#vmui): fix a link for the statistic inaccuracy explanation in the cardinality explorer tool. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5460). * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix the display of autocomplete results and cache the results. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5472) and [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5470). * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): send `step` param for instant queries. The change reverts [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3896) due to reasons explained in [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3896#issuecomment-1896704401). diff --git a/lib/promscrape/config.go b/lib/promscrape/config.go index 156707de09..323395c0a6 100644 --- a/lib/promscrape/config.go +++ b/lib/promscrape/config.go @@ -322,7 +322,7 @@ type ScrapeConfig struct { StreamParse bool `yaml:"stream_parse,omitempty"` ScrapeAlignInterval *promutils.Duration `yaml:"scrape_align_interval,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"` ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"` @@ -876,8 +876,8 @@ func getScrapeWorkConfig(sc *ScrapeConfig, baseDir string, globalCfg *GlobalConf noStaleTracking = *sc.NoStaleMarkers } seriesLimit := *seriesLimitPerTarget - if sc.SeriesLimit > 0 { - seriesLimit = sc.SeriesLimit + if sc.SeriesLimit != nil { + seriesLimit = *sc.SeriesLimit } swc := &scrapeWorkConfig{ scrapeInterval: scrapeInterval, diff --git a/lib/promscrape/config_test.go b/lib/promscrape/config_test.go index 64473229d9..950e455d23 100644 --- a/lib/promscrape/config_test.go +++ b/lib/promscrape/config_test.go @@ -1190,6 +1190,29 @@ scrape_configs: 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 {