Skip to content

Commit 5971011

Browse files
More logging messages for sync updates (#2864)
* More logging messages for sync updates * wip
1 parent 17decaa commit 5971011

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

cmd/broker/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ func main() {
271271
log.Info("FIPS mode is disabled")
272272
}
273273

274+
log.Info(fmt.Sprintf("Synchronous update response enabled: %v", cfg.Broker.SyncEmptyUpdateResponseEnabled))
275+
274276
// create kubernetes client
275277
kcpK8sConfig, err := config.GetConfig()
276278
fatalOnError(err, log)

internal/broker/instance_update.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,23 +485,34 @@ func (b *UpdateEndpoint) shouldSkipNewOperation(previousInstance, currentInstanc
485485
// do not compare "Active" field
486486
previousInstance.Parameters.ErsContext.Active = currentInstance.Parameters.ErsContext.Active
487487
if !reflect.DeepEqual(previousInstance.Parameters, currentInstance.Parameters) {
488+
logger.Info("Parameters changed, cannot skip new operation")
489+
490+
if !reflect.DeepEqual(previousInstance.Parameters.ErsContext, currentInstance.Parameters.ErsContext) {
491+
logger.Info("Context changed")
492+
}
493+
if !reflect.DeepEqual(previousInstance.Parameters.Parameters, currentInstance.Parameters.Parameters) {
494+
logger.Info("Parameters changed")
495+
}
488496
return false, nil
489497
}
490498
if previousInstance.ServicePlanID != currentInstance.ServicePlanID {
499+
logger.Info("Plan changed, cannot skip new operation")
491500
return false, nil
492501
}
493502
if previousInstance.GlobalAccountID != currentInstance.GlobalAccountID {
503+
logger.Info("GlobalAccountID changed, cannot skip new operation")
494504
return false, nil
495505
}
496506
lastOperation, err := b.operationStorage.GetLastOperationWithAllStates(currentInstance.InstanceID)
497507
if err != nil {
508+
logger.Error(fmt.Sprintf("unable to get last operation: %s, cannot skip new operation", err.Error()))
498509
return false, nil
499510
}
500511

501512
// if the last operation did not succeed, we cannot respond synchronously
502513
// Last change could fail, we cannot accept and response OK for next update which do the same.
503514
if lastOperation.State == domain.Failed {
504-
logger.Info(fmt.Sprintf("Last operation %s %s failed, cannot respond synchronously", lastOperation.Type, lastOperation.ID))
515+
logger.Info(fmt.Sprintf("Last operation %s %s failed, cannot skip new operation", lastOperation.Type, lastOperation.ID))
505516
return false, lastOperation
506517
}
507518

0 commit comments

Comments
 (0)