diff --git a/stats/stats.go b/stats/stats.go index 853cde9..47d22a9 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -67,6 +67,7 @@ type CounterPair struct { Value int } +// Snapshot holds the names and values of some counters. type Snapshot []CounterPair // Snapshot returns the current values of all the counters. @@ -80,18 +81,3 @@ func (s *Stats) Snapshot() Snapshot { } return out } - -// Clone returns a new Stats instance, copying the source Stats -// counts. -func (s *Stats) Clone() *Stats { - s.mu.Lock() - defer s.mu.Unlock() - - out := &Stats{ - counts: make(map[string]int), - } - for name, count := range s.counts { - out.counts[name] = count - } - return out -} diff --git a/stats/stats_small_test.go b/stats/stats_small_test.go index 1a0f641..32c71d3 100644 --- a/stats/stats_small_test.go +++ b/stats/stats_small_test.go @@ -62,23 +62,6 @@ func TestSnapshot(t *testing.T) { }, s.Snapshot()) } -func TestClone(t *testing.T) { - s := stats.New("foo", "bar", "qaz") - s.Inc("foo") - s.Inc("bar") - s.Inc("bar") - - s2 := s.Clone() - assert.Equal(t, 1, s2.Get("foo")) - assert.Equal(t, 2, s2.Get("bar")) - assert.Equal(t, 0, s2.Get("qaz")) - - // Make sure they're independent - s2.Inc("foo") - assert.Equal(t, 2, s2.Get("foo")) - assert.Equal(t, 1, s.Get("foo")) -} - func BenchmarkStats(b *testing.B) { s := stats.New("foo", "bar")