-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[pkg/ottl] Support for data retrieval OTTL expressions #35621
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
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I am confused as retrieving data is the job of a OTTL path, such as |
@TylerHelmuth you are right, it should be a job of OTTL path. In addition, the solution I propose is also not good. The problem I am trying to solve is to allow a component to accept data retrieval as OTTL expressions which requires the ability to parse and evaluate the data retrieval expressions. Let me rephrase the issue. |
@TylerHelmuth Apologies about the half-baked issue before, I have updated the issue and the description now. Let me know if it makes sense. |
I dont see yet why OTTL is needed for this. A component has access to the data and can manipulate it as needed - it does not need OTTL to provide it access. If you want users to be able to express how the data should be manipulated that sounds like the transformprocessor. |
The objective is not exactly data manipulation by specific components but rather giving components the ability to extract data from the raw signals using user-defined configuration. While For a more tangible example, I'm developing a connector that generates metrics from various signal types according to user-defined configurations. These configs consist of OTTL expressions that specify how to extract values from the original signals to form the new metrics — essentially parsing the OTTL values. Maybe it is possible to club together a pipeline that could accomplish something similar, I believe support for parsing and evaluating OTTL values would allow far more flexible components and probably a better-optimized pipeline. |
Setting data manipulation aside for the moment, the field names and access patterns established by OTTL are effectively the user-facing standard way to refer to values within our telemetry. It makes sense to me that we would want other components to use the same names and expect the same results. The alternative is that component authors invent a variety of ways to refer to and retrieve values, which leads to fragmentation and inconsistency. |
@TylerHelmuth I agree with what @djaglowski says. We already have this with the filter processor and routing connector, where users can use OTTL conditions to implicitly call a single Editor:
I think we should also try to enable this case generally for Converters/paths that don't result in a boolean value. Similar to above, this might look like:
I think there's value in not requiring components to create an undocumented Editor and modify the OTTL statement text to include it, like we had with the filter processor and routing connector prior to providing a Condition parser. |
I talked with @evan-bradley about this and I think I now understand what is being asked. The goal is to be able to evaluate an OTTL expression, such as This feels doable and will require new API similar to If someone wants to take this on the solution will likely follow the pattern |
@evan-bradley @TylerHelmuth I'd like to look into implementing this |
@bacherfl Really appreciate you taking this one on, it's yours. |
@evan-bradley @TylerHelmuth I think I have a first draft for this ready in #36883 - When you have some time, may I ask for an initial review to see if this goes into the right direction? |
… the signal context (#36883) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR adds a new `ParseValueExpression` method to the OTTL parser which allows users of this package to extract data from the context using OTTL <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #35621 <!--Describe what testing was performed and which tests were added.--> #### Testing Added unit and e2e tests <!--Describe the documentation added.--> #### Documentation Added godoc comments for the added methods and types <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: Evan Bradley <[email protected]> Co-authored-by: Tyler Helmuth <[email protected]>
… the signal context (open-telemetry#36883) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR adds a new `ParseValueExpression` method to the OTTL parser which allows users of this package to extract data from the context using OTTL <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#35621 <!--Describe what testing was performed and which tests were added.--> #### Testing Added unit and e2e tests <!--Describe the documentation added.--> #### Documentation Added godoc comments for the added methods and types <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: Evan Bradley <[email protected]> Co-authored-by: Tyler Helmuth <[email protected]>
…eValueExpression (#38101) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description The component was using an internal `get` OTTL function as a stop gap measure to extract value from OTTL expressions due to lack of such function from the core OTTL library. With #35621, support for data extraction using OTTL value expressions was introduced. This PR uses the `ParseValueExpression` method and drops the `get` OTTL function. The function was documented in README as internal function and strictly advised not to be used in configurations so I don't expect any issues. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #38098 <!--Describe what testing was performed and which tests were added.--> #### Testing Unit tests are passing <!--Describe the documentation added.--> #### Documentation README is updated <!--Please delete paragraphs that you did not use before submitting.--> --------- Co-authored-by: Andrzej Stencel <[email protected]>
… the signal context (open-telemetry#36883) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR adds a new `ParseValueExpression` method to the OTTL parser which allows users of this package to extract data from the context using OTTL <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#35621 <!--Describe what testing was performed and which tests were added.--> #### Testing Added unit and e2e tests <!--Describe the documentation added.--> #### Documentation Added godoc comments for the added methods and types <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Florian Bacher <[email protected]> Co-authored-by: Evan Bradley <[email protected]> Co-authored-by: Tyler Helmuth <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
The ability for components to be able to retrieve data from underlying telemetry using OTTL expressions. As of now, the
pkg/ottl
provides methods for parsing and evaluating statements and conditions. There seems to be no support for parsing and evaluating paths as well as converters that would define data retrieval expressions. For example:end_time - start_time
Microseconds(end_time - start_time)
Allowing retrieval of values using OTTL would help build more generic components. One example use case would be generating metrics from all types of telemetry signals - imagine being able to generate histograms from logs based on attributes as well as spans based on span duration using the same connector. OTTL expressions can be used in this case to extract the data and construct metrics.
Describe the solution you'd like
pkg/ottl
to support parsing and evaluating OTTL expressions for data retrieval and conversion.Describe alternatives you've considered
As a temporary hack, using a
get
OTTL editor to parse data retrieval expressions as OTTL statements refAdditional context
No response
The text was updated successfully, but these errors were encountered: