mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-13 06:47:28 -08:00
StatusHandler renders build info
This commit is contained in:
parent
033533c4c5
commit
a2a4f94aae
|
@ -28,4 +28,5 @@ type ApplicationState struct {
|
||||||
RuleManager rules.RuleManager
|
RuleManager rules.RuleManager
|
||||||
Storage metric.Storage
|
Storage metric.Storage
|
||||||
TargetManager retrieval.TargetManager
|
TargetManager retrieval.TargetManager
|
||||||
|
BuildInfo map[string]string
|
||||||
}
|
}
|
||||||
|
|
1
main.go
1
main.go
|
@ -91,6 +91,7 @@ func main() {
|
||||||
RuleManager: ruleManager,
|
RuleManager: ruleManager,
|
||||||
Storage: ts,
|
Storage: ts,
|
||||||
TargetManager: targetManager,
|
TargetManager: targetManager,
|
||||||
|
BuildInfo: BuildInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
web.StartServing(appState)
|
web.StartServing(appState)
|
||||||
|
|
|
@ -24,6 +24,7 @@ type PrometheusStatus struct {
|
||||||
Rules string
|
Rules string
|
||||||
Status string
|
Status string
|
||||||
TargetPools map[string]*retrieval.TargetPool
|
TargetPools map[string]*retrieval.TargetPool
|
||||||
|
BuildInfo map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type StatusHandler struct {
|
type StatusHandler struct {
|
||||||
|
@ -36,6 +37,7 @@ func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
Rules: "TODO: list rules here",
|
Rules: "TODO: list rules here",
|
||||||
Status: "TODO: add status information here",
|
Status: "TODO: add status information here",
|
||||||
TargetPools: h.appState.TargetManager.Pools(),
|
TargetPools: h.appState.TargetManager.Pools(),
|
||||||
|
BuildInfo: h.appState.BuildInfo,
|
||||||
}
|
}
|
||||||
executeTemplate(w, "status", status)
|
executeTemplate(w, "status", status)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,23 +2,23 @@
|
||||||
|
|
||||||
{{define "content"}}
|
{{define "content"}}
|
||||||
<h2>Status</h2>
|
<h2>Status</h2>
|
||||||
<div class="grouping_box">
|
<div class="grouping_box">
|
||||||
{{.Status}}
|
{{.Status}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Configuration</h2>
|
<h2>Configuration</h2>
|
||||||
<div class="grouping_box">
|
<div class="grouping_box">
|
||||||
<pre>
|
<pre>
|
||||||
{{.Config}}
|
{{.Config}}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Rules</h2>
|
<h2>Rules</h2>
|
||||||
<div class="grouping_box">
|
<div class="grouping_box">
|
||||||
{{.Rules}}
|
{{.Rules}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Targets</h2>
|
<h2>Targets</h2>
|
||||||
<div class="grouping_box">
|
<div class="grouping_box">
|
||||||
<ul>
|
<ul>
|
||||||
{{range $job, $pool := .TargetPools}}
|
{{range $job, $pool := .TargetPools}}
|
||||||
|
@ -33,5 +33,17 @@
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h2>Build Info</h2>
|
||||||
|
<div class="grouping_box">
|
||||||
|
<table>
|
||||||
|
{{range $key, $value := .BuildInfo}}
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{{$key}}</th>
|
||||||
|
<td>{{$value}}</td>
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue