From 8f5c26d788bd01ac78d1bb5981267446fe9399ca Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Wed, 7 Aug 2024 15:53:50 +0800 Subject: [PATCH] app/vmagent/remotewrite: make `-remoteWrite.streamAggr.ignoreFirstIntervals` of array type (#6744) Make `-remoteWrite.streamAggr.ignoreFirstIntervals` of array type so it could accept multiple values which can be applied to the corresponding`-remoteWrite.url`. --------- Signed-off-by: hagen1778 Co-authored-by: hagen1778 --- app/vmagent/remotewrite/streamaggr.go | 4 ++-- docs/CHANGELOG.md | 1 + docs/stream-aggregation.md | 2 +- docs/vmagent.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/vmagent/remotewrite/streamaggr.go b/app/vmagent/remotewrite/streamaggr.go index cfe840e8e6..f20df53f09 100644 --- a/app/vmagent/remotewrite/streamaggr.go +++ b/app/vmagent/remotewrite/streamaggr.go @@ -50,7 +50,7 @@ var ( streamAggrIgnoreOldSamples = flagutil.NewArrayBool("remoteWrite.streamAggr.ignoreOldSamples", "Whether to ignore input samples with old timestamps outside the current "+ "aggregation interval for the corresponding -remoteWrite.streamAggr.config at the corresponding -remoteWrite.url. "+ "See https://docs.victoriametrics.com/stream-aggregation/#ignoring-old-samples") - streamAggrIgnoreFirstIntervals = flag.Int("remoteWrite.streamAggr.ignoreFirstIntervals", 0, "Number of aggregation intervals to skip after the start "+ + streamAggrIgnoreFirstIntervals = flagutil.NewArrayInt("remoteWrite.streamAggr.ignoreFirstIntervals", 0, "Number of aggregation intervals to skip after the start "+ "for the corresponding -remoteWrite.streamAggr.config at the corresponding -remoteWrite.url. Increase this value if "+ "you observe incorrect aggregation results after vmagent restarts. It could be caused by receiving bufferred delayed data from clients pushing data into the vmagent. "+ "See https://docs.victoriametrics.com/stream-aggregation/#ignore-aggregation-intervals-on-start") @@ -229,7 +229,7 @@ func newStreamAggrConfigPerURL(idx int, pushFunc streamaggr.PushFunc) (*streamag DedupInterval: streamAggrDedupInterval.GetOptionalArg(idx), DropInputLabels: *streamAggrDropInputLabels, IgnoreOldSamples: streamAggrIgnoreOldSamples.GetOptionalArg(idx), - IgnoreFirstIntervals: *streamAggrIgnoreFirstIntervals, + IgnoreFirstIntervals: streamAggrIgnoreFirstIntervals.GetOptionalArg(idx), } sas, err := streamaggr.LoadFromFile(path, pushFunc, opts, alias) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 4ffd4f8772..e6a3abfe8a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -36,6 +36,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert): respect HTTP headers defined in [notifier configuration file](https://docs.victoriametrics.com/vmalert/#notifier-configuration-file) for each request to notifiers. Previously, this param was ignored by mistake. * BUGFIX: [stream aggregation](https://docs.victoriametrics.com/stream-aggregation/): correctly apply `-streamAggr.dropInputLabels` when global stream deduplication is enabled without `-streamAggr.config`. Previously, `-remoteWrite.streamAggr.dropInputLabels` was used instead. +* BUGFIX: [stream aggregation](https://docs.victoriametrics.com/stream-aggregation/): fix command-line flag `-remoteWrite.streamAggr.ignoreFirstIntervals` to accept multiple values and be applied per each corresponding `-remoteWrite.url`. Previously, this flag only could have been used globally for all URLs. ## [v1.102.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.102.1) diff --git a/docs/stream-aggregation.md b/docs/stream-aggregation.md index 042e3e52bf..4530358f55 100644 --- a/docs/stream-aggregation.md +++ b/docs/stream-aggregation.md @@ -134,7 +134,7 @@ just after the restart of `vmagent` or single-node VictoriaMetrics. This can be - The `-streamAggr.ignoreFirstIntervals=N` command-line flag at `vmagent` and single-node VictoriaMetrics. This flag instructs skipping the first `N` [aggregation intervals](#stream-aggregation-config) just after the restart across all the [configured stream aggregation configs](#configuration). - The `-remoteWrite.streamAggr.ignoreFirstIntervals=N` command-line flag can be specified individually per each `-remoteWrite.url` at [vmagent](https://docs.victoriametrics.com/vmagent/). + The `-remoteWrite.streamAggr.ignoreFirstIntervals` command-line flag can be specified individually per each `-remoteWrite.url` at [vmagent](https://docs.victoriametrics.com/vmagent/). - The `ignore_first_intervals: N` option at the particular [aggregation config](#stream-aggregation-config). diff --git a/docs/vmagent.md b/docs/vmagent.md index 517c85b2d0..01f3089254 100644 --- a/docs/vmagent.md +++ b/docs/vmagent.md @@ -2211,7 +2211,7 @@ See the docs at https://docs.victoriametrics.com/vmagent/ . An optional list of labels to drop from samples before stream de-duplication and aggregation with -remoteWrite.streamAggr.config and -remoteWrite.streamAggr.dedupInterval at the corresponding -remoteWrite.url. See https://docs.victoriametrics.com/stream-aggregation/#dropping-unneeded-labels Supports an array of values separated by comma or specified via multiple flags. Value can contain comma inside single-quoted or double-quoted string, {}, [] and () braces. - -remoteWrite.streamAggr.ignoreFirstIntervals int + -remoteWrite.streamAggr.ignoreFirstIntervals array Number of aggregation intervals to skip after the start for the corresponding -remoteWrite.streamAggr.config at the corresponding -remoteWrite.url. Increase this value if you observe incorrect aggregation results after vmagent restarts. It could be caused by receiving bufferred delayed data from clients pushing data into the vmagent. See https://docs.victoriametrics.com/stream-aggregation/#ignore-aggregation-intervals-on-start -remoteWrite.streamAggr.ignoreOldSamples array Whether to ignore input samples with old timestamps outside the current aggregation interval for the corresponding -remoteWrite.streamAggr.config at the corresponding -remoteWrite.url. See https://docs.victoriametrics.com/stream-aggregation/#ignoring-old-samples