From 22fe5231e2503dc6ccdbbf01d4ee58702380f7a4 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 4 Aug 2025 01:30:47 +0300 Subject: [PATCH] Updated build date in metrics to be of iso format (yyyy-mm-dd) --- cmd/server/main.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/server/main.go b/cmd/server/main.go index 2df68c4..d5ecae9 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -51,16 +51,16 @@ const ( var prod = true func main() { + buildDate := embeds.BuildDate + if buildDate != "unknown" { + t, err := strconv.ParseInt(buildDate, 10, 64) + if err == nil { + buildDate = time.Unix(t, 0).Format("2006-01-02") + } + } if len(os.Args) > 1 && os.Args[1] == "-v" { fmt.Println("version:", embeds.Version) fmt.Println("commit:", embeds.Commit) - buildDate := embeds.BuildDate - if buildDate != "unknown" { - t, err := strconv.ParseInt(buildDate, 10, 64) - if err == nil { - buildDate = time.Unix(t, 0).Format("2006-01-02") - } - } fmt.Println("build date:", buildDate) return } @@ -84,7 +84,7 @@ func main() { metrics.BuildInfo.With(prometheus.Labels{ "version": embeds.Version, "commit": embeds.Commit, - "build_date": embeds.BuildDate, + "build_date": buildDate, }).Set(1) if ok := reloadTosAndPrivacy(); !ok {