mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-13 06:47:28 -08:00
Code Review: Formatting comments.
This commit is contained in:
parent
06b4a40661
commit
f7704af4f8
|
@ -98,6 +98,9 @@ type Target interface {
|
||||||
//
|
//
|
||||||
// Right now, this is used as the sorting key in TargetPool.
|
// Right now, this is used as the sorting key in TargetPool.
|
||||||
ScheduledFor() time.Time
|
ScheduledFor() time.Time
|
||||||
|
// EstimatedTimeToExecute emits the amount of time until the next prospective
|
||||||
|
// scheduling opportunity for this target.
|
||||||
|
EstimatedTimeToExecute() time.Duration
|
||||||
// Return the last encountered scrape error, if any.
|
// Return the last encountered scrape error, if any.
|
||||||
LastError() error
|
LastError() error
|
||||||
// The address to which the Target corresponds. Out of all of the available
|
// The address to which the Target corresponds. Out of all of the available
|
||||||
|
@ -257,6 +260,10 @@ func (t *target) ScheduledFor() time.Time {
|
||||||
return t.scheduler.ScheduledFor()
|
return t.scheduler.ScheduledFor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *target) EstimatedTimeToExecute() time.Duration {
|
||||||
|
return t.scheduler.ScheduledFor().Sub(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
func (t *target) LastError() error {
|
func (t *target) LastError() error {
|
||||||
return t.lastError
|
return t.lastError
|
||||||
}
|
}
|
||||||
|
|
|
@ -1838,13 +1838,13 @@ func TestGetValueRangeAtIntervalOp(t *testing.T) {
|
||||||
|
|
||||||
var scenarios = []struct {
|
var scenarios = []struct {
|
||||||
op getValueRangeAtIntervalOp
|
op getValueRangeAtIntervalOp
|
||||||
in model.Values
|
in Values
|
||||||
out model.Values
|
out Values
|
||||||
}{
|
}{
|
||||||
// All values before the first range.
|
// All values before the first range.
|
||||||
{
|
{
|
||||||
op: testOp,
|
op: testOp,
|
||||||
in: model.Values{
|
in: Values{
|
||||||
{
|
{
|
||||||
Timestamp: testInstant.Add(-4 * time.Minute),
|
Timestamp: testInstant.Add(-4 * time.Minute),
|
||||||
Value: 1,
|
Value: 1,
|
||||||
|
@ -1854,12 +1854,12 @@ func TestGetValueRangeAtIntervalOp(t *testing.T) {
|
||||||
Value: 2,
|
Value: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
out: model.Values{},
|
out: Values{},
|
||||||
},
|
},
|
||||||
// Values starting before first range, ending after last.
|
// Values starting before first range, ending after last.
|
||||||
{
|
{
|
||||||
op: testOp,
|
op: testOp,
|
||||||
in: model.Values{
|
in: Values{
|
||||||
{
|
{
|
||||||
Timestamp: testInstant.Add(-4 * time.Minute),
|
Timestamp: testInstant.Add(-4 * time.Minute),
|
||||||
Value: 1,
|
Value: 1,
|
||||||
|
@ -1917,7 +1917,7 @@ func TestGetValueRangeAtIntervalOp(t *testing.T) {
|
||||||
Value: 14,
|
Value: 14,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
out: model.Values{
|
out: Values{
|
||||||
{
|
{
|
||||||
Timestamp: testInstant.Add(-2 * time.Minute),
|
Timestamp: testInstant.Add(-2 * time.Minute),
|
||||||
Value: 3,
|
Value: 3,
|
||||||
|
@ -1959,17 +1959,17 @@ func TestGetValueRangeAtIntervalOp(t *testing.T) {
|
||||||
// Values starting after last range.
|
// Values starting after last range.
|
||||||
{
|
{
|
||||||
op: testOp,
|
op: testOp,
|
||||||
in: model.Values{
|
in: Values{
|
||||||
{
|
{
|
||||||
Timestamp: testInstant.Add(21 * time.Minute),
|
Timestamp: testInstant.Add(21 * time.Minute),
|
||||||
Value: 14,
|
Value: 14,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
out: model.Values{},
|
out: Values{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for i, scenario := range scenarios {
|
for i, scenario := range scenarios {
|
||||||
actual := model.Values{}
|
actual := Values{}
|
||||||
for !scenario.op.Consumed() {
|
for !scenario.op.Consumed() {
|
||||||
actual = append(actual, scenario.op.ExtractSamples(scenario.in)...)
|
actual = append(actual, scenario.op.ExtractSamples(scenario.in)...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,46 +40,43 @@
|
||||||
|
|
||||||
<h2>Targets</h2>
|
<h2>Targets</h2>
|
||||||
<div class="grouping_box">
|
<div class="grouping_box">
|
||||||
<ul>
|
{{range $job, $pool := .TargetPools}}
|
||||||
{{range $job, $pool := .TargetPools}}
|
<h3>{{$job}}</h3>
|
||||||
<li>{{$job}}
|
<table>
|
||||||
<table>
|
<thead>
|
||||||
<thead>
|
<tr>
|
||||||
<tr>
|
<th>Endpoint</th>
|
||||||
<th>Endpoint</th>
|
<th>State</th>
|
||||||
<th>State</th>
|
<th>Base Labels</th>
|
||||||
<th>Base Labels</th>
|
<th>Next Retrieval</th>
|
||||||
<th>Earliest Retrieval</th>
|
<th>Error</th>
|
||||||
<th>Error</th>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</thead>
|
<tbody>
|
||||||
<tbody>
|
{{range $pool.Targets}}
|
||||||
{{range $pool.Targets}}
|
<tr>
|
||||||
<tr>
|
<td>
|
||||||
<td>
|
<a href="{{.GlobalAddress}}">{{.Address}}</a>
|
||||||
<a href="{{.GlobalAddress}}">{{.Address}}</a>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
{{.State}}
|
||||||
{{.State}}
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
{{.BaseLabels}}
|
||||||
{{.BaseLabels}}
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
{{.EstimatedTimeToExecute}}
|
||||||
{{.ScheduledFor}}
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
{{if .LastError}}
|
||||||
{{if .LastError}}
|
<span class="error_text">{{.LastError}}</span>
|
||||||
<span class="error_text">{{.LastError}}</span>
|
{{end}}
|
||||||
{{end}}
|
</td>
|
||||||
</td>
|
</tr>
|
||||||
</tr>
|
{{end}}
|
||||||
{{end}}
|
</tbody>
|
||||||
</tbody>
|
</table>
|
||||||
</table>
|
{{end}}
|
||||||
</li>
|
|
||||||
{{end}}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Curation</h2>
|
<h2>Curation</h2>
|
||||||
|
|
Loading…
Reference in a new issue