-
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] unexpected behavior of flatten
function when handling slice attributes at top level
#36161
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
flatten
function when handling slice attributesflatten
function when handling slice attributes at top level
It kinda feels like a bug to let you set a depth of 0. That is the same as not calling the function. |
Yes that seemed a bit odd to me that setting the depth to 0 is a supported option. Is it possible to set this parameter dynamically as well, based on e.g. another attribute or the result of another transformation? In this case it may be justified to also support 0, even though I cannot think of a realistic use case where this might be required |
@bacherfl the
I think the best fix to this issue is to not allow a depth to be < 1 |
Got it - in this case I will adapt the PR accordingly |
Component(s)
pkg/ottl
What happened?
Description
Currently, when setting the
depth
to0
, slices at the top level of the input of theflatten
function will still be flattened.Steps to Reproduce
Consider the following input for the
flatten
function:And use the
flatten
function with a depth of0
:Expected Result
According to the docs, there should be no flattening when the depth is set to
0
, i.e. the input should be left unchanged:Actual Result
The slice elements are flattened, regardless of the
depth
Collector version
v0.112.0
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
No response
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: