From fac7c30f4ee7428988a3b21cec68ab2fc2580a6d Mon Sep 17 00:00:00 2001
From: Aliaksandr Valialkin <valyala@victoriametrics.com>
Date: Tue, 23 Jan 2024 13:14:46 +0200
Subject: [PATCH] docs/vmagent.md: clarify how
 `-promscrape.seriesLimitPerTarget` command-line flag, `series_limit` config
 option and `__series_limit__` label interact with each other

This is a follow-up for https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5663
See also 89e3c70ccdb4bd0b5f557ba684bbb6cf0a8f5599
---
 docs/vmagent.md | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/docs/vmagent.md b/docs/vmagent.md
index f36f4bee07..a0d6f37a39 100644
--- a/docs/vmagent.md
+++ b/docs/vmagent.md
@@ -969,14 +969,17 @@ must be enabled on all the configured remote storage systems.
 By default, `vmagent` doesn't limit the number of time series each scrape target can expose.
 The limit can be enforced in the following places:
 
-* Via `-promscrape.seriesLimitPerTarget` command-line option. This limit is applied individually
+* Via `-promscrape.seriesLimitPerTarget` command-line flag. This limit is applied individually
   to all the scrape targets defined in the file pointed by `-promscrape.config`.
 * Via `series_limit` config option at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs) section.
-  This limit is applied individually to all the scrape targets defined in the given `scrape_config`.
+  The `series_limit` allows overriding the `-promscrape.seriesLimitPerTarget` on a per-`scrape_config` basis.
+  If `series_limit` is set to `0` or to negative value, then it isn't applied to the given `scrape_config`,
+  even if `-promscrape.seriesLimitPerTarget` command-line flag is set.
 * Via `__series_limit__` label, which can be set with [relabeling](#relabeling) at `relabel_configs` section.
-  This limit is applied to the corresponding scrape targets. Typical use case: to set the limit
-  via [Kubernetes annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/) for targets,
-  which may expose too high number of time series.
+  The `__series_limit__` allows overriding the `series_limit` on a per-target basis.
+  If `__series_limit__` is set to `0` or to negative value, then it isn't applied to the given target.
+  Typical use case: to set the limit via [Kubernetes annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/)
+  for targets, which may expose too high number of time series.
 
 Scraped metrics are dropped for time series exceeding the given limit on the time window of 24h.
 `vmagent` creates the following additional per-target metrics for targets with non-zero series limit: