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

View file

@ -982,6 +982,10 @@ func tmplFuncs(consolesPath string, opts *Options) template_text.FuncMap {
"since": func(t time.Time) time.Duration { "since": func(t time.Time) time.Duration {
return time.Since(t) / time.Millisecond * time.Millisecond 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 }, "consolesPath": func() string { return consolesPath },
"pathPrefix": func() string { return opts.ExternalURL.Path }, "pathPrefix": func() string { return opts.ExternalURL.Path },
"pageTitle": func() string { return opts.PageTitle }, "pageTitle": func() string { return opts.PageTitle },