Skip to content

[pkg/ottl] update IsMatch to convert bool, double, and int to string. #16434

Closed
@TylerHelmuth

Description

Component(s)

pkg/ottl

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

The IsMatch function, which is an important function for OTTL conditions, very strictly expects a string to be returned from its Getter otherwise the function returns nil. Since this function is commonly used with attributes, it often comes across non-string types.

Describe the solution you'd like

The function should be updated to convert "easy" types to string. I think we should start with bool, double, and int.

Describe alternatives you've considered

Add a String factory function that knows how to convert a type to a string. This is a useful function and I think should exist, but the ergonomics of including String with every attribute use with IsMatch seems bad. I think it is reasonable for the IsMatch function to handle this situation on its own.

Additional context

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions