Skip to content
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 for slices containing nested objects #36162

Open
bacherfl opened this issue Nov 4, 2024 · 1 comment · May be fixed by #36204
Open

[pkg/ottl] unexpected behavior of flatten function for slices containing nested objects #36162

bacherfl opened this issue Nov 4, 2024 · 1 comment · May be fixed by #36204
Labels
bug Something isn't working pkg/ottl priority:p2 Medium

Comments

@bacherfl
Copy link
Contributor

bacherfl commented Nov 4, 2024

Component(s)

No response

What happened?

Component(s)

pkg/ottl

What happened?

Description

Currently, the flatten function seems to not flatten the attributes of nested objects within a slice, but rather leaves the objects within the slice unchanged.

Steps to Reproduce

Consider the following input for the flatten function:

{
  "things": [
    {
       "name": "a"
    }
  ]
}

And use the flatten function:

flatten(attributes)

Expected Result

The result should be fully flattened:

{
  "things.0.name": "a"
}

Actual Result

The index of the individual objects within the slice is put into the attribute keys (which is expected), however the flattening is not applied to the nested objects:

{
  "things.0": {
    "name": "a"
  }
}

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

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

Copy link
Contributor

Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@evan-bradley evan-bradley removed the needs triage New item requiring triage label Nov 12, 2024
@TylerHelmuth TylerHelmuth added the priority:p2 Medium label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pkg/ottl priority:p2 Medium
Projects
None yet
3 participants