Skip to content
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] Split ConvertCase function to explicit functions for each case #32942

Open
krokwen opened this issue May 8, 2024 · 5 comments · May be fixed by #37162
Open

[pkg/ottl] Split ConvertCase function to explicit functions for each case #32942

krokwen opened this issue May 8, 2024 · 5 comments · May be fixed by #37162
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed pkg/ottl priority:p3 Lowest

Comments

@krokwen
Copy link

krokwen commented May 8, 2024

Component(s)

pkg/ottl

Is your feature request related to a problem? Please describe.

ConvertCase function accepts StringGetter first argument and could be used as converting function in functions like replace_all_patterns, but it requires the second argument, that makes impossible to use it in such case

Describe the solution you'd like

ToLowerCase("String") instead of ConvertCase("String", "lower")
ToUpperCase("String") instead of ConvertCase("String", "upper")
ToSnakeCase("String") instead of ConvertCase("String", "snake")
ToCamelCase("String") instead of ConvertCase("String", "camel")

Describe alternatives you've considered

No response

Additional context

Currently (using a bug, #32895 #32896) I use a SHA1 function with replace_all_patterns as fastest available option to convert the value under matching key, but i believe, case converting will be much faster, please correct me if i'm wrong

@krokwen krokwen added enhancement New feature or request needs triage New item requiring triage labels May 8, 2024
Copy link
Contributor

github-actions bot commented May 8, 2024

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@fede843
Copy link

fede843 commented Jun 18, 2024

Hi, ended up here looking for something like:

  `replace_all_patterns(attributes, "key", "http.request.header.(.+)", "$0", ConvertCase)`,

I actually would like to set those attributes all to lowercase. Since ConvertCase has an extra arg I cannot do it.
I have also noticed, for sake of testing, that even with SHA1 as function, that changed the value. I would have expected the key to be replaced. Related to #32895 #32896 mentioned above

Copy link
Contributor

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.

@TylerHelmuth
Copy link
Member

@evan-bradley and I talked and we are ok with splitting into several functions

@odubajDT
Copy link
Contributor

odubajDT commented Jan 13, 2025

Hi, I would like to handle this issue. Additional note here: It wasn't explicitly stated here, but to avoid breaking change I guess we would keep the ConvertCase and mark it as orphaned? Or rather keep it as it is, as it can serve different use cases. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed pkg/ottl priority:p3 Lowest
Projects
None yet
6 participants