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] Add OTTL String Conversion Function #29087

Closed
Mrod1598 opened this issue Nov 9, 2023 · 3 comments
Closed

[pkg/ottl] Add OTTL String Conversion Function #29087

Mrod1598 opened this issue Nov 9, 2023 · 3 comments
Labels

Comments

@Mrod1598
Copy link
Contributor

Mrod1598 commented Nov 9, 2023

Component(s)

pkg/ottl

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

Currently, when trying to convert a value from a float to string the only way I've seen to convert a number value to a string is to use the Concat function.

example parser using OTTL to convert a float into epoch time:

    transform/logging-0__processor1__logs:
        error_mode: ignore
        log_statements:
            - context: log
              statements:
                - set(cache["split"], Split(Concat([attributes["test"]],""), "."))
                - set(cache["seconds"], Concat([cache["split"][0], "s"], ""))
                - set(cache["fractional"], Concat([cache["split"][1], "ms"], ""))
                - set(time, Time("1970-01-01T00:00:00.000000+0000", "%Y-%m-%dT%H:%M:%S.%f%z") + Duration(Concat([cache["seconds"], cache["fractional"]], ""))) 

In the first set function, To ensure we can split on attributes["test"], with the value of 1234456.1234546, representing s.ms, we have to Call Concat to change it from a float to a string.

Describe the solution you'd like

A new function called String takes in a value and converts it into a string if possible.

Describe alternatives you've considered

No response

Additional context

No response

@Mrod1598 Mrod1598 added enhancement New feature or request needs triage New item requiring triage labels Nov 9, 2023
Copy link
Contributor

github-actions bot commented Nov 9, 2023

Pinging code owners:

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

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.

@github-actions github-actions bot added the Stale label Jan 11, 2024
@TylerHelmuth
Copy link
Member

This is a duplicate of #27867.

@TylerHelmuth TylerHelmuth closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants