Skip to content

Commit

Permalink
Alphabetize
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrowley committed Oct 4, 2014
1 parent 9ea6830 commit d4f1d62
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
21 changes: 10 additions & 11 deletions histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package metrics
type Histogram interface {
Clear()
Count() int64
Sum() int64
Max() int64
Mean() float64
Min() int64
Expand All @@ -13,6 +12,7 @@ type Histogram interface {
Sample() Sample
Snapshot() Histogram
StdDev() float64
Sum() int64
Update(int64)
Variance() float64
}
Expand Down Expand Up @@ -59,10 +59,6 @@ func (*HistogramSnapshot) Clear() {
// taken.
func (h *HistogramSnapshot) Count() int64 { return h.sample.Count() }

// Sum returns the sum in the sample at the time the snapshot was
// taken.
func (h *HistogramSnapshot) Sum() int64 { return h.sample.Sum() }

// Max returns the maximum value in the sample at the time the snapshot was
// taken.
func (h *HistogramSnapshot) Max() int64 { return h.sample.Max() }
Expand Down Expand Up @@ -97,6 +93,9 @@ func (h *HistogramSnapshot) Snapshot() Histogram { return h }
// time the snapshot was taken.
func (h *HistogramSnapshot) StdDev() float64 { return h.sample.StdDev() }

// Sum returns the sum in the sample at the time the snapshot was taken.
func (h *HistogramSnapshot) Sum() int64 { return h.sample.Sum() }

// Update panics.
func (*HistogramSnapshot) Update(int64) {
panic("Update called on a HistogramSnapshot")
Expand All @@ -114,9 +113,6 @@ func (NilHistogram) Clear() {}
// Count is a no-op.
func (NilHistogram) Count() int64 { return 0 }

// Sum is a no-op.
func (NilHistogram) Sum() int64 { return 0 }

// Max is a no-op.
func (NilHistogram) Max() int64 { return 0 }

Expand All @@ -143,6 +139,9 @@ func (NilHistogram) Snapshot() Histogram { return NilHistogram{} }
// StdDev is a no-op.
func (NilHistogram) StdDev() float64 { return 0.0 }

// Sum is a no-op.
func (NilHistogram) Sum() int64 { return 0 }

// Update is a no-op.
func (NilHistogram) Update(v int64) {}

Expand All @@ -162,9 +161,6 @@ func (h *StandardHistogram) Clear() { h.sample.Clear() }
// cleared.
func (h *StandardHistogram) Count() int64 { return h.sample.Count() }

// Sum returns the sum in the sample.
func (h *StandardHistogram) Sum() int64 { return h.sample.Sum() }

// Max returns the maximum value in the sample.
func (h *StandardHistogram) Max() int64 { return h.sample.Max() }

Expand Down Expand Up @@ -196,6 +192,9 @@ func (h *StandardHistogram) Snapshot() Histogram {
// StdDev returns the standard deviation of the values in the sample.
func (h *StandardHistogram) StdDev() float64 { return h.sample.StdDev() }

// Sum returns the sum in the sample.
func (h *StandardHistogram) Sum() int64 { return h.sample.Sum() }

// Update samples a new value.
func (h *StandardHistogram) Update(v int64) { h.sample.Update(v) }

Expand Down
2 changes: 0 additions & 2 deletions librato/librato.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func (self *Reporter) BuildRequest(now time.Time, r metrics.Registry) (snapshot
s := m.Sample()
measurement[Name] = fmt.Sprintf("%s.%s", name, "hist")
measurement[Count] = uint64(s.Count())
measurement[Sum] = s.Sum()
measurement[Max] = float64(s.Max())
measurement[Min] = float64(s.Min())
measurement[SumSquares] = sumSquares(s)
Expand Down Expand Up @@ -174,7 +173,6 @@ func (self *Reporter) BuildRequest(now time.Time, r metrics.Registry) (snapshot
gauges[0] = Measurement{
Name: libratoName,
Count: uint64(m.Count()),
Sum: m.Mean() * float64(m.Count()),
Max: float64(m.Max()),
Min: float64(m.Min()),
SumSquares: sumSquaresTimer(m),
Expand Down
24 changes: 12 additions & 12 deletions timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
// Timers capture the duration and rate of events.
type Timer interface {
Count() int64
Sum() int64
Max() int64
Mean() float64
Min() int64
Expand All @@ -20,6 +19,7 @@ type Timer interface {
RateMean() float64
Snapshot() Timer
StdDev() float64
Sum() int64
Time(func())
Update(time.Duration)
UpdateSince(time.Time)
Expand Down Expand Up @@ -77,9 +77,6 @@ type NilTimer struct {
// Count is a no-op.
func (NilTimer) Count() int64 { return 0 }

// Sum is a no-op.
func (NilTimer) Sum() int64 { return 0 }

// Max is a no-op.
func (NilTimer) Max() int64 { return 0 }

Expand Down Expand Up @@ -115,6 +112,9 @@ func (NilTimer) Snapshot() Timer { return NilTimer{} }
// StdDev is a no-op.
func (NilTimer) StdDev() float64 { return 0.0 }

// Sum is a no-op.
func (NilTimer) Sum() int64 { return 0 }

// Time is a no-op.
func (NilTimer) Time(func()) {}

Expand All @@ -140,11 +140,6 @@ func (t *StandardTimer) Count() int64 {
return t.histogram.Count()
}

// Sum returns the sum in the sample.
func (t *StandardTimer) Sum() int64 {
return t.histogram.Sum()
}

// Max returns the maximum value in the sample.
func (t *StandardTimer) Max() int64 {
return t.histogram.Max()
Expand Down Expand Up @@ -206,6 +201,11 @@ func (t *StandardTimer) StdDev() float64 {
return t.histogram.StdDev()
}

// Sum returns the sum in the sample.
func (t *StandardTimer) Sum() int64 {
return t.histogram.Sum()
}

// Record the duration of the execution of the given function.
func (t *StandardTimer) Time(f func()) {
ts := time.Now()
Expand Down Expand Up @@ -244,9 +244,6 @@ type TimerSnapshot struct {
// taken.
func (t *TimerSnapshot) Count() int64 { return t.histogram.Count() }

// Sum returns the sum at the time the snapshot was taken.
func (t *TimerSnapshot) Sum() int64 { return t.histogram.Sum() }

// Max returns the maximum value at the time the snapshot was taken.
func (t *TimerSnapshot) Max() int64 { return t.histogram.Max() }

Expand Down Expand Up @@ -291,6 +288,9 @@ func (t *TimerSnapshot) Snapshot() Timer { return t }
// was taken.
func (t *TimerSnapshot) StdDev() float64 { return t.histogram.StdDev() }

// Sum returns the sum at the time the snapshot was taken.
func (t *TimerSnapshot) Sum() int64 { return t.histogram.Sum() }

// Time panics.
func (*TimerSnapshot) Time(func()) {
panic("Time called on a TimerSnapshot")
Expand Down

0 comments on commit d4f1d62

Please sign in to comment.