1
0
Fork 0

Improve provider logs

This commit is contained in:
Ludovic Fernandez 2022-11-30 09:50:05 +01:00 committed by GitHub
parent 0d81fac3fc
commit c57876c116
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 22 additions and 26 deletions

View file

@ -85,7 +85,7 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
err := p.watchKv(ctxLog, configurationChan)
if err != nil {
logger.Error().Err(err).Msg("Cannot watch KV store")
logger.Error().Err(err).Msg("Cannot retrieve data")
}
})
@ -124,15 +124,11 @@ func (p *Provider) watchKv(ctx context.Context, configurationChan chan<- dynamic
}
notify := func(err error, time time.Duration) {
log.Ctx(ctx).Error().Err(err).Msgf("KV connection error, retrying in %s", time)
log.Ctx(ctx).Error().Err(err).Msgf("Provider error, retrying in %s", time)
}
err := backoff.RetryNotify(safe.OperationWithRecover(operation),
return backoff.RetryNotify(safe.OperationWithRecover(operation),
backoff.WithContext(job.NewBackOff(backoff.NewExponentialBackOff()), ctx), notify)
if err != nil {
return fmt.Errorf("cannot connect to KV server: %w", err)
}
return nil
}
func (p *Provider) buildConfiguration(ctx context.Context) (*dynamic.Configuration, error) {