From f3d27d77d42c1722a69c158e759471c9f8c55748 Mon Sep 17 00:00:00 2001 From: AndrewChubatiuk Date: Fri, 21 Jun 2024 13:53:58 +0300 Subject: [PATCH] vmsingle and vmagent: keep_input and ignore_first_samples for streaming aggregation --- api/v1beta1/additional.go | 6 ++++++ api/v1beta1/zz_generated.deepcopy.go | 10 ++++++++++ api/victoriametrics/v1beta1/additional.go | 6 ++++++ .../bases/operator.victoriametrics.com_vmagents.yaml | 6 ++++++ .../bases/operator.victoriametrics.com_vmsingles.yaml | 6 ++++++ docs/CHANGELOG.md | 2 ++ 6 files changed, 36 insertions(+) diff --git a/api/v1beta1/additional.go b/api/v1beta1/additional.go index fc59316a..966d3ceb 100644 --- a/api/v1beta1/additional.go +++ b/api/v1beta1/additional.go @@ -503,6 +503,12 @@ type StreamAggrRule struct { // IgnoreOldSamples instructs to ignore samples with old timestamps outside the current aggregation interval. IgnoreOldSamples *bool `json:"ignore_old_samples,omitempty" yaml:"ignore_old_samples,omitempty"` + // IgnoreFirstIntervals instructs to ignore first N intervals after start. + IgnoreFirstIntervals *int `json:"ignore_first_intervals,omitempty" yaml:"ignore_first_intervals,omitempty"` + + // KeepInput instructs whether to keep all the matched input samples after the aggregation + KeepInput *bool `json:"keep_input,omitempty" yaml:"keep_input,omitempty"` + // By is an optional list of labels for grouping input series. // // See also Without. diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 0a79af1a..e36a3075 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -2458,6 +2458,16 @@ func (in *StreamAggrRule) DeepCopyInto(out *StreamAggrRule) { *out = new(bool) **out = **in } + if in.IgnoreFirstIntervals != nil { + in, out := &in.IgnoreFirstIntervals, &out.IgnoreFirstIntervals + *out = new(int) + **out = **in + } + if in.KeepInput != nil { + in, out := &in.KeepInput, &out.KeepInput + *out = new(bool) + **out = **in + } if in.By != nil { in, out := &in.By, &out.By *out = make([]string, len(*in)) diff --git a/api/victoriametrics/v1beta1/additional.go b/api/victoriametrics/v1beta1/additional.go index fc59316a..ba8fa554 100644 --- a/api/victoriametrics/v1beta1/additional.go +++ b/api/victoriametrics/v1beta1/additional.go @@ -503,6 +503,12 @@ type StreamAggrRule struct { // IgnoreOldSamples instructs to ignore samples with old timestamps outside the current aggregation interval. IgnoreOldSamples *bool `json:"ignore_old_samples,omitempty" yaml:"ignore_old_samples,omitempty"` + // IgnoreFirstIntervals instructs to ignore first N intervals after start. + IgnoreFirstIntervals *int `json:"ignore_first_intervals,omitempty" yaml:"ignore_first_intervals,omitempty"` + + // KeepInput instructs whether to keep all the matched input samples after the aggregation + KeepInput *bool `json:"keep_input,omitempty" yaml:"keep_input,omitempty"` + // By is an optional list of labels for grouping input series. // // See also Without. diff --git a/config/crd/bases/operator.victoriametrics.com_vmagents.yaml b/config/crd/bases/operator.victoriametrics.com_vmagents.yaml index f88f2ec9..457d73b1 100644 --- a/config/crd/bases/operator.victoriametrics.com_vmagents.yaml +++ b/config/crd/bases/operator.victoriametrics.com_vmagents.yaml @@ -1922,6 +1922,9 @@ spec: It is not recommended changing this setting, unless unfinished aggregations states are preferred to missing data points. type: boolean + ignore_first_intervals: + description: IgnoreFirstIntervals instructs to ignore first N intervals after start. + type: integer ignore_old_samples: description: IgnoreOldSamples instructs to ignore samples with old timestamps outside the current aggregation interval. type: boolean @@ -2001,6 +2004,9 @@ spec: interval: description: Interval is the interval between aggregations. type: string + keep_input: + description: KeepInput instructs whether to keep all the matched input samples after the aggregation + type: boolean keep_metric_names: description: KeepMetricNames instructs to leave metric names as is for the output time series without adding any suffix. type: boolean diff --git a/config/crd/bases/operator.victoriametrics.com_vmsingles.yaml b/config/crd/bases/operator.victoriametrics.com_vmsingles.yaml index 48a5145c..69c503ee 100644 --- a/config/crd/bases/operator.victoriametrics.com_vmsingles.yaml +++ b/config/crd/bases/operator.victoriametrics.com_vmsingles.yaml @@ -803,6 +803,9 @@ spec: It is not recommended changing this setting, unless unfinished aggregations states are preferred to missing data points. type: boolean + ignore_first_intervals: + description: IgnoreFirstIntervals instructs to ignore first N intervals after start. + type: integer ignore_old_samples: description: IgnoreOldSamples instructs to ignore samples with old timestamps outside the current aggregation interval. type: boolean @@ -882,6 +885,9 @@ spec: interval: description: Interval is the interval between aggregations. type: string + keep_input: + description: KeepInput instructs whether to keep all the matched input samples after the aggregation + type: boolean keep_metric_names: description: KeepMetricNames instructs to leave metric names as is for the output time series without adding any suffix. type: boolean diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d7015596..85e8ecad 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -27,6 +27,8 @@ aliases: - [vmalertmanagerconfig](./api.md#vmalertmanagerconfig): adds missing `handleReconcileErr` callback to the reconcile loop. It must properly handle errors and deregister objects. +- [vmagent](./api.md#vmagent) and [vmsingle](./api.md#vmsingle): adds new fields into `streamAggrConfig`: `keep_input`, `ignore_first_samples`. + ## [v0.45.0](https://github.com/VictoriaMetrics/operator/releases/tag/v0.45.0) - 10 Jun 2024