Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

tracing-appender: Introduce weekly rotation #3218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

NickCaplinger
Copy link

Motivation

While configuring tracing-appender, I wanted to specify a weekly log rotation interval. I was unable to do so, as the largest rotation interval was daily.

Solution

Before my introduction of weekly log rotation, rounding the current OffsetDateTime was straightforward: we could simply keep the current date and truncate part or all of the time component. However, we cannot simply truncate the time with weekly rotation; the date must now be modified.

To round the date, I take its ordinal (how many days have passed since the start of the year) and round it backwards to the nearest 7 day period. This gives us consistent date-times that only change weekly.

@NickCaplinger NickCaplinger requested a review from a team as a code owner February 17, 2025 19:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant