-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add OTTL delete function #44053
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
Add OTTL delete function #44053
Conversation
|
|
|
Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib. Important reminders:
A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better! |
25a241a to
fe95cef
Compare
55d8843 to
316040b
Compare
d68385d to
e3262c8
Compare
d7ee9cf to
d391aad
Compare
…ve time while managing allocations
d391aad to
b27591a
Compare
|
@TylerHelmuth @evan-bradley @bogdandrutu Please take a look once you get a chance. Thanks! |
Co-authored-by: Edmo Vamerlatti Costa <11836452+edmocosta@users.noreply.github.com>
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
|
Sorry for the delay @alexcams. We are determining how we want to name this function, and there are extra considerations involved in which name we ultimately go with. @edmocosta or I will give you an update as soon as we are able. |
|
@evan-bradley Don't worry :) Naming can be challenging sometimes and I think |
|
Hi @alexcams! Just to give you some context, we're considering a few renaming/standardization for slices/maps functions, but to not delay this PR that much, we agreed on the |
|
/rerun |
evan-bradley
left a comment
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 @alexcams!
|
Thank you for your contribution @alexcams! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. If you are getting started contributing, you can also join the CNCF Slack channel #opentelemetry-new-contributors to ask for guidance and get help. |

Description
Added new ottl function
delete_index(target, startIndex, Optional[endIndex]The
delete_indexfunction removes elements from a slice. It deletes elements in the range[startIndex, endIndex)(startIndex inclusive, endIndex exclusive). IfendIndexis not provided, only the element attarget[startIndex]is deleted. IfstartIndexequalsendIndex, no changes are applied to the target, following the behavior of Go'sslices.Delete(s, i, j)function.It accepts any OTTL array type, including arrays with different type of data.
Implemented this as a function modifying target rather than converter returning merged arrays
This implementation doesn't delete duplicate values, could be added in the future or implemented as a separated function.
Note Following golang Slices.Delete() function behavior, any case where index out of bouds ( i < 0 || (i+len) > size(slice)) will return an error.
Link to tracking issue
Closes #43098
Testing
Added unit tests with intended behavior.
Tested manually with following config:
Output:
Documentation
Updated README.md