Closed sinkingpoint closed 1 month ago
Pinging code owners:
pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley
See Adding Labels via Comments if you do not have permissions to add labels yourself.
I think this makes sense. It should be fairly easy to implement, we already have a untyped getter (ottl.Getter
).
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers
. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself.
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
When using OTTL, it's often useful to be able to construct strings in various ways. We do have a few ways of doing this already (e.g.
Concat
), but nothing as flexible as a genericSprintf
. For example, we have no way of padding ints (%02d
in Sprintf)Describe the solution you'd like
I would like to introduce a new OTTL function,
Sprintf
which takes a format string, and an array of fields, and callsfmt.Sprintf
with those arguments.This would require introducing a new
Getter
which gets a genericinterface{}
, rather than the existing Getters which return concrete types.Describe alternatives you've considered
We can sort of get there with creative uses of
Concat
, but this quickly becomes unruly with complex definitions. e.g. this is one we have:Which would look like:
Additional context
No response