From 6a00626ee93dd4d54c622c734fcd8a8fc6d3545a Mon Sep 17 00:00:00 2001 From: Sylvain Rabot Date: Fri, 10 Jul 2020 00:08:43 +0200 Subject: [PATCH] Display dates as well as timestamps in status page (#7544) * Display dates as well as timestamps in the status page Signed-off-by: Sylvain Rabot * Trim trailing whitespaces Signed-off-by: Sylvain Rabot --- web/ui/templates/status.html | 20 ++++++++++---------- web/web.go | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/web/ui/templates/status.html b/web/ui/templates/status.html index 91e31f020..bf5d2ba73 100644 --- a/web/ui/templates/status.html +++ b/web/ui/templates/status.html @@ -99,14 +99,14 @@ Number Of Series Number of Chunks - Current Max Time Current Min Time + Current Max Time {{ .NumSeries}} - {{.ChunkCount}} - {{ .MaxTime}} - {{ .MinTime}} + {{.ChunkCount}} + {{ .MinTime | unixToTime }} ({{ .MinTime }}) + {{ .MaxTime | unixToTime }} ({{ .MaxTime }}) @@ -121,7 +121,7 @@ {{ range .Stats.CardinalityLabelStats }} {{.Name}} - {{.Count}} + {{.Count}} {{end}} @@ -136,7 +136,7 @@ {{ range .Stats.CardinalityMetricsStats }} {{.Name}} - {{.Count}} + {{.Count}} {{end}} @@ -151,11 +151,11 @@ {{ range .Stats.LabelValueStats }} {{.Name}} - {{.Count}} + {{.Count}} {{end}} - +

Most Common Label Pairs

@@ -166,10 +166,10 @@ {{ range .Stats.LabelValuePairsStats }} - + {{end}} -
{{.Name}}{{.Count}}{{.Count}}
+ {{end}} diff --git a/web/web.go b/web/web.go index 1cd308f81..87b597510 100644 --- a/web/web.go +++ b/web/web.go @@ -982,6 +982,10 @@ func tmplFuncs(consolesPath string, opts *Options) template_text.FuncMap { "since": func(t time.Time) time.Duration { return time.Since(t) / time.Millisecond * time.Millisecond }, + "unixToTime": func(i int64) time.Time { + t := time.Unix(i/int64(time.Microsecond), 0).UTC() + return t + }, "consolesPath": func() string { return consolesPath }, "pathPrefix": func() string { return opts.ExternalURL.Path }, "pageTitle": func() string { return opts.PageTitle },