diff --git a/report/metrics.go b/report/metrics.go index 15ca6d21b..2e1d1f7fd 100644 --- a/report/metrics.go +++ b/report/metrics.go @@ -199,23 +199,6 @@ func (m Metric) Merge(other Metric) Metric { } } -// Div returns a new copy of the metric, with each value divided by n. -func (m Metric) Div(n float64) Metric { - samplesOut := make([]Sample, len(m.Samples), len(m.Samples)) - - for i := range m.Samples { - samplesOut[i].Value = m.Samples[i].Value / n - samplesOut[i].Timestamp = m.Samples[i].Timestamp - } - return Metric{ - Samples: samplesOut, - Max: m.Max / n, - Min: m.Min / n, - First: m.First, - Last: m.Last, - } -} - // LastSample obtains the last sample of the metric func (m Metric) LastSample() (Sample, bool) { if m.Samples == nil { diff --git a/report/metrics_test.go b/report/metrics_test.go index a725c4461..a04ced418 100644 --- a/report/metrics_test.go +++ b/report/metrics_test.go @@ -122,21 +122,6 @@ func TestMetricMerge(t *testing.T) { } } -func TestMetricDiv(t *testing.T) { - t1 := time.Now() - t2 := time.Now().Add(1 * time.Minute) - - want := report.MakeMetric([]report.Sample{{Timestamp: t1, Value: -2}, {Timestamp: t2, Value: 2}}) - beforeDiv := report.MakeMetric([]report.Sample{{Timestamp: t1, Value: -2048}, {Timestamp: t2, Value: 2048}}) - have := beforeDiv.Div(1024) - if !reflect.DeepEqual(want, have) { - t.Errorf("diff: %s", test.Diff(want, have)) - } - - // Check the original was unmodified - checkMetric(t, beforeDiv, t1, t2, -2048, 2048) -} - func TestMetricMarshalling(t *testing.T) { t1 := time.Now().UTC() t2 := time.Now().UTC().Add(1 * time.Minute)