- Notifications
You must be signed in to change notification settings - Fork807
tracing-appender: Introduce weekly rotation#3218
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
tracing-appender: Introduce weekly rotation#3218
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you for your PR!
In general this looks good. However, I think that we should reconsider the way we pick the beginning of the week (see comment).
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks good. I think this scheme makes more sense.
One last thing is that I think we should clarify whether it's the start of Sunday UTC or local time.
Thanks!
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks good. Thank you!
CI is failing, but I think this branch just needsmaster
merged in to fix that.
I merged
This appears to be unrelated to my change. For what it's worth,#3237 is an open PR that mentions this problem. How should we proceed? |
I've created a separate PR to fix these issues#3292, once that's merged you can pull in the latest changes and this PR should go green too. |
d81a69e
intotokio-rs:masterUh oh!
There was an error while loading.Please reload this page.
Thank you, Hayden! Have a great weekend |
## MotivationWhile configuring tracing-appender, I wanted to specify a weekly logrotation interval. I was unable to do so, as the largest rotationinterval was daily.## SolutionBefore my introduction of weekly log rotation, rounding the current`OffsetDateTime` was straightforward: we could simply keep the currentdate and truncate part or all of the time component. However, we cannotsimply truncate the time with weekly rotation; the date must now bemodified.To round the date, we roll logs at 00:00 UTC on Sunday. This gives usconsistent date-times that only change weekly.
## MotivationWhile configuring tracing-appender, I wanted to specify a weekly logrotation interval. I was unable to do so, as the largest rotationinterval was daily.## SolutionBefore my introduction of weekly log rotation, rounding the current`OffsetDateTime` was straightforward: we could simply keep the currentdate and truncate part or all of the time component. However, we cannotsimply truncate the time with weekly rotation; the date must now bemodified.To round the date, we roll logs at 00:00 UTC on Sunday. This gives usconsistent date-times that only change weekly.
## MotivationWhile configuring tracing-appender, I wanted to specify a weekly logrotation interval. I was unable to do so, as the largest rotationinterval was daily.## SolutionBefore my introduction of weekly log rotation, rounding the current`OffsetDateTime` was straightforward: we could simply keep the currentdate and truncate part or all of the time component. However, we cannotsimply truncate the time with weekly rotation; the date must now bemodified.To round the date, we roll logs at 00:00 UTC on Sunday. This gives usconsistent date-times that only change weekly.
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.