Description
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
Currently OTTL statements are independent of any context. Users must tell OTTL the context in which the statement is should be run.
This results in OTTL statements not being directly portable between components. Unless the config implementing OTTL is the same between components, the OTTL statement may not be able to be copied from one component to another.
If the OTTL statement expresses the context itself then there is no ambiguity and the statement would mean the same thing in any component.
Describe the solution you'd like
Update OTTL statements to express the context, probably via the path names. When parsing the statement, infer the context to be the lowest context defined in the statement.
The Parser needs updated to be told which contexts to consider. To start, one implementation would be to try parsing the statement in each context, starting with the "highest" context. The first context to pass parsing is used.
Describe alternatives you've considered
No response
Additional context
No response