open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.11k stars 2.39k forks source link

feat(ottl): Add a new ottl trim function that trims leading and trailing whitespace from a string #36400

Open rnishtala-sumo opened 1 week ago

rnishtala-sumo commented 1 week ago

Description

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 as trim(attribute["test"]), which would trim this down to "this is a test".

Link to the issue - https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/34100

TylerHelmuth commented 1 week ago

@rnishtala-sumo can you add to the description the issue this PR closes