Skip to content

[pkg/ottl] Use a setter for Split() #39686

@rockdaboot

Description

@rockdaboot

Component(s)

pkg/ottl

What happened?

Description

The profiles signal uses indices + lookup table instead of an array or map.

For example, pprofile.Profile contains a lookup table of attributes (AttributeTable), which is referenced by an array of indices (AttributeIndices).

During the work on the transformprocessor ([draft PR(https://github.com/https://github.com//pull/39036)), it turned out that a typical accessor/getter for attributes would return a pcommon.Map.

Problem

The Split() function doesn't call the target's setter function, so the result is effectively discarded in case of profile attributes.

It means that
set(attributes["test"], Split(attributes["flags"], "|"))
works for logs and metrics, but not for profiles.

Related: #39100

Steps to Reproduce

Expected Result

Updated attributes, tests succeed.

Actual Result

Attributes stay unchanged, tests fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageNew item requiring triagepkg/ottl

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions