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] Converter Function that is able to create a new time.Duration type from a string. #22015

Closed
Tracked by #16067
TylerHelmuth opened this issue May 16, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium

Comments

@TylerHelmuth
Copy link
Member

TylerHelmuth commented May 16, 2023

In order to facilitate proper time manipulation, arithmetic, and comparison it will be very useful to have Durations.

Create an OTTL Converter Function, probably called Duration, that is able to create a new time.Duration type from a string. Something similar to https://pkg.go.dev/time#ParseDuration can be used.

The function should take 1 parameters, a string (represented as a StringGetter) that represents the duration in Go format, such as 1s for 1 second or 2h for 2 hours or 3m30s for 3 minutes and 30 seconds.

@TylerHelmuth TylerHelmuth changed the title Create a Convert function for handling Durations [pkg/ottl] Converter Function that is able to create a new time.Duration type from a string. May 16, 2023
@TylerHelmuth TylerHelmuth added enhancement New feature or request priority:p2 Medium pkg/ottl labels May 23, 2023
@TylerHelmuth TylerHelmuth changed the title [pkg/ottl] Converter Function that is able to create a new time.Duration type from a string. [pkg/ottl] Converter Function that is able to create a new time.Duration type from a string. May 23, 2023
@fchikwekwe
Copy link
Contributor

@TylerHelmuth please assign me

TylerHelmuth added a commit that referenced this issue Jul 10, 2023
Description: Added a converter function that takes a string
representation of a duration and converts it to a Golang duration.

Link to tracking Issue:
#22015

Testing: Unit tests for stringGetter to duration.

Documentation:

---------

Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium
Projects
None yet
Development

No branches or pull requests

2 participants