-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 SliceToMap function #35412
base: main
Are you sure you want to change the base?
[pkg/ottl]: add SliceToMap function #35412
Conversation
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Florian Bacher <[email protected]>
@@ -84,12 +94,29 @@ func Test_e2e_editors(t *testing.T) { | |||
m.PutStr("test.foo.flags", "pass") | |||
m.PutStr("test.foo.slice.0", "val") | |||
m.PutStr("test.foo.nested.test", "pass") | |||
|
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.
@evan-bradley @TylerHelmuth - This is not related to the function implemented in this PR, but after adding a slice of nested objects to the test attributes I found that the flatten
function seems to not flatten the attributes of nested objects within a slice, but rather leaves the objects within the slice unchanged - is this intended or is this a bug in that function?
Also, when setting the depth
to 0
(as in the test case below), slices at the top level of the input of the flatten function will still be flattened.
Please let me know if this behavior is intended or if this may be a bug - If it's the latter, I can create an issue for that and work on a fix
Description: This PR adds a function that converts slices to maps, as described in the linked issue. Currently still WIP, but creating a draft PR already to show how this could be implemented and used
Link to tracking Issue: #35256
Testing: Added unit and end to end tests
Documentation: Added description for the new function in the readme file