-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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] Fix handling of slice values in flatten
function by considering depth
option
#36198
[pkg/ottl] Fix handling of slice values in flatten
function by considering depth
option
#36198
Conversation
…ering depth option 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]>
Co-authored-by: Evan Bradley <[email protected]>
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.
Can you add a new test for the new error condition of depth=0
pkg/ottl/e2e/e2e_test.go
Outdated
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.
Can you add an e2e test for flattening a slice and a map with a set depth
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 believe this should already be covered by https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/36198/files#diff-90b6e27c60a80c3c831576a03b3bd0a47839bfb606a9d2876d8ccf6bf1370c92R109 - this test contains both a slice and a map and has been adjusted since the flattening previously did not stop at level 1
for the slice.
Signed-off-by: Florian Bacher <[email protected]>
…idering `depth` option (open-telemetry#36198) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR adapts the `flatten` function to also consider the `depth` option when handling slice values. Before this change, the function flattened slice values beyond the given depth. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#36161 <!--Describe what testing was performed and which tests were added.--> #### Testing Added unit and e2e tests <!--Describe the documentation added.--> #### Documentation No changes here, as the docs already mention the expected behavior of the function when the `depth` option is set <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: Evan Bradley <[email protected]>
…idering `depth` option (open-telemetry#36198) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR adapts the `flatten` function to also consider the `depth` option when handling slice values. Before this change, the function flattened slice values beyond the given depth. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#36161 <!--Describe what testing was performed and which tests were added.--> #### Testing Added unit and e2e tests <!--Describe the documentation added.--> #### Documentation No changes here, as the docs already mention the expected behavior of the function when the `depth` option is set <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: Evan Bradley <[email protected]>
Description
This PR adapts the
flatten
function to also consider thedepth
option when handling slice values. Before this change, the function flattened slice values beyond the given depth.Link to tracking issue
Fixes #36161
Testing
Added unit and e2e tests
Documentation
No changes here, as the docs already mention the expected behavior of the function when the
depth
option is set