Skip to content

feat(reduce transform): Add max_bytes limit to flush groups by size#25405

Open
saswatamcode wants to merge 3 commits intovectordotdev:masterfrom
saswatamcode:groupbylim
Open

feat(reduce transform): Add max_bytes limit to flush groups by size#25405
saswatamcode wants to merge 3 commits intovectordotdev:masterfrom
saswatamcode:groupbylim

Conversation

@saswatamcode
Copy link
Copy Markdown

Summary

This commit,

  • Adds a max_bytes option to reduce transform. When set, it checks if an incoming event would bring the group's accumulated size over the limit, and if it does, it flushes the current group and starts a new one with the event. If a single event exceeds the limit on its own, it's still emitted as a group of one.
  • Adds a byte_limit_flushed_total counter metric that increments each time a flush is triggered by the byte limit

Quite new to Rust here, so would appreciate any feedback!

Vector configuration

  [transforms.reduce_multiline]
  type = "reduce"
  inputs = ["kubernetes_logs"]
  group_by = [
    "kubernetes.pod_name",
    "kubernetes.container_name",
  ]
  max_bytes = 262144
  expire_after_ms = 5000

  [transforms.reduce_multiline.merge_strategies]
  message = "concat_newline"
  "kubernetes.pod_name" = "retain"
  "kubernetes.container_name" = "retain"
  "kubernetes.namespace" = "retain"
  "kubernetes.pod_labels" = "retain"

How did you test this PR?

Unit tests

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

N/A

@saswatamcode saswatamcode requested a review from a team as a code owner May 10, 2026 10:05
@github-actions github-actions Bot added the domain: transforms Anything related to Vector's transform components label May 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 10, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@saswatamcode saswatamcode changed the title feat(reduce): Add max_bytes limit to flush groups by size feat(reduce transform): Add max_bytes limit to flush groups by size May 10, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8694c59fab

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/transforms/reduce/transform.rs Outdated
@saswatamcode
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

saswatamcode and others added 2 commits May 10, 2026 11:09
This commit,

- Adds a `max_bytes` option to `reduce` transform. When set, it checks
if an incoming event would bring the group's accumulated size over the
limit, and if it does, it flushes the current group and starts a new one
with the event. If a single event exceeds the limit on its own, it's
still emitted as a group of one.
- Adds a `byte_limit_flushed_total` counter metric that increments each
time a flush is triggered by the byte limit

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8785451d28

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/transforms/reduce/transform.rs
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: transforms Anything related to Vector's transform components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant