Skip to content

Change timeformat to not omit trailing 0s

Craig Miskell requested to merge always-include-ms-in-logs into master

Per https://golang.org/pkg/time/#Time.Format: "If the fraction in the layout is 9s, trailing zeros are dropped."

With 9's, at the top of the second the time printed in logs goes from something like: 2020-09-07 01:02:03.999Z to 2020-09-07 01:02:04Z then back to 2020-09-07 01:02:04.001Z

This can be problematic for parsers (e.g. fluentd) which assume a consistent format including the milliseconds (currently we're dropping about 1/1000 of the gitaly logs on gitlab.com because of this). By using 0s in the format string we always get the sub-second portion, and log parsing will be kept happier

Merge request reports