diff --git a/authorize/authorize.go b/authorize/authorize.go index 735faa8b8..e1c03a3c2 100644 --- a/authorize/authorize.go +++ b/authorize/authorize.go @@ -60,10 +60,10 @@ func (a *Authorize) ValidIdentity(route string, identity *Identity) bool { // UpdateOptions updates internal structures based on config.Options func (a *Authorize) UpdateOptions(o config.Options) error { - log.Info().Msg("authorize: updating options") if a == nil { return nil } + log.Info().Msg("authorize: updating options") a.identityAccess = NewIdentityWhitelist(o.Policies, o.Administrators) return nil } diff --git a/cmd/pomerium/main.go b/cmd/pomerium/main.go index 5b4d43fc2..67f222c42 100644 --- a/cmd/pomerium/main.go +++ b/cmd/pomerium/main.go @@ -166,6 +166,8 @@ func setupMetrics(opt *config.Options) { if handler, err := metrics.PrometheusHandler(); err != nil { log.Error().Err(err).Msg("cmd/pomerium: couldn't start metrics server") } else { + metrics.SetBuildInfo(opt.Services) + metrics.RegisterInfoMetrics() serverOpts := &httputil.ServerOptions{Addr: opt.MetricsAddr} srv := httputil.NewHTTPServer(serverOpts, handler) go httputil.Shutdown(srv) diff --git a/internal/config/options.go b/internal/config/options.go index 2c252035c..26c6791b6 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -384,6 +384,7 @@ func HandleConfigUpdate(configFile string, opt *Options, services []OptionsUpdat newOpt, err := ParseOptions(configFile) if err != nil { log.Error().Err(err).Msg("config: could not reload configuration") + metrics.SetConfigInfo(opt.Services, false, "") return opt } optChecksum := opt.Checksum() @@ -396,11 +397,17 @@ func HandleConfigUpdate(configFile string, opt *Options, services []OptionsUpdat return opt } + errored := false for _, service := range services { if err := service.UpdateOptions(*newOpt); err != nil { log.Error().Err(err).Msg("internal/config: could not update options") + errored = true + metrics.SetConfigInfo(opt.Services, false, "") } } + if !errored { + metrics.SetConfigInfo(newOpt.Services, true, newOptChecksum) + } return newOpt } diff --git a/internal/telemetry/metrics/const.go b/internal/telemetry/metrics/const.go index 7066ec3c0..2cd2bb610 100644 --- a/internal/telemetry/metrics/const.go +++ b/internal/telemetry/metrics/const.go @@ -37,5 +37,7 @@ var ( GRPCServerViews, HTTPServerViews, GRPCClientViews, - GRPCServerViews} + GRPCServerViews, + InfoViews, + } ) diff --git a/proxy/proxy.go b/proxy/proxy.go index 857d84727..2b0abb271 100755 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -324,5 +324,6 @@ func (p *Proxy) UpdateOptions(o config.Options) error { if p == nil { return nil } + log.Info().Msg("proxy: updating options") return p.UpdatePolicies(&o) }