[pkg/ottl] Fix handling of slice values in flatten function by considering depth option#36198
Merged
evan-bradley merged 6 commits intoNov 15, 2024
Merged
Conversation
…ering depth option Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Member
There was a problem hiding this comment.
Can you add a new test for the new error condition of depth=0
Member
There was a problem hiding this comment.
Can you add an e2e test for flattening a slice and a map with a set depth
Contributor
Author
There was a problem hiding this comment.
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 <florian.bacher@dynatrace.com>
TylerHelmuth
approved these changes
Nov 15, 2024
evan-bradley
approved these changes
Nov 15, 2024
rshiyani
pushed a commit
to rshiyani/opentelemetry-collector-contrib
that referenced
this pull request
Dec 9, 2024
…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 <florian.bacher@dynatrace.com> Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
sbylica-splunk
pushed a commit
to sbylica-splunk/opentelemetry-collector-contrib
that referenced
this pull request
Dec 17, 2024
…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 <florian.bacher@dynatrace.com> Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adapts the
flattenfunction to also consider thedepthoption 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
depthoption is set