From a908e397bcbf6c112fcb4d6b92b18f52c1f79b2d Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Thu, 14 Feb 2013 18:21:21 +0100 Subject: [PATCH] Integrate cleanups for comments in PR70. --- appstate/appstate.go | 5 ++++- main.go | 2 +- utility/strconv.go | 2 ++ web/status.go | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/appstate/appstate.go b/appstate/appstate.go index 2435629a8..543f5c4b7 100644 --- a/appstate/appstate.go +++ b/appstate/appstate.go @@ -20,9 +20,12 @@ import ( "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 { Config *config.Config - RuleManager rules.RuleManager Persistence metric.MetricPersistence + RuleManager rules.RuleManager TargetManager retrieval.TargetManager } diff --git a/main.go b/main.go index 35f6b7600..7d256ad87 100644 --- a/main.go +++ b/main.go @@ -76,8 +76,8 @@ func main() { appState := &appstate.ApplicationState{ Config: conf, - RuleManager: ruleManager, Persistence: persistence, + RuleManager: ruleManager, TargetManager: targetManager, } diff --git a/utility/strconv.go b/utility/strconv.go index 655395f87..5e13fcfc8 100644 --- a/utility/strconv.go +++ b/utility/strconv.go @@ -67,6 +67,8 @@ func StringToDuration(durationStr string) (duration time.Duration, err error) { duration *= 60 case "s": duration *= 1 + default: + panic("Invalid time unit in duration string.") } return } diff --git a/web/status.go b/web/status.go index a0403b0e4..9e0116160 100644 --- a/web/status.go +++ b/web/status.go @@ -20,9 +20,9 @@ import ( ) type PrometheusStatus struct { - Status string Config string Rules string + Status string Targets string } @@ -32,9 +32,9 @@ type StatusHandler struct { func (h *StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { status := &PrometheusStatus{ - Status: "TODO: add status information here", Config: h.appState.Config.ToString(0), Rules: "TODO: list rules here", + Status: "TODO: add status information here", Targets: "TODO: list targets here", } t, _ := template.ParseFiles("web/templates/status.html")