-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pkg/ottl] Add ParseKeyValue function #31035
[pkg/ottl] Add ParseKeyValue function #31035
Conversation
39ca655
to
885a566
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar enough with ottl code standards to approve this but I can confirm it appears to implement equivalent parsing functionality to keyvalue_parser
from pkg/stanza
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just a few minor notes.
…fmt specifier for errs
db6905b
to
0dbc0d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your persistence, I think we're getting close.
Unsure if I should update Stanza in this PR similar to how it was done in #31081 or if that's a separate PR? |
7cb8012
to
2454b66
Compare
2454b66
to
e1bbb38
Compare
@dpaasman00 we'll update stanza in a separate PR |
**Description:** <Describe what has changed.> Updates the KeyValue parser to use the parseutils pkg and subsequent functions **Link to tracking Issue:** N/A Follows up on this [comment](#31035 (comment)) about merging functionality between Stanza and OTTL key value parsing **Testing:** Unit tests still pass, had to update one because of different wording in err message **Documentation:** N/A
**Description:** <Describe what has changed.> Adds a `ParseKeyValue` converter function that parses out key values pairs into a `pcommon.Map`. It takes a `StringGetter` target argument and 2 optional arguments for the pair delimiter and key value delimiter. This is an adaptation of the Stanza Key Value Parser operator to provide feature parity. Given the following input string `"k1=v1 k2=v2 k3=v3"`, the function would return the following map: ``` { "k1": "v1", "k2": "v2", "k3": "v3" } ``` **Link to tracking Issue:** <Issue number if applicable> Closes open-telemetry#30998 **Testing:** <Describe what testing was performed and which tests were added.> Added unit tests and e2e test. **Documentation:** <Describe the documentation added.> Added function documentation.
…etry#31291) **Description:** <Describe what has changed.> Updates the KeyValue parser to use the parseutils pkg and subsequent functions **Link to tracking Issue:** N/A Follows up on this [comment](open-telemetry#31035 (comment)) about merging functionality between Stanza and OTTL key value parsing **Testing:** Unit tests still pass, had to update one because of different wording in err message **Documentation:** N/A
Description:
Adds a
ParseKeyValue
converter function that parses out key values pairs into apcommon.Map
. It takes aStringGetter
target argument and 2 optional arguments for the pair delimiter and key value delimiter. This is an adaptation of the Stanza Key Value Parser operator to provide feature parity.Given the following input string
"k1=v1 k2=v2 k3=v3"
, the function would return the following map:Link to tracking Issue:
Closes #30998
Testing:
Added unit tests and e2e test.
Documentation:
Added function documentation.