mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-04 01:09:36 +02:00
log context (#2107)
This commit is contained in:
parent
e7995954ff
commit
e0c09a0998
87 changed files with 714 additions and 524 deletions
|
@ -23,25 +23,25 @@ type Reporter struct {
|
|||
}
|
||||
|
||||
// OnConfigChange applies configuration changes to the reporter
|
||||
func (r *Reporter) OnConfigChange(cfg *config.Config) {
|
||||
func (r *Reporter) OnConfigChange(ctx context.Context, cfg *config.Config) {
|
||||
if r.cancel != nil {
|
||||
r.cancel()
|
||||
}
|
||||
|
||||
services, err := getReportedServices(cfg)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("metrics announce to service registry is disabled")
|
||||
log.Warn(ctx).Err(err).Msg("metrics announce to service registry is disabled")
|
||||
}
|
||||
|
||||
sharedKey, err := base64.StdEncoding.DecodeString(cfg.Options.SharedKey)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("decoding shared key")
|
||||
log.Error(ctx).Err(err).Msg("decoding shared key")
|
||||
return
|
||||
}
|
||||
|
||||
urls, err := cfg.Options.GetDataBrokerURLs()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("invalid databroker urls")
|
||||
log.Error(ctx).Err(err).Msg("invalid databroker urls")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ func (r *Reporter) OnConfigChange(cfg *config.Config) {
|
|||
SignedJWTKey: sharedKey,
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("connecting to registry")
|
||||
log.Error(ctx).Err(err).Msg("connecting to registry")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ func runReporter(
|
|||
after = resp.CallBackAfter.AsDuration()
|
||||
backoff.Reset()
|
||||
case <-ctx.Done():
|
||||
log.Info().Msg("service registry reporter stopping")
|
||||
log.Info(ctx).Msg("service registry reporter stopping")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue