From 9dc236402c18eb011515d1118943649a090c160f Mon Sep 17 00:00:00 2001 From: Tom Wiedenbein Date: Tue, 12 Jun 2018 11:15:04 -0700 Subject: [PATCH] Added metric to track process reload --- cmd/promxy/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/promxy/main.go b/cmd/promxy/main.go index e6f6a8111..301b93876 100644 --- a/cmd/promxy/main.go +++ b/cmd/promxy/main.go @@ -43,6 +43,13 @@ import ( "github.com/sirupsen/logrus" ) +var ( + reloadTime = prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "process_reload_time_seconds", + Help: "Last reload (SIGHUP) time of the process since unix epoch in seconds.", + }) +) + type CLIOpts struct { BindAddr string `long:"bind-addr" description:"address for promxy to listen on" default:":8082"` ConfigFile string `long:"config" description:"path to the config file" required:"true"` @@ -83,10 +90,14 @@ func reloadConfig(rls ...proxyconfig.Reloadable) error { if failed { return fmt.Errorf("One or more errors occurred while applying new configuration") } + reloadTime.Set(float64(time.Now().Unix())) return nil } func main() { + + prometheus.MustRegister(reloadTime) + reloadables := make([]proxyconfig.Reloadable, 0) parser := flags.NewParser(&opts, flags.Default)