don't fail if one container runtime fails

pull/9856/head
Priya Wadhwa 2020-12-04 11:36:16 -08:00
parent 7dc52c4e03
commit ab1d2e474a
1 changed files with 27 additions and 20 deletions

View File

@ -82,7 +82,15 @@ func execute() error {
return errors.Wrap(err, "registering view") return errors.Wrap(err, "registering view")
} }
for _, cr := range []string{"docker", "containerd", "crio"} { for _, cr := range []string{"docker", "containerd", "crio"} {
sd, err := getExporter(projectID, cr) if err := exportMinikubeStart(ctx, projectID, cr); err != nil {
log.Printf("error exporting minikube start data for runtime %v: %v", cr, err)
}
}
return nil
}
func exportMinikubeStart(ctx context.Context, projectID, containerRuntime string) error {
sd, err := getExporter(projectID, containerRuntime)
if err != nil { if err != nil {
return errors.Wrap(err, "getting stackdriver exporter") return errors.Wrap(err, "getting stackdriver exporter")
} }
@ -93,7 +101,7 @@ func execute() error {
return errors.Wrap(err, "starting metric exporter") return errors.Wrap(err, "starting metric exporter")
} }
// track minikube start time and record it to metrics collector // track minikube start time and record it to metrics collector
st, err := minikubeStartTime(ctx, projectID, tmpFile, cr) st, err := minikubeStartTime(ctx, projectID, tmpFile, containerRuntime)
if err != nil { if err != nil {
return errors.Wrap(err, "collecting start time") return errors.Wrap(err, "collecting start time")
} }
@ -103,7 +111,6 @@ func execute() error {
sd.Flush() sd.Flush()
sd.StopMetricsExporter() sd.StopMetricsExporter()
trace.UnregisterExporter(sd) trace.UnregisterExporter(sd)
}
return nil return nil
} }