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 <sylvain@abstraction.fr>

* Trim trailing whitespaces

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
This commit is contained in:
Sylvain Rabot 2020-07-10 00:08:43 +02:00 committed by GitHub
parent be96951c56
commit 6a00626ee9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View file

@ -99,14 +99,14 @@
<tr>
<th>Number Of Series </th>
<th>Number of Chunks</th>
<th>Current Max Time</th>
<th>Current Min Time</th>
<th>Current Max Time</th>
</tr>
<tr>
<td scope="row">{{ .NumSeries}}</td>
<td>{{.ChunkCount}}</td>
<td>{{ .MaxTime}}</td>
<td>{{ .MinTime}}</td>
<td>{{.ChunkCount}}</td>
<td>{{ .MinTime | unixToTime }} ({{ .MinTime }})</td>
<td>{{ .MaxTime | unixToTime }} ({{ .MaxTime }})</td>
</tr>
</tbody>
</table>
@ -121,7 +121,7 @@
{{ range .Stats.CardinalityLabelStats }}
<tr>
<td scope="row">{{.Name}}</td>
<td>{{.Count}}</td>
<td>{{.Count}}</td>
</tr>
{{end}}
</tbody>
@ -136,7 +136,7 @@
{{ range .Stats.CardinalityMetricsStats }}
<tr>
<td scope="row">{{.Name}}</td>
<td>{{.Count}}</td>
<td>{{.Count}}</td>
</tr>
{{end}}
</tbody>
@ -151,11 +151,11 @@
{{ range .Stats.LabelValueStats }}
<tr>
<td scope="row">{{.Name}}</td>
<td>{{.Count}}</td>
<td>{{.Count}}</td>
</tr>
{{end}}
</tbody>
</table>
</table>
<h3 id="headstatus">Most Common Label Pairs</h3>
<table class="table table-sm table-bordered table-striped table-hover">
<tbody>
@ -166,10 +166,10 @@
{{ range .Stats.LabelValuePairsStats }}
<tr>
<td scope="row">{{.Name}}</td>
<td>{{.Count}}</td>
<td>{{.Count}}</td>
</tr>
{{end}}
</tbody>
</table>
</table>
</div>
{{end}}

View file

@ -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 },