Skip to content

Support function composition in expressions #6322

@dlvenable

Description

@dlvenable

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

My suggestion to solve #6278 is to provide a toJsonString() function that a pipeline author could provide into length() to get the length of an event when serialized as a JSON string.

This is not currently possible because Data Prepper expressions do not allow composing functions.

This can be useful for other functions. Some possible examples:

  • Get the length of a joined string: length(join(/names))
  • Make a decision if a metadata field starts with a certain substring: startsWith(getMetadata("mymetadata"), "someprefix")

Describe the solution you'd like

Update Data Prepper expressions to support function composition:

f(g(x))

Describe alternatives you've considered (Optional)

N/A

Additional context

Proposal to use this feature for a current ask:

#6278 (comment)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions