diff --git a/internal/metricdata/utils.go b/internal/metricdata/utils.go index f480e40..dcdaaaa 100644 --- a/internal/metricdata/utils.go +++ b/internal/metricdata/utils.go @@ -72,13 +72,21 @@ func DeepCopy(jd_temp schema.JobData) schema.JobData { jd[k][k_].Unit.Base = v_.Unit.Base jd[k][k_].Unit.Prefix = v_.Unit.Prefix if v_.StatisticsSeries != nil { + // Init Slices jd[k][k_].StatisticsSeries = new(schema.StatsSeries) + jd[k][k_].StatisticsSeries.Max = make([]schema.Float, len(v_.StatisticsSeries.Max)) + jd[k][k_].StatisticsSeries.Min = make([]schema.Float, len(v_.StatisticsSeries.Min)) + jd[k][k_].StatisticsSeries.Median = make([]schema.Float, len(v_.StatisticsSeries.Median)) + jd[k][k_].StatisticsSeries.Mean = make([]schema.Float, len(v_.StatisticsSeries.Mean)) + // Copy Data copy(jd[k][k_].StatisticsSeries.Max, v_.StatisticsSeries.Max) copy(jd[k][k_].StatisticsSeries.Min, v_.StatisticsSeries.Min) copy(jd[k][k_].StatisticsSeries.Median, v_.StatisticsSeries.Median) copy(jd[k][k_].StatisticsSeries.Mean, v_.StatisticsSeries.Mean) + // Handle Percentiles for k__, v__ := range v_.StatisticsSeries.Percentiles { - jd[k][k_].StatisticsSeries.Percentiles[k__] = v__ + jd[k][k_].StatisticsSeries.Percentiles[k__] = make([]schema.Float, len(v__)) + copy(jd[k][k_].StatisticsSeries.Percentiles[k__], v__) } } else { jd[k][k_].StatisticsSeries = v_.StatisticsSeries