-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[pkg/ottl] Fix OTTL functions by using setters #39416
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
base: main
Are you sure you want to change the base?
Conversation
13994d2
to
83fe3d3
Compare
0ac9801
to
6a2fc36
Compare
2584f30
to
409957f
Compare
@TylerHelmuth Can you please also review #39657, which became a requirement for this PR? |
…y#39657) #### Description Adds PMapGetSetter interface and StandardPMapGetSetter to improve type-safety in OTTL functions. Split out of open-telemetry#39416 where this changes are already in use.
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
For useful profiles based e2e tests, we first should merge #39681, because the current e2e tests heavily rely on attributes accessors. Without attributes processors, e2e test would look completely different to the logs based e2e tests. That's a) hardly to compare and b) lot of work and c) more code to maintain (no de-duplication of code possible). |
I agree it would have more value testing the editors with the paths that makes the profile context different, such as the Before moving forward with this one, I really think we should add a few more tests cases to ensure that the problem this PR fixes won't happen again. We can do that by verifying that the setter function was actually called, and that the result is correct not just because the editor is directly modifying the object reference, but also because of setter call. |
Added a check that the setter got actually called. This still doesn't check whether the editor was directly modifying the object as well. @edmocosta Would is the preferred way of doing that? |
We currently don't have any efficient mechanism to enforce the immutability of those returned maps - and my PData PR got some pushback - so I think it would be fine to keep it as it's for now, and tackle it later when we decide how to deal with that in the OTTL core. @TylerHelmuth please let me know if you agree with this, and with moving this PR forward. Thanks! |
@edmocosta @TylerHelmuth We now have OTTL e2e tests based on profiles. |
Description
Some OTTL functions do not call the accessor.setter function, but instead change the variable directly.
This doesn't work with the profiles signal where non-trivial processing is needed.
For example, attributes are split into a lookup table and arrays of indices (the rationale is de-duplication). While the accessor.getter function returns a pcommon.Map for attributes, any changes made to that map require passing the map to the accessor.setter function.
Link to tracking issue
Fixes #39100
Testing
Documentation