mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-20 23:46:23 +01:00
328 lines
11 KiB
Go
328 lines
11 KiB
Go
|
// Code generated by qtc from "targets.qtpl". DO NOT EDIT.
|
||
|
// See https://github.com/valyala/quicktemplate for details.
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:1
|
||
|
package promscrape
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:1
|
||
|
import (
|
||
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/promrelabel"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:6
|
||
|
import (
|
||
|
qtio422016 "io"
|
||
|
|
||
|
qt422016 "github.com/valyala/quicktemplate"
|
||
|
)
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:6
|
||
|
var (
|
||
|
_ = qtio422016.Copy
|
||
|
_ = qt422016.AcquireByteBuffer
|
||
|
)
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:6
|
||
|
func StreamTargets(qw422016 *qt422016.Writer, jts []jobTargetsStatuses, emptyJobs []string, showOnlyUnhealthy bool) {
|
||
|
//line lib/promscrape/targets.qtpl:6
|
||
|
qw422016.N().S(`
|
||
|
<div class="row mt-4">
|
||
|
<div class="col-12">
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:9
|
||
|
for i, js := range jts {
|
||
|
//line lib/promscrape/targets.qtpl:9
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:10
|
||
|
if showOnlyUnhealthy && js.upCount == js.targetsTotal {
|
||
|
//line lib/promscrape/targets.qtpl:10
|
||
|
continue
|
||
|
//line lib/promscrape/targets.qtpl:10
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:10
|
||
|
qw422016.N().S(`
|
||
|
<div class="row mb-4">
|
||
|
<div class="col-12">
|
||
|
<h4>
|
||
|
<span class="me-2">`)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.E().S(js.job)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().S(` `)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().S(`(`)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().D(js.upCount)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().S(`/`)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().D(js.targetsTotal)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().S(` `)
|
||
|
//line lib/promscrape/targets.qtpl:14
|
||
|
qw422016.N().S(`up)</span>
|
||
|
<button type="button" class="btn btn-primary btn-sm me-1"
|
||
|
onclick="document.getElementById('table-`)
|
||
|
//line lib/promscrape/targets.qtpl:16
|
||
|
qw422016.N().D(i)
|
||
|
//line lib/promscrape/targets.qtpl:16
|
||
|
qw422016.N().S(`').style.display='none'">collapse
|
||
|
</button>
|
||
|
<button type="button" class="btn btn-secondary btn-sm me-1"
|
||
|
onclick="document.getElementById('table-`)
|
||
|
//line lib/promscrape/targets.qtpl:19
|
||
|
qw422016.N().D(i)
|
||
|
//line lib/promscrape/targets.qtpl:19
|
||
|
qw422016.N().S(`').style.display='block'">expand
|
||
|
</button>
|
||
|
</h4>
|
||
|
<div id="table-`)
|
||
|
//line lib/promscrape/targets.qtpl:22
|
||
|
qw422016.N().D(i)
|
||
|
//line lib/promscrape/targets.qtpl:22
|
||
|
qw422016.N().S(`" class="table-responsive">
|
||
|
<table class="table table-striped table-hover table-bordered table-sm">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th scope="col">Endpoint</th>
|
||
|
<th scope="col">State</th>
|
||
|
<th scope="col" title="scrape target labels">Labels</th>
|
||
|
<th scope="col" title="total scrapes">Scrapes</th>
|
||
|
<th scope="col" title="total scrape errors">Errors</th>
|
||
|
<th scope="col" title="the time of the last scrape">Last Scrape</th>
|
||
|
<th scope="col" title="the duration of the last scrape">Duration</th>
|
||
|
<th scope="col" title="the number of metrics scraped during the last scrape">Samples</th>
|
||
|
<th scope="col" title="error from the last scrape (if any)">Last error</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody class="list-`)
|
||
|
//line lib/promscrape/targets.qtpl:37
|
||
|
qw422016.N().D(i)
|
||
|
//line lib/promscrape/targets.qtpl:37
|
||
|
qw422016.N().S(`">
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:38
|
||
|
for _, ts := range js.targetsStatus {
|
||
|
//line lib/promscrape/targets.qtpl:38
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:40
|
||
|
endpoint := ts.sw.Config.ScrapeURL
|
||
|
targetID := getTargetID(ts.sw)
|
||
|
lastScrapeTime := ts.getDurationFromLastScrape()
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:43
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:44
|
||
|
if showOnlyUnhealthy && ts.up {
|
||
|
//line lib/promscrape/targets.qtpl:44
|
||
|
continue
|
||
|
//line lib/promscrape/targets.qtpl:44
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:44
|
||
|
qw422016.N().S(`
|
||
|
<tr `)
|
||
|
//line lib/promscrape/targets.qtpl:45
|
||
|
if !ts.up {
|
||
|
//line lib/promscrape/targets.qtpl:45
|
||
|
qw422016.N().S(` `)
|
||
|
//line lib/promscrape/targets.qtpl:45
|
||
|
qw422016.N().S(`class="alert alert-danger" role="alert" `)
|
||
|
//line lib/promscrape/targets.qtpl:45
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:45
|
||
|
qw422016.N().S(`>
|
||
|
<td class="endpoint"><a href="`)
|
||
|
//line lib/promscrape/targets.qtpl:46
|
||
|
qw422016.E().S(endpoint)
|
||
|
//line lib/promscrape/targets.qtpl:46
|
||
|
qw422016.N().S(`" target="_blank">`)
|
||
|
//line lib/promscrape/targets.qtpl:46
|
||
|
qw422016.E().S(endpoint)
|
||
|
//line lib/promscrape/targets.qtpl:46
|
||
|
qw422016.N().S(`</a> (
|
||
|
<a href="target_response?id=`)
|
||
|
//line lib/promscrape/targets.qtpl:47
|
||
|
qw422016.E().S(targetID)
|
||
|
//line lib/promscrape/targets.qtpl:47
|
||
|
qw422016.N().S(`" target="_blank"
|
||
|
title="click to fetch target response on behalf of the scraper">response</a>
|
||
|
)
|
||
|
</td>
|
||
|
<td>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:52
|
||
|
if ts.up {
|
||
|
//line lib/promscrape/targets.qtpl:52
|
||
|
qw422016.N().S(`
|
||
|
<span class="badge bg-success">UP</span>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:54
|
||
|
} else {
|
||
|
//line lib/promscrape/targets.qtpl:54
|
||
|
qw422016.N().S(`
|
||
|
<span class="badge bg-danger">DOWN</span>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:56
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:56
|
||
|
qw422016.N().S(`
|
||
|
</td>
|
||
|
<td class="labels">
|
||
|
<div title="click to show original labels"
|
||
|
onclick="document.getElementById('original_labels_`)
|
||
|
//line lib/promscrape/targets.qtpl:60
|
||
|
qw422016.E().S(targetID)
|
||
|
//line lib/promscrape/targets.qtpl:60
|
||
|
qw422016.N().S(`').style.display='block'">
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:61
|
||
|
streamformatLabel(qw422016, promrelabel.FinalizeLabels(nil, ts.sw.Config.Labels))
|
||
|
//line lib/promscrape/targets.qtpl:61
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
<div style="display:none" id="original_labels_`)
|
||
|
//line lib/promscrape/targets.qtpl:63
|
||
|
qw422016.E().S(targetID)
|
||
|
//line lib/promscrape/targets.qtpl:63
|
||
|
qw422016.N().S(`">
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:64
|
||
|
streamformatLabel(qw422016, ts.sw.Config.OriginalLabels)
|
||
|
//line lib/promscrape/targets.qtpl:64
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
</td>
|
||
|
<td>`)
|
||
|
//line lib/promscrape/targets.qtpl:67
|
||
|
qw422016.N().D(ts.scrapesTotal)
|
||
|
//line lib/promscrape/targets.qtpl:67
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>`)
|
||
|
//line lib/promscrape/targets.qtpl:68
|
||
|
qw422016.N().D(ts.scrapesFailed)
|
||
|
//line lib/promscrape/targets.qtpl:68
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:70
|
||
|
if lastScrapeTime < 365*24*time.Hour {
|
||
|
//line lib/promscrape/targets.qtpl:70
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:71
|
||
|
qw422016.N().FPrec(lastScrapeTime.Seconds(), 3)
|
||
|
//line lib/promscrape/targets.qtpl:71
|
||
|
qw422016.N().S(`s ago
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:72
|
||
|
} else {
|
||
|
//line lib/promscrape/targets.qtpl:72
|
||
|
qw422016.N().S(`
|
||
|
none
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:74
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:74
|
||
|
qw422016.N().S(`
|
||
|
<td>`)
|
||
|
//line lib/promscrape/targets.qtpl:75
|
||
|
qw422016.N().D(int(ts.scrapeDuration))
|
||
|
//line lib/promscrape/targets.qtpl:75
|
||
|
qw422016.N().S(`ms</td>
|
||
|
<td>`)
|
||
|
//line lib/promscrape/targets.qtpl:76
|
||
|
qw422016.N().D(ts.samplesScraped)
|
||
|
//line lib/promscrape/targets.qtpl:76
|
||
|
qw422016.N().S(`</td>
|
||
|
<td>`)
|
||
|
//line lib/promscrape/targets.qtpl:77
|
||
|
if ts.err != nil {
|
||
|
//line lib/promscrape/targets.qtpl:77
|
||
|
qw422016.E().S(ts.err.Error())
|
||
|
//line lib/promscrape/targets.qtpl:77
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:77
|
||
|
qw422016.N().S(`</td>
|
||
|
</tr>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:79
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:79
|
||
|
qw422016.N().S(`
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:85
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:85
|
||
|
qw422016.N().S(`
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:89
|
||
|
for _, jobName := range emptyJobs {
|
||
|
//line lib/promscrape/targets.qtpl:89
|
||
|
qw422016.N().S(`
|
||
|
<div>
|
||
|
<h4><a>`)
|
||
|
//line lib/promscrape/targets.qtpl:91
|
||
|
qw422016.E().S(jobName)
|
||
|
//line lib/promscrape/targets.qtpl:91
|
||
|
qw422016.N().S(` (0/0 up)</a></h4>
|
||
|
<table class="table table-striped table-hover table-bordered table-sm">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th scope="col">Endpoint</th>
|
||
|
<th scope="col">State</th>
|
||
|
<th scope="col">Labels</th>
|
||
|
<th scope="col">Last Scrape</th>
|
||
|
<th scope="col">Scrape Duration</th>
|
||
|
<th scope="col">Samples Scraped</th>
|
||
|
<th scope="col">Error</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
</table>
|
||
|
</div>
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:106
|
||
|
}
|
||
|
//line lib/promscrape/targets.qtpl:106
|
||
|
qw422016.N().S(`
|
||
|
`)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
}
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
func WriteTargets(qq422016 qtio422016.Writer, jts []jobTargetsStatuses, emptyJobs []string, showOnlyUnhealthy bool) {
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
StreamTargets(qw422016, jts, emptyJobs, showOnlyUnhealthy)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
qt422016.ReleaseWriter(qw422016)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
}
|
||
|
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
func Targets(jts []jobTargetsStatuses, emptyJobs []string, showOnlyUnhealthy bool) string {
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
WriteTargets(qb422016, jts, emptyJobs, showOnlyUnhealthy)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
qs422016 := string(qb422016.B)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
return qs422016
|
||
|
//line lib/promscrape/targets.qtpl:107
|
||
|
}
|