Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TylerHelmuth opened this issue Nov 22, 2022 · 0 comments · Fixed by #16503
Closed

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

TylerHelmuth opened this issue Nov 22, 2022 · 0 comments · Fixed by #16503
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium

Comments

@TylerHelmuth
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium
Projects
None yet
1 participant