feat(vrl): add native parse_ddtags function#25153
feat(vrl): add native parse_ddtags function#25153eliebleton-manomano wants to merge 2 commits intovectordotdev:masterfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
The dictionary issue seems to be unrelated to my changes. I'm ready to rebase whenever this gets fixed on Edit: Next force-push is that rebase. |
|
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>
448f5ca to
3ac135b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
pront
left a comment
There was a problem hiding this comment.
We should move this to the VRL repo
| } | ||
|
|
||
| fn return_kind(&self) -> u16 { | ||
| kind::OBJECT |
There was a problem hiding this comment.
Does this change based on the multivalue value?
There was a problem hiding this comment.
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.
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. |
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
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
None
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.