Skip to content

[pkg/ottl] Replace key when using function #38626

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

Merged

Conversation

panys9
Copy link
Contributor

@panys9 panys9 commented Mar 13, 2025

Description

When using the replace_all_patterns with mode set to "key" like replace_all_patterns(cache, "key", "^(.*)$", "$$1", ToSnakeCase). This caused the value to be replaced instead of the key. By replacing the statement updating the value it now work as expected. At least this is how I interpret this function to work.

Link to tracking issue

#32896

Testing

Added unit test for this scenario since it was missing.

Documentation

panys9 added 2 commits March 14, 2025 00:03
Signed-off-by: Patrik Nyström <[email protected]>
Signed-off-by: Patrik Nyström <[email protected]>
Copy link
Contributor

github-actions bot commented Apr 1, 2025

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Apr 1, 2025
@panys9
Copy link
Contributor Author

panys9 commented Apr 1, 2025

Hi @djaglowski,
Can I get a review on this PR please?

@github-actions github-actions bot removed the Stale label Apr 2, 2025
@TylerHelmuth TylerHelmuth merged commit 1295171 into open-telemetry:main Apr 10, 2025
171 checks passed
@github-actions github-actions bot added this to the next release milestone Apr 10, 2025
akshays-19 pushed a commit to akshays-19/opentelemetry-collector-contrib that referenced this pull request Apr 23, 2025
#### Description

When using the `replace_all_patterns` with mode set to `"key"` like
`replace_all_patterns(cache, "key", "^(.*)$", "$$1", ToSnakeCase)`. This
caused the value to be replaced instead of the key. By replacing the
statement updating the value it now work as expected. At least this is
how I interpret this function to work.

#### Link to tracking issue

open-telemetry#32896

#### Testing

Added unit test for this scenario since it was missing.

#### Documentation

---------

Signed-off-by: Patrik Nyström <[email protected]>
Fiery-Fenix pushed a commit to Fiery-Fenix/opentelemetry-collector-contrib that referenced this pull request Apr 24, 2025
#### Description

When using the `replace_all_patterns` with mode set to `"key"` like
`replace_all_patterns(cache, "key", "^(.*)$", "$$1", ToSnakeCase)`. This
caused the value to be replaced instead of the key. By replacing the
statement updating the value it now work as expected. At least this is
how I interpret this function to work.

#### Link to tracking issue

open-telemetry#32896

#### Testing

Added unit test for this scenario since it was missing.

#### Documentation

---------

Signed-off-by: Patrik Nyström <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants