-
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
[processor/transform] Add drop function to the transform processor #16297
Conversation
e20bc7a
to
e3ba42f
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.
I think this looks good, I've added a couple of non-blocking queries.
a70c058
to
dc5531b
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.
LGTM.
It's too bad this can't be part of OTTL. It seems likely to be representative of class of transformations. I am right in thinking that in order to allow this in OTTL, we'd need the ability to drill down from a context, or contexts specifically at the various slice levels?
@djaglowski Yes that is correct. I think it will be possible to move the transformprocessor's concept of ContextStatements into the OTTL, which would allow We're starting with the ContextStatement concept in the transform processor since it isn't a public api and therefore will be easier to modify the ContextStatement API as we iterate through the concept. |
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.
I have a few minor requests, but overall this is solid. Great to see this finally land.
Co-authored-by: Evan Bradley <[email protected]>
Co-authored-by: Evan Bradley <[email protected]>
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.
Looks good with me 👍🏻
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.
I'm really happy to have this land.
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.
We need this functionality for sure. I have another idea though, can we have a separate processor for this, since it is very dangerous functionality in general?
My preference would be if we can adopt the conditions from ottl in the current filter processor and have the current "filter" processor for this. A second best (maybe easier to implement) we can deprecate filter processor, and create a "dropprocessor".
Kind of disagree, since "dropping" is not a transformation of the telemetry itself :) Also not sure if we need a "re-use" for this functionality. |
@bogdandrutu re this:
It can be, yes, but stepping back a bit .. what are the goals of OTTL in the first place, and does this fit or not fit with those goals? My understanding is that there's a general desire to cut down on the number of bespoke processors so that there's a standard way to specify any number of different kinds of transformations on data in transit. Is dropping certain things not within the purview? If not then maybe it'd be helpful to clarify what is. It's a ton of work to go through and implement this in OTTL only to have to rip it out and try to fit it into another processor. |
I want to reuse everything in OTTL (conditions, etc.) I discussed with @TylerHelmuth, don't believe should be that much work... I may miss something. |
Dropping out of all the functionality is the most dangerous, and the one that I want people to have lots of attention when they use it. Because of that I believe it deserves a different treatment :) |
Here is the start of a PR to see what this is like in the filterprocessor: #16369. I still believe the drop functionality should live in the transform processor (where it can only be used if a statement explicitly uses it), but if it were to live in the filter processor this is how it would look. Things to consider about implementing ottl in the filterprocessor:
|
You do have now to remember that body is JSON, so you need to keep the state between services. I don't understand this, and also as mentioned, I don't think the right design is to have one processor that does everything, will get too messy for configuration and code. Now you changed the iteration to use "RemoveIf", then in the future if we need something else like sorting how would you do?
I still believe this is an edge case.
I don't thing "dropping" resource makes sense at all. Since a "Resource" is not a telemetry.
That needs to happen anyway since we don't want duplicate code. So you want to just add the "fancy" new way, but we still need to do cleanups as maintainers of this codebase. |
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.
Without a clear path to remove filter processor, this new functionality should not be added to not confuse users.
Hmmm. I'd find it very confusing to be able to only get access to a subset of OTTL in the transform processor, but then access to an additional kind of functionality in a different one. That may be "safer", but this kind of non-orthogonality of the language introduces a new cognitive cost for end-users. (this is also getting into the mushy-gushy world of language design, where things are just as touchy-feely and philosophical as they are technical) |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Description:
This PR adds a
drop
function to the transform processor.Removing items from lists is a special type of transformation that the OTTL cannot handle itself via a function. This is because OTTL functions operate on a specific item in a context but
drop
requires access to the slice that the item resides in. For this reason, we move the responsibility of dropping the item to the transform processor itself (utilizing pdata methods).This PR makes the following assumptions:
drop
is the only OTTL function with a return value that the transform processor cares about. This assumption may change in the future, but until there is a second identified scenario, this assumption helps keepexecuteStatements
simple.executeStatements
returns an error that means that means we are done executingContextStatements
for the current transform context. If adrop
function appeared lower in theContextStatements
list it will be ignored since it will not be executed. Statements executed before the err will still take affect.Depends on #16251
Link to tracking Issue:
Closes #7151
Closes #13578
Closes #13579
Closes #13580
Closes #13581
Closes #5679
Testing:
Added unit tests
Documentation:
Added drop to the README