Closed krokwen closed 4 weeks 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.
This issue highlights a downside to our current type system. While it makes it really easy for functions to enforce specific types are passed in via Getters and error appropriately, it is difficult to chain converters if the return types don't match of, or in this case where we strictly expect a StringGetter
.
If we update https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/7f2b1b4f7538478ca66fea0a27c55c3fd9209ec4/pkg/ottl/ottlfuncs/func_replace_pattern.go#L24 to be a StringLikeGetter
then we have to update the hashing functions to use StringLikeGetter
which isn't great either.
We need a way for StandardStringLikeGetter
to implement StringGetter
so it can be used in both places since it returns a string.
But also I would consider the way you're using function
a bug. I think we should patch that once we have a real solution for https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/32896. In my opinion the expected outcome of using function or replacePattern in replace_all_patterns with mode=key should be to run the new key value through the function.
@rnishtala-sumo curious on your thoughts.
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.
This issue has been closed as inactive because it has been stale for 120 days with no activity.
Component(s)
pkg/ottl
What happened?
Description
Is want just to replace value in matching keys with 'redacted' string (sanitizing logs), But i can only replace it with hashsum of the replacement string. I want to use the 'String' function instead 'SHA1' to just implement this operation with one string without wasting time on hash calculation
Steps to Reproduce
using
replace_all_patterns(attributes, "key", ".*token.*", "redacted", String)
with transform processor crashes the collector when operation executes (nested bug: such things have to be caught on config validation step) that it's not possible to use StringLikeGetter interface function and it's have to be StringGetter interfaceExpected Result
replace_all_patterns accepts StringLikeGetter interface function (String function) and just replaces all values in matching keys
Actual Result
Collector version
v0.99.0
Environment information
Environment
OS: Ubuntu 22.04.3
OpenTelemetry Collector configuration
Log output
Additional context
I have to use the converting function in
replace_all_patterns
due to it's behavior - it just renaming keys if function is not specified, but with function specified it replacing value in the matching keys. See #32896