-
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] Add an ottl function that allows for the trimming of whitespaces or other specified symbols from an attribute #34100
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@robbavey Thanks for the thorough proposal. Can you go into any detail about the situations you've seen where you've had to do trimming like this? As for a |
@evan-bradley In general, I'm an advocate of simplicity for users, and removing places where they can accidentally craft an incorrect, or poorly performing regex (eg supplying an unanchored regex). We see use of it a decent amount in Elasticsearch ingest pipelines used in Elastic integrations |
Hi, is this ticket free for grab? Or it needs more discussion if it's worth implementing? I find it as a good idea |
I believe this function meets the criteria of https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/ottlfuncs/README.md#adding-new-editorsconverters and could be worked on. It should use |
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. |
I really dislike bots that close issues (especially after 60 days which isn't that long at all) |
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
I would like a simple way to trim whitespace from an attribute
Describe the solution you'd like
I would like to be able to trim data from an existing attribute
For example
A field
test
exists in an event, which contains the string " this is a test ".I would like to be able to transform this using an ottl function
trim
, that I would define astrim(attribute["test"])
, which would trim this down to "this is a test".By default, this would use the unicode definition of whitespace, but we would also allow an alternative version
trim(attribute, symbols)
I would also like to be able to set my own definition of whitespace, by providing a string containing the symbols I would like to trim.
Describe alternatives you've considered
A user could do this using the existing
replace_all_patterns
function, but this is a common enough function that it may warrant a standalone function. Additionally, we can be unambiguous that we replace the Unicode definition of whitespace by default.Additional context
No response
The text was updated successfully, but these errors were encountered: