Open
Description
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
We currently have tests for all OTTL contexts paths accessors, but those tests are not considering the different data type OTTL can use to set the value.
Slices for example, can get the following value types:
[]any
when set from literals[]T
when copied from another pathpcommon.Slice
when copied from an map's key value
Most of the assessor's setter are type asserting the value before setting it, for example:
Setter: func(_ context.Context, tCtx K, val any) error {
if v, ok := val.([]int32); ok {
tCtx.GetProfile().CommentStrindices().FromRaw(v)
}
return nil
},
The above code would pass the test if we only test the assessors using a well-known []int32 value, but when it in fact runs, the setting operation might fail due to:
- Wrong type assertion, given pdata values have no specific types for []int32 and everything is any-wrapped
- OTTL uses
int64
under the hood for literal numbers val
might be apcommon.Slice
Describe the solution you'd like
To ensure it really works with the grammar and all OTTL stuff, we need to add some integration tests, that under the hood parses a statement setting a path (all possible types), and then validate if the path value was properly set.
Describe alternatives you've considered
No response
Additional context
No response