Skip to content

Commit

Permalink
Added metric to track process reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Wiedenbein authored and jacksontj committed Jun 13, 2018
1 parent 8608fbe commit 9dc2364
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/promxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9dc2364

Please sign in to comment.