-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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]: Add a new Function Getter to the OTTL package, to allow passing Converters as literal parameters #24356
[pkg/ottl]: Add a new Function Getter to the OTTL package, to allow passing Converters as literal parameters #24356
Conversation
84f469c
to
523b2e0
Compare
523b2e0
to
7f72ca4
Compare
@rnishtala-sumo can you add some tests to |
@evan-bradley this issue is certainly complicated. I want to make sure we're still on track with the right idea, can you take a look. |
Sure thing. I have a few ideas, but I want to validate them before I endorse anything. I'll take a look hopefully in the next day or two and report back here. |
@TylerHelmuth I pushed an update and described the steps here: #24356 (comment) I also added a test for the new |
90df6ae
to
46b677d
Compare
Here's a draft implementation of |
@evan-bradley The approach you're suggesting makes sense to me. I like the way that the function is being created and returned here, ready for evaluation. And then we just pass in the function and evaluate in the hot path. I like it and am definitely on-board with this approach. |
@evan-bradley one question I have about this approach is, how are we resolving from a converter's canonical name to its factory function - for example below
we pass in the canonical name |
The way it's implemented is essentially a stripped down version of |
@evan-bradley would you like to add to this commit and raise a PR or could I prepare a new PR with this approach along with tests? @TylerHelmuth are you in agreement with Evan's approach? |
Go for it. Feel free to use anything from my commit. |
I don't have the bandwidth to review this PR in depth today, but @evan-bradley is OTTL's function wizard, so I'm good with whatever he's suggesting. |
b1d1a99
to
9b744ff
Compare
132e723
to
0ae9be3
Compare
@TylerHelmuth @evan-bradley all the tests seem to indicate that these changes should work. Please let me know if you find anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rnishtala-sumo thank you for working on this and sticking with it! Definitely a complicated addition.
0e8c80c
to
834f814
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your persistence in working on this. I'd say we're really close.
@rnishtala-sumo After reviewing your changes, I realized that the |
@evan-bradley I would like to get this in with the struct tag and let any breaking changes introduced by removing the 'ottlarg` struct tag be its own PR. While I agree that relying on the top-down ordering of fields might make struct tags redundant, I'm not sure if that should hold up this PR. |
That's good with me, let's continue as planned. |
371c565
to
002f549
Compare
002f549
to
cdb98ae
Compare
…assing Converters as literal parameters
…tatement to initialize an editor
…guments up front and only its evaluation is in the hot path
…ilt by the parser
cdb98ae
to
36c98f3
Compare
Description: Add a new Function Getter to the OTTL package, to allow passing Converters as literal parameters
Link to tracking Issue:
Testing: Added a unit test and also tested the following configuration
A tentative example of how the literal function gets invoked is