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] Support Minute/Day/Month/Year for time.Time's in OTTL #33106

Closed
sinkingpoint opened this issue May 17, 2024 · 3 comments
Closed

[pkg/ottl] Support Minute/Day/Month/Year for time.Time's in OTTL #33106

sinkingpoint opened this issue May 17, 2024 · 3 comments
Labels
enhancement New feature or request pkg/ottl priority:p2 Medium

Comments

@sinkingpoint
Copy link
Contributor

sinkingpoint commented May 17, 2024

Component(s)

pkg/ottl

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

Under #29468 we currently support Hour as a method to get the Hour from a time.Time , but we don't support any other converters to get the other components of the time.

Specifically, I want the day/month/year so that I can use the new grouping support in the file exporter to output "$day/$month/$year.log" files

Describe the solution you'd like

We should fill in the other components, mapping to the Minute, Day, Month, and Year methods that go supports on time.Times

Describe alternatives you've considered

No response

Additional context

No response

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

Pinging code owners:

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

@TylerHelmuth TylerHelmuth added priority:p2 Medium and removed needs triage New item requiring triage labels May 20, 2024
TylerHelmuth pushed a commit that referenced this issue May 22, 2024
**Description:**

This adds in a `Year` converter that takes a `time.Time` and returns the
int month component. Analogous to what we already have with `Hour`

**Link to tracking Issue:** #33106

**Testing:** Added two unit tests based on the existing `Hour` ones

**Documentation:** Added the new converter to the ottlfuncs README.md

---------

Signed-off-by: sinkingpoint <colin@quirl.co.nz>
TylerHelmuth pushed a commit that referenced this issue May 22, 2024
**Description:**

This adds in a `Month` converter that takes a `time.Time` and returns
the int month component. Analogous to what we already have with `Hour`

**Link to tracking Issue:** #33106

**Testing:** Added two unit tests based on the existing `Hour` ones

**Documentation:** Added the new converter to the ottlfuncs README.md

---------

Signed-off-by: sinkingpoint <colin@quirl.co.nz>
evan-bradley added a commit that referenced this issue May 22, 2024
**Description:**

This adds in a `Day` converter that takes a `time.Time` and returns the
int day component. Analogous to what we already have with `Hour`

**Link to tracking Issue:** #33106

**Testing:** Added two unit tests based on the existing `Hour` ones

**Documentation:** Added the new converter to the ottlfuncs README.md

---------

Signed-off-by: sinkingpoint <colin@quirl.co.nz>
Co-authored-by: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com>
Co-authored-by: Evan Bradley <11745660+evan-bradley@users.noreply.github.com>
@TylerHelmuth
Copy link
Member

@sinkingpoint do you want to do one more for Minute?

@sinkingpoint
Copy link
Contributor Author

Yep! #33200

evan-bradley pushed a commit that referenced this issue May 28, 2024
**Description:**

This adds in a Minute converter that takes a time.Time and returns the
int minute component. Analogous to what we already have with Hour

**Link to tracking Issue:**
#33106

**Testing:** Added two unit tests based on the existing Hour ones

**Documentation:** Added the new converter to the ottlfuncs README.md

---------

Signed-off-by: sinkingpoint <colin@quirl.co.nz>
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