Skip to content

[pkg/ottl] support joining a slice into a string #38690

Open
@gray-oni

Description

@gray-oni

Component(s)

pkg/ottl

Is your feature request related to a problem? Please describe.

It would be great to be able to join a slice of strings/values into a string with a delimiter. I haven't found an easy way to do it with existing converters. (the closest functionality is Concat function but it doesn't support iteration through slice of values)

example: some of the target/exporting systems/platforms may expect input parameter(s) arrive as a string attribute with values separated by delimiter (e.g. Datadog ddtags)

Describe the solution you'd like

Join function should assemble a slice of values into a string with the provided delimiter.
.e.g. usage examples

  • join(attributes["array.attribute"]) (e.g. with default delimiter "," )
  • join(attribute["array.attribute"], ";")

statement example:

  • set(attributes["string.attribute"], join(attributes["array.attribute"], ";"))

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions