prober: make status page more clear

Updates tailscale/corp#20583

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
pull/13068/head
Anton Tolchanov 4 months ago committed by Anton Tolchanov
parent f79183dac7
commit 46db698333

@ -496,7 +496,8 @@ func (p *Prober) RunHandler(w http.ResponseWriter, r *http.Request) error {
return nil return nil
} }
stats := fmt.Sprintf("Previous runs: success rate %d%%, median latency %v", stats := fmt.Sprintf("Last %d probes: success rate %d%%, median latency %v\n",
len(prevInfo.RecentResults),
int(prevInfo.RecentSuccessRatio()*100), prevInfo.RecentMedianLatency()) int(prevInfo.RecentSuccessRatio()*100), prevInfo.RecentMedianLatency())
if err != nil { if err != nil {
return tsweb.Error(respStatus, fmt.Sprintf("Probe failed: %s\n%s", err.Error(), stats), err) return tsweb.Error(respStatus, fmt.Sprintf("Probe failed: %s\n%s", err.Error(), stats), err)

@ -86,7 +86,7 @@ func (p *Prober) StatusHandler(opts ...statusHandlerOpt) tsweb.ReturnHandlerFunc
} }
s := probeStatus{ProbeInfo: info} s := probeStatus{ProbeInfo: info}
if !info.End.IsZero() { if !info.End.IsZero() {
s.TimeSinceLast = time.Since(info.End) s.TimeSinceLast = time.Since(info.End).Truncate(time.Second)
} }
for textTpl, urlTpl := range params.probeLinks { for textTpl, urlTpl := range params.probeLinks {
text, err := renderTemplate(textTpl, info) text, err := renderTemplate(textTpl, info)

@ -71,12 +71,12 @@
<table class="sortable"> <table class="sortable">
<thead><tr> <thead><tr>
<th>Name</th> <th>Name</th>
<th>Class & Labels</th> <th>Probe Class & Labels</th>
<th>Interval</th> <th>Interval</th>
<th>Result</th> <th>Last Attempt</th>
<th>Success</th> <th>Success</th>
<th>Latency</th> <th>Latency</th>
<th>Error</th> <th>Last Error</th>
</tr></thead> </tr></thead>
<tbody> <tbody>
{{range $name, $probeInfo := .Probes}} {{range $name, $probeInfo := .Probes}}
@ -100,8 +100,8 @@
<td>{{$probeInfo.Interval}}</td> <td>{{$probeInfo.Interval}}</td>
<td data-sort="{{$probeInfo.TimeSinceLast.Milliseconds}}"> <td data-sort="{{$probeInfo.TimeSinceLast.Milliseconds}}">
{{if $probeInfo.TimeSinceLast}} {{if $probeInfo.TimeSinceLast}}
{{$probeInfo.TimeSinceLast.String}}<br/> {{$probeInfo.TimeSinceLast.String}} ago<br/>
<span class="small">{{$probeInfo.End}}</span> <span class="small">{{$probeInfo.End.Format "2006-01-02T15:04:05Z07:00"}}</span>
{{else}} {{else}}
Never Never
{{end}} {{end}}

Loading…
Cancel
Save