Skip to content

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.

@TylerHelmuth TylerHelmuth merged commit fd58338 into open-telemetry:main Dec 18, 2023
@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 <[email protected]>
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