mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 10:26:29 +02:00
Restore info metrics (#252)
This commit is contained in:
parent
5e3eb69dca
commit
790619ef01
5 changed files with 14 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -37,5 +37,7 @@ var (
|
|||
GRPCServerViews,
|
||||
HTTPServerViews,
|
||||
GRPCClientViews,
|
||||
GRPCServerViews}
|
||||
GRPCServerViews,
|
||||
InfoViews,
|
||||
}
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue