diff --git a/runner/sidecar/sidecar.go b/runner/sidecar/sidecar.go index 42258718..dda61462 100644 --- a/runner/sidecar/sidecar.go +++ b/runner/sidecar/sidecar.go @@ -240,19 +240,24 @@ func patchStepStatus() { if v.Status.SinkStatues == nil { v.Status.SinkStatues = dfv1.SourceStatuses{} } - // the step with change while this goroutine is running, so we must copy the data for this + // the step will change while this goroutine is running, so we must copy the data for this // replica back to the status + r := strconv.Itoa(replica) for name, s := range step.Status.SourceStatuses { if v.Status.SourceStatuses[name].Metrics == nil { - s.Metrics = map[string]dfv1.Metrics{} + x := v.Status.SourceStatuses[name] + x.Metrics = map[string]dfv1.Metrics{} + v.Status.SourceStatuses[name] = x } - v.Status.SourceStatuses[name] = s + v.Status.SourceStatuses[name].Metrics[r] = s.Metrics[r] } for name, s := range step.Status.SinkStatues { if v.Status.SinkStatues[name].Metrics == nil { - s.Metrics = map[string]dfv1.Metrics{} + x := v.Status.SinkStatues[name] + x.Metrics = map[string]dfv1.Metrics{} + v.Status.SinkStatues[name] = x } - v.Status.SinkStatues[name] = s + v.Status.SinkStatues[name].Metrics[r] = s.Metrics[r] } step = v })