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] Commonize logic for handling slice and non-slice args #16298

Merged

Conversation

evan-bradley
Copy link
Contributor

Description:

I discovered while adding logging in functions that the incorrect index was being used to get the invocation argument value for slice parameters, which caused an error when a function factory had an internal type as a parameter.

This commonizes a lot of the behavior between the buildArg and buildSliceArg methods and makes it so they don't have to handle indexing the invocation arguments list. Since the invocation object and argument index aren't passed to many of the functions anymore, I've also reworded some error messages to make sure a user knows the full context of an error.

Testing:

Modified the existing tests to cover the internal argument case. All tests still pass.

Copy link
Member

@TylerHelmuth TylerHelmuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evan-bradley thanks for taking care of this bug. I would love so much to get rid of the need for DSLArgumentIndex someday and just ensure all functions have access to settings via some deterministic way.

@TylerHelmuth TylerHelmuth added the ready to merge Code review completed; ready to merge by maintainers label Nov 15, 2022
@bogdandrutu bogdandrutu merged commit ff84e0e into open-telemetry:main Nov 15, 2022
JaredTan95 pushed a commit to openinsight-proj/opentelemetry-collector-contrib that referenced this pull request Nov 21, 2022
…n-telemetry#16298)

* Commonize logic for handling slice and non-slice args

* Add PR number for issue reference

Co-authored-by: Evan Bradley <evan-bradley@users.noreply.github.com>
shalper2 pushed a commit to shalper2/opentelemetry-collector-contrib that referenced this pull request Dec 6, 2022
…n-telemetry#16298)

* Commonize logic for handling slice and non-slice args

* Add PR number for issue reference

Co-authored-by: Evan Bradley <evan-bradley@users.noreply.github.com>
@plantfansam plantfansam mentioned this pull request Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/ottl ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants