mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Integrate cleanups for comments in PR70.
This commit is contained in:
parent
d137362257
commit
a908e397bc
|
@ -20,9 +20,12 @@ import (
|
||||||
"github.com/prometheus/prometheus/storage/metric"
|
"github.com/prometheus/prometheus/storage/metric"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ApplicationState is an encapsulation of all relevant Prometheus application
|
||||||
|
// runtime state. It enables simpler passing of this state to components that
|
||||||
|
// require it.
|
||||||
type ApplicationState struct {
|
type ApplicationState struct {
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
RuleManager rules.RuleManager
|
|
||||||
Persistence metric.MetricPersistence
|
Persistence metric.MetricPersistence
|
||||||
|
RuleManager rules.RuleManager
|
||||||
TargetManager retrieval.TargetManager
|
TargetManager retrieval.TargetManager
|
||||||
}
|
}
|
||||||
|
|
2
main.go
2
main.go
|
@ -76,8 +76,8 @@ func main() {
|
||||||
|
|
||||||
appState := &appstate.ApplicationState{
|
appState := &appstate.ApplicationState{
|
||||||
Config: conf,
|
Config: conf,
|
||||||
RuleManager: ruleManager,
|
|
||||||
Persistence: persistence,
|
Persistence: persistence,
|
||||||
|
RuleManager: ruleManager,
|
||||||
TargetManager: targetManager,
|
TargetManager: targetManager,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@ func StringToDuration(durationStr string) (duration time.Duration, err error) {
|
||||||
duration *= 60
|
duration *= 60
|
||||||
case "s":
|
case "s":
|
||||||
duration *= 1
|
duration *= 1
|
||||||
|
default:
|
||||||
|
panic("Invalid time unit in duration string.")
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type PrometheusStatus struct {
|
type PrometheusStatus struct {
|
||||||
Status string
|
|
||||||
Config string
|
Config string
|
||||||
Rules string
|
Rules string
|
||||||
|
Status string
|
||||||
Targets string
|
Targets string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ type StatusHandler struct {
|
||||||
|
|
||||||
func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
status := &PrometheusStatus{
|
status := &PrometheusStatus{
|
||||||
Status: "TODO: add status information here",
|
|
||||||
Config: h.appState.Config.ToString(0),
|
Config: h.appState.Config.ToString(0),
|
||||||
Rules: "TODO: list rules here",
|
Rules: "TODO: list rules here",
|
||||||
|
Status: "TODO: add status information here",
|
||||||
Targets: "TODO: list targets here",
|
Targets: "TODO: list targets here",
|
||||||
}
|
}
|
||||||
t, _ := template.ParseFiles("web/templates/status.html")
|
t, _ := template.ParseFiles("web/templates/status.html")
|
||||||
|
|
Loading…
Reference in a new issue