Skip to content

Commit dc6db8c

Browse files
committed
Improve client initialization error logging
1 parent f558795 commit dc6db8c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pkg/util/clusterdata/clusterdata.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (p ParallelEnricher) waitForResults(log *logrus.Entry, errChannel chan erro
154154
timeout = true
155155
}
156156
default:
157-
p.taskError(log, err, 1)
157+
p.taskError(log.WithField("task", "waitForResults"), err, 1)
158158
}
159159
}
160160
}
@@ -169,22 +169,25 @@ func (p ParallelEnricher) initializeClients(ctx context.Context, log *logrus.Ent
169169
if err != nil {
170170
unsuccessfulEnrichers[servicePrincipal] = true
171171
unsuccessfulEnrichers[ingressProfile] = true
172-
p.taskError(log, err, 2)
172+
p.taskError(log.WithField("task", "setupK8sClient"), err, 2)
173173
}
174174
machineclient, err = p.setupMachineClient(ctx, oc)
175175
if err != nil {
176176
unsuccessfulEnrichers[machineClient] = true
177-
p.taskError(log, err, 1)
177+
p.taskError(log.WithField("task", "setupMachineClient"), err, 1)
178178
}
179179
operatorclient, err = p.setupOperatorClient(ctx, oc)
180180
if err != nil {
181181
unsuccessfulEnrichers[ingressProfile] = true
182-
p.taskError(log, err, 1)
182+
p.taskError(log.WithField("task", "setupOperatorClient"), err, 1)
183183
}
184184
configclient, err = p.setupConfigClient(ctx, oc)
185185
if err != nil {
186186
unsuccessfulEnrichers[clusterVersion] = true
187-
p.taskError(log, err, 1)
187+
p.taskError(log.WithField("task", "setupConfigClient"), err, 1)
188+
}
189+
if len(unsuccessfulEnrichers) > 0 {
190+
log.WithField("enrichers", unsuccessfulEnrichers).Error("one or more enrichers were unsuccessful")
188191
}
189192
return k8s, machineclient, operatorclient, configclient, unsuccessfulEnrichers
190193
}

0 commit comments

Comments
 (0)