-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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] Allow replace_all_patterns function to accept not only StringGetter interface function but also StringLikeGetter #32895
Comments
Pinging code owners:
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 If we update
StringLikeGetter then we have to update the hashing functions to use StringLikeGetter which isn't great either.
We need a way for |
But also I would consider the way you're using |
@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 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 #32896The text was updated successfully, but these errors were encountered: