Skip to content

vmcluster/vmsingle: support downsampling and retention filters#2224

Merged
vrutkovs merged 1 commit into
masterfrom
support-downsampling-and-retention-filters
Jun 3, 2026
Merged

vmcluster/vmsingle: support downsampling and retention filters#2224
vrutkovs merged 1 commit into
masterfrom
support-downsampling-and-retention-filters

Conversation

@AndrewChubatiuk
Copy link
Copy Markdown
Contributor

@AndrewChubatiuk AndrewChubatiuk commented May 29, 2026

fixes #2221
related issue VictoriaMetrics/helm-charts#2221


Summary by cubic

Adds structured downsampling and per-series retention filters to VMSingle and VMCluster. The operator validates the enterprise license, renders the right flags, and for VMCluster only defaults -dedup.minScrapeInterval to 1ms when neither the flag nor spec.downsampling.dedupInterval is set.

  • New Features

    • spec.downsampling for VMSingle and VMCluster: rules {filter?, periods:[{offset, interval}]} with optional dedupInterval; applied to vmselect and vmstorage on VMCluster.
    • spec.retentionFilters for VMSingle; spec.vmstorage.retentionFilters for VMCluster.
    • Validation: enterprise license required; parses label filters and durations; offset must be a multiple of interval; period intervals must be pairwise multiples; dedupInterval must divide all rule intervals; duplicate rule filters rejected; per-series retention must not exceed spec.retentionPeriod.
    • Controllers emit -downsampling.period per period (prefixed with filter when set), set -dedup.minScrapeInterval from dedupInterval (or 1ms on VMCluster when not provided), and emit -retentionFilter on VMSingle and VMCluster vmstorage. CRDs, deepcopy, tests, and docs updated; examples now use structured fields.
  • Migration

    • Prefer spec.downsampling and spec.retentionFilters over extraArgs; when set, they override related extraArgs.
    • Set enterprise image/tag and spec.license. Use spec.retentionPeriod as the default retention.

Written for commit 59dbe0f. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 13 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread internal/controller/operator/factory/vmsingle/vmsingle.go
Comment thread api/operator/v1beta1/vmcluster_types.go Outdated
Comment thread api/operator/v1beta1/vmextra_types.go
Comment thread internal/controller/operator/factory/vmcluster/vmcluster.go
@AndrewChubatiuk AndrewChubatiuk force-pushed the support-downsampling-and-retention-filters branch 3 times, most recently from 83b6f64 to 6f7673c Compare May 29, 2026 07:26
@AndrewChubatiuk
Copy link
Copy Markdown
Contributor Author

@cubic-ai-dev

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 29, 2026

@cubic-ai-dev

@AndrewChubatiuk I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 14 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread docs/resources/vmcluster.md
Comment thread docs/resources/vmcluster.md
@AndrewChubatiuk AndrewChubatiuk force-pushed the support-downsampling-and-retention-filters branch from c1e6af7 to a7168d8 Compare June 1, 2026 12:31
Comment thread api/operator/v1beta1/vmcluster_types.go Outdated
// Downsampling defines downsampling rules applied to vmselect and vmstorage components.
// Requires enterprise license. See https://docs.victoriametrics.com/victoriametrics/cluster-victoriametrics/#downsampling
// +optional
Downsampling *DownsamplingConfig `json:"downsampling,omitempty"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood correctly this would add more params in extraArgs.downsampling - would it crash if there are duplicates? We should add some more tests on a mix of spec.downsampling + spec.extraArgs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if downsampling section is defined it rewrites extraArgs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, we should add this to the docs / API documentation

Comment thread api/operator/v1beta1/vmextra_types.go Outdated
Comment thread api/operator/v1beta1/vmextra_types.go Outdated
Comment thread api/operator/v1beta1/vmcluster_types.go Outdated
@AndrewChubatiuk AndrewChubatiuk force-pushed the support-downsampling-and-retention-filters branch 3 times, most recently from 3a0fefc to e39bc2e Compare June 3, 2026 08:35
Comment thread docs/resources/vmcluster.md Outdated
Comment thread docs/resources/vmcluster.md Outdated
@AndrewChubatiuk AndrewChubatiuk force-pushed the support-downsampling-and-retention-filters branch from 942798f to 59dbe0f Compare June 3, 2026 09:31
@vrutkovs vrutkovs merged commit 090248d into master Jun 3, 2026
7 checks passed
@vrutkovs vrutkovs deleted the support-downsampling-and-retention-filters branch June 3, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature(vmcluster,vmsingle): support first class downsampling and retention filters management

2 participants