-
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
[pkg/ottl] Add OTTL context inferrer utility #35721
Merged
evan-bradley
merged 5 commits into
open-telemetry:main
from
edmocosta:ottl-add-context-inferrer-utility
Oct 22, 2024
Merged
[pkg/ottl] Add OTTL context inferrer utility #35721
evan-bradley
merged 5 commits into
open-telemetry:main
from
edmocosta:ottl-add-context-inferrer-utility
Oct 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edmocosta
requested review from
TylerHelmuth,
bogdandrutu,
evan-bradley and
a team
as code owners
October 9, 2024 16:30
6 tasks
Hi @TylerHelmuth! I've addressed your suggestions to under expose the context inferrer impl (c0a8b67). In addition to that, I've also removed the |
TylerHelmuth
approved these changes
Oct 22, 2024
…y' into ottl-add-context-inferrer-utility
TylerHelmuth
approved these changes
Oct 22, 2024
TylerHelmuth
added
the
Skip Changelog
PRs that do not require a CHANGELOG.md entry
label
Oct 22, 2024
evan-bradley
approved these changes
Oct 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is part of #29017, and adds the context inferrer utility into the
ottl
package. This utility will be used by components to infer the context it should use to parse some statements, based only on itsottl.path
's context prefixes.This PR delivers a priority-based
ottl.ContextInferrer
implementation, which chooses the context based on a priority list passed on theottl.NewPriorityContextInferrer
function. It also exposes theottl.DefaultPriorityContextInferrer
function, which creates the same context inferrer type, but using a pre-defined context priorities.For example, given the context priority
["spanevent", "span", "resource"]
, and inferring the context from the statementset(span.foo, resource.value) where spanevent.bar == true
, would result in thespanevent
context, as it has the highest priority.For more details on how it will be used, please have a look at the complete draft implementation.
To discuss
Do we really need to support the NewPriorityContextInferrer
ignoreUnknownContext
argument?I would say yes, considering the inferrer could be used for any purpose, having the capability of ignoring unknown/non-prioritised contexts would be helpful and wouldn't require users to check if the
Infer(..)
function returned an unexpected value.Link to tracking issue
#29017
Testing
Unit tests
Documentation
No changes