Skip to content

feat(vrl): add native parse_ddtags function#25153

Open
eliebleton-manomano wants to merge 2 commits intovectordotdev:masterfrom
eliebleton-manomano:feat/parse-ddtags-vrl-function
Open

feat(vrl): add native parse_ddtags function#25153
eliebleton-manomano wants to merge 2 commits intovectordotdev:masterfrom
eliebleton-manomano:feat/parse-ddtags-vrl-function

Conversation

@eliebleton-manomano
Copy link
Copy Markdown

@eliebleton-manomano eliebleton-manomano commented Apr 9, 2026

Add a VRL function parse_ddtags(value, multivalue: true) that parses Datadog tag strings (comma-separated key:value pairs) into objects.

In multivalue mode (default), values are arrays so duplicate keys are preserved. In single-value mode, the first occurrence wins.

Handles standalone keys (no colon), colons embedded in values (splits on first only), whitespace trimming, and empty segments.

Benchmarked against the equivalent pure-VRL implementation (for_each + split + get/set/push) on a realistic 50-tag input:

native: 10.1 µs/iter
pure VRL: 320.8 µs/iter (~32x slower)

Summary

Vector configuration

How did you test this PR?

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

None

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@eliebleton-manomano eliebleton-manomano requested a review from a team as a code owner April 9, 2026 08:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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

@eliebleton-manomano
Copy link
Copy Markdown
Author

eliebleton-manomano commented Apr 9, 2026

The dictionary issue seems to be unrelated to my changes. I'm ready to rebase whenever this gets fixed on master

Edit: Next force-push is that rebase.

@eliebleton-manomano
Copy link
Copy Markdown
Author

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

Add a VRL function `parse_ddtags(value, multivalue: true)` that parses
Datadog tag strings (comma-separated key:value pairs) into objects.

In multivalue mode (default), values are arrays so duplicate keys are
preserved. In single-value mode, the first occurrence wins.

Handles standalone keys (no colon), colons embedded in values (splits on
first only), whitespace trimming, and empty segments.

Benchmarked against the equivalent pure-VRL implementation (for_each +
split + get/set/push) on a realistic 50-tag input:

  native:   10.1 µs/iter
  pure VRL: 320.8 µs/iter  (~32x slower)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@eliebleton-manomano eliebleton-manomano force-pushed the feat/parse-ddtags-vrl-function branch from 448f5ca to 3ac135b Compare April 9, 2026 09:42
@pront
Copy link
Copy Markdown
Member

pront commented Apr 9, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

We should move this to the VRL repo

}

fn return_kind(&self) -> u16 {
kind::OBJECT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this change based on the multivalue value?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No it does not. What changes is that when multivalue is true, the object keys are always arrays. Otherwise, they might be strings or ints.

@mrzor
Copy link
Copy Markdown

mrzor commented Apr 13, 2026

We should move this to the VRL repo

I see - I only just notice that lib/vector-vrl has indeed been almost completely emptied out. Would you like me to close this and open another one in that other repo?

@pront
Copy link
Copy Markdown
Member

pront commented Apr 13, 2026

We should move this to the VRL repo

I see - I only just notice that lib/vector-vrl has indeed been almost completely emptied out. Would you like me to close this and open another one in that other repo?

Yes, thank you.

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.

3 participants