Skip to content

Commit

Permalink
ETOOCLEVER so s/ObserverEffect/UseNilMetrics/.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrowley committed Sep 13, 2013
1 parent 6600d18 commit b953f7c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion counter.go
Expand Up @@ -15,7 +15,7 @@ type Counter interface {

// Create a new Counter.
func NewCounter() Counter {
if !ObserverEffect {
if UseNilMetrics {
return NilCounter{}
}
return &StandardCounter{0}
Expand Down
2 changes: 1 addition & 1 deletion ewma.go
Expand Up @@ -19,7 +19,7 @@ type EWMA interface {

// Create a new EWMA with the given alpha.
func NewEWMA(alpha float64) EWMA {
if !ObserverEffect {
if UseNilMetrics {
return NilEWMA{}
}
return &StandardEWMA{alpha: alpha}
Expand Down
2 changes: 1 addition & 1 deletion gauge.go
Expand Up @@ -13,7 +13,7 @@ type Gauge interface {

// Create a new Gauge.
func NewGauge() Gauge {
if !ObserverEffect {
if UseNilMetrics {
return NilGauge{}
}
return &StandardGauge{0}
Expand Down
2 changes: 1 addition & 1 deletion healthcheck.go
Expand Up @@ -14,7 +14,7 @@ type Healthcheck interface {
// Create a new Healthcheck, which will use the given function to update
// its status.
func NewHealthcheck(f func(Healthcheck)) Healthcheck {
if !ObserverEffect {
if UseNilMetrics {
return NilHealthcheck{}
}
return &StandardHealthcheck{nil, f}
Expand Down
2 changes: 1 addition & 1 deletion histogram.go
Expand Up @@ -28,7 +28,7 @@ type Histogram interface {
// so that the first value will be both min and max and the variance is flagged
// for special treatment on its first iteration.
func NewHistogram(s Sample) Histogram {
if !ObserverEffect {
if UseNilMetrics {
return NilHistogram{}
}
return &StandardHistogram{
Expand Down
2 changes: 1 addition & 1 deletion meter.go
Expand Up @@ -19,7 +19,7 @@ type Meter interface {
// Create a new Meter. Create the communication channels and start the
// synchronizing goroutine.
func NewMeter() Meter {
if !ObserverEffect {
if UseNilMetrics {
return NilMeter{}
}
m := &StandardMeter{
Expand Down
6 changes: 3 additions & 3 deletions metrics.go
Expand Up @@ -5,9 +5,9 @@
// Coda Hale's original work: <https://github.com/codahale/metrics>
package metrics

// ObserverEffect is checked by the constructor functions for all of the
// standard metrics. If it is false, the metric returned is a stub.
// UseNilMetrics is checked by the constructor functions for all of the
// standard metrics. If it is true, the metric returned is a stub.
//
// This global kill-switch helps quantify the observer effect and makes
// for less cluttered pprof profiles.
var ObserverEffect bool = true
var UseNilMetrics bool = false
4 changes: 2 additions & 2 deletions sample.go
Expand Up @@ -41,7 +41,7 @@ var _ Sample = &ExpDecaySample{}
// Create a new exponentially-decaying sample with the given reservoir size
// and alpha.
func NewExpDecaySample(reservoirSize int, alpha float64) Sample {
if !ObserverEffect {
if UseNilMetrics {
return NilSample{}
}
s := &ExpDecaySample{
Expand Down Expand Up @@ -135,7 +135,7 @@ type UniformSample struct {

// Create a new uniform sample with the given reservoir size.
func NewUniformSample(reservoirSize int) Sample {
if !ObserverEffect {
if UseNilMetrics {
return NilSample{}
}
return &UniformSample{reservoirSize: reservoirSize}
Expand Down
4 changes: 2 additions & 2 deletions timer.go
Expand Up @@ -25,7 +25,7 @@ type Timer interface {

// Create a new timer with the given Histogram and Meter.
func NewCustomTimer(h Histogram, m Meter) Timer {
if !ObserverEffect {
if UseNilMetrics {
return NilTimer{}
}
return &StandardTimer{h, m}
Expand All @@ -35,7 +35,7 @@ func NewCustomTimer(h Histogram, m Meter) Timer {
// will use an exponentially-decaying sample with the same reservoir size
// and alpha as UNIX load averages.
func NewTimer() Timer {
if !ObserverEffect {
if UseNilMetrics {
return NilTimer{}
}
return &StandardTimer{
Expand Down

0 comments on commit b953f7c

Please sign in to comment.