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] Validate that all path elements are used #30042

Merged
merged 5 commits into from
Dec 18, 2023

Conversation

TylerHelmuth
Copy link
Member

Description:
Updates OTTL to be able to detect when a context has not used all parts of a path and its keys. It only validates that each path/key was grabbed - it cannot validate that the context used the value "correctly".

An example error message, taken from the unit test, looks like:

error while parsing arguments for call to "testing_getsetter": invalid argument at position 0: the path section "not-used" was not used by the context - this likely means you are using extra path sections

Link to tracking Issue:
Closes #22744

Testing:
Added new unit tests

@TylerHelmuth TylerHelmuth requested a review from a team December 18, 2023 17:09
@TylerHelmuth TylerHelmuth changed the title Validate that all path elements are used [pkg/ottl] Validate that all path elements are used Dec 18, 2023
Copy link
Contributor

@evan-bradley evan-bradley left a comment

Choose a reason for hiding this comment

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

This is great stuff, nice work.

.chloggen/ottl-valid-path-used.yaml Outdated Show resolved Hide resolved
pkg/ottl/functions.go Outdated Show resolved Hide resolved
TylerHelmuth and others added 2 commits December 18, 2023 11:35
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
@TylerHelmuth TylerHelmuth merged commit fd58338 into open-telemetry:main Dec 18, 2023
85 checks passed
@TylerHelmuth TylerHelmuth deleted the ottl-valid-path-used branch December 18, 2023 19:11
@github-actions github-actions bot added this to the next release milestone Dec 18, 2023
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jan 10, 2024
…0042)

**Description:** 
Updates OTTL to be able to detect when a context has not used all parts
of a path and its keys. It only validates that each path/key was grabbed
- it cannot validate that the context used the value "correctly".

An example error message, taken from the unit test, looks like:

```
error while parsing arguments for call to "testing_getsetter": invalid argument at position 0: the path section "not-used" was not used by the context - this likely means you are using extra path sections
```

**Link to tracking Issue:**
Closes
open-telemetry#22744

**Testing:**
Added new unit tests

---------

Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pkg/ottl] Validate that all parts of a path are used by a Context
3 participants