Skip to content

[pkg/ottl] Allow functions to identify literal value getters #40222

Open
@edmocosta

Description

@edmocosta

Component(s)

pkg/ottl

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

It's currently not possible for functions to identify whether a Getter argument is holding a literal value (ottl.literal), or any other getter type that does not depends on the transformation context to be evaluated.

Not knowing if the argument is a literal forces expensive functions like the IsMatch to only accept static string patterns, so it does not suffer the performance penalty compiling the regex for every single execution. This is a good standard that we probably want to keep, but some functions lacks dynamicity because of that.

Describe the solution you'd like

Providing that information to functions would allow expensive operations such as compiling a regex to continue to be executed once (if it's a literal), but would also allow functions to offer dynamic values support.

Describe alternatives you've considered

No response

Additional context

#39997

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions