don't fail if one container runtime fails
parent
7dc52c4e03
commit
ab1d2e474a
|
@ -82,31 +82,38 @@ func execute() error {
|
|||
return errors.Wrap(err, "registering view")
|
||||
}
|
||||
for _, cr := range []string{"docker", "containerd", "crio"} {
|
||||
sd, err := getExporter(projectID, cr)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "getting stackdriver exporter")
|
||||
if err := exportMinikubeStart(ctx, projectID, cr); err != nil {
|
||||
log.Printf("error exporting minikube start data for runtime %v: %v", cr, err)
|
||||
}
|
||||
// Register it as a trace exporter
|
||||
trace.RegisterExporter(sd)
|
||||
|
||||
if err := sd.StartMetricsExporter(); err != nil {
|
||||
return errors.Wrap(err, "starting metric exporter")
|
||||
}
|
||||
// track minikube start time and record it to metrics collector
|
||||
st, err := minikubeStartTime(ctx, projectID, tmpFile, cr)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "collecting start time")
|
||||
}
|
||||
fmt.Printf("Latency: %f\n", st)
|
||||
stats.Record(ctx, latencyS.M(st))
|
||||
time.Sleep(30 * time.Second)
|
||||
sd.Flush()
|
||||
sd.StopMetricsExporter()
|
||||
trace.UnregisterExporter(sd)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func exportMinikubeStart(ctx context.Context, projectID, containerRuntime string) error {
|
||||
sd, err := getExporter(projectID, containerRuntime)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "getting stackdriver exporter")
|
||||
}
|
||||
// Register it as a trace exporter
|
||||
trace.RegisterExporter(sd)
|
||||
|
||||
if err := sd.StartMetricsExporter(); err != nil {
|
||||
return errors.Wrap(err, "starting metric exporter")
|
||||
}
|
||||
// track minikube start time and record it to metrics collector
|
||||
st, err := minikubeStartTime(ctx, projectID, tmpFile, containerRuntime)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "collecting start time")
|
||||
}
|
||||
fmt.Printf("Latency: %f\n", st)
|
||||
stats.Record(ctx, latencyS.M(st))
|
||||
time.Sleep(30 * time.Second)
|
||||
sd.Flush()
|
||||
sd.StopMetricsExporter()
|
||||
trace.UnregisterExporter(sd)
|
||||
return nil
|
||||
}
|
||||
|
||||
func getExporter(projectID, containerRuntime string) (*stackdriver.Exporter, error) {
|
||||
return stackdriver.NewExporter(stackdriver.Options{
|
||||
ProjectID: projectID,
|
||||
|
|
Loading…
Reference in New Issue