-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 support for lists as Getter values #16338
[pkg/ottl] Add support for lists as Getter values #16338
Conversation
@TylerHelmuth This implementation is different than what we discussed, but will allow for using paths and invocations in lists. The downside is that the lists can be probably unnecessarily complicated, and we can't easily enforce that they are homogeneous, which is required by the specification for Attribute values. There are other places in the OTTL where users can cut themselves, so this seemed like an acceptable tradeoff. |
@evan-bradley I wasn't aware that array values for an attribute had to be homogenous. I was checking the spec earlier for something I was working on and this section reads to me like arrays can be a mix of values. |
This is definitely needed, good catch. |
When working on this, I found two places where the proto
I would prefer that the Collector didn't intentionally emit any data in a format that would be disallowed for an OpenTelemetry language API, since it is likely for data that isn't spec-compliant to be handled inconsistently or simply dropped by backends. I don't think the Collector is technically bound to abide by the specification to that degree, so I don't think we are required to do anything in this case. I think if we do decide to validate that attributes are only set to homogeneous arrays, we should probably do it in the contexts. |
02f931f
to
b815e4b
Compare
Good info, thanks for pointing out those API requirements. I agree, we should follow the spec so we don't produce any invalid data. I agree that the contexts should be the enforcers. Within the contexts there are no Getters, just values, so it should be easy to check and enforce. Can you open an issue to track this enforcement? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
See #16355. |
Needs a rebase |
e7b6189
to
cb69ade
Compare
Add support for lists as Getter values Co-authored-by: Evan Bradley <[email protected]>
Description:
Allow using lists as a Getter value. This implementation implements a
listGetter
struct that allows recursively evaluating list elements, which allows putting paths and invocations in lists.Link to tracking Issue:
Fixes #16320
Testing:
Added unit tests to check for this functionality at multiple levels.
Documentation:
The existing docs should cover this functionality.