Skip to content

Commit ff9cbc6

Browse files
committed
universe: improve logging for single asset sync attempt
When syncing a single asset (for example for creating an address) fails, the cause isn't easily visible in the logs. First, because the actual remote error wasn't logged and second because it was logged as debug. This commit fixes both.
1 parent ec80946 commit ff9cbc6

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

universe/auto_syncer.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,18 +846,31 @@ func (f *FederationEnvoy) SyncAssetInfo(ctx context.Context,
846846
// Sync failures are expected from Universe servers that do not
847847
// have a relevant universe root.
848848
if err != nil {
849-
log.Debugf("asset lookup for %v failed with remote"+
850-
"server: %v", assetID.String(), addr.HostStr())
851-
//lint:ignore nilerr failure is expected and logged
849+
log.Warnf("Asset lookup failed: asset_id=%v, "+
850+
"remote_server=%v: %v", assetID.String(),
851+
addr.HostStr(), err)
852+
853+
// We don't want to abort syncing here, as this might
854+
// just be one server in our list and returning an error
855+
// would cause us to stop trying the other servers.
856+
// lint:ignore nilerr failure is expected and logged.
852857
return nil
853858
}
854859

855860
// There should only be one sync diff since we're only syncing
856861
// one universe root.
857862
if syncDiff != nil {
858863
if len(syncDiff) != 1 {
859-
log.Debugf("unexpected number of sync diffs: "+
860-
"%v", len(syncDiff))
864+
log.Warnf("Unexpected number of sync diffs "+
865+
"when looking up asset: num_diffs=%d, "+
866+
"asset_id=%v, remote_server=%v",
867+
len(syncDiff), assetID.String(),
868+
addr.HostStr())
869+
870+
// We don't want to abort syncing here, as this
871+
// might just be one server in our list and
872+
// returning an error would cause us to stop
873+
// trying the other servers.
861874
return nil
862875
}
863876

0 commit comments

Comments
 (0)