Browse Source

ETOOCLEVER so s/ObserverEffect/UseNilMetrics/.

Richard Crowley 12 years ago
parent
commit
b953f7c0d8
9 changed files with 13 additions and 13 deletions
  1. 1 1
      counter.go
  2. 1 1
      ewma.go
  3. 1 1
      gauge.go
  4. 1 1
      healthcheck.go
  5. 1 1
      histogram.go
  6. 1 1
      meter.go
  7. 3 3
      metrics.go
  8. 2 2
      sample.go
  9. 2 2
      timer.go

+ 1 - 1
counter.go

@@ -15,7 +15,7 @@ type Counter interface {
 
 // Create a new Counter.
 func NewCounter() Counter {
-	if !ObserverEffect {
+	if UseNilMetrics {
 		return NilCounter{}
 	}
 	return &StandardCounter{0}

+ 1 - 1
ewma.go

@@ -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}

+ 1 - 1
gauge.go

@@ -13,7 +13,7 @@ type Gauge interface {
 
 // Create a new Gauge.
 func NewGauge() Gauge {
-	if !ObserverEffect {
+	if UseNilMetrics {
 		return NilGauge{}
 	}
 	return &StandardGauge{0}

+ 1 - 1
healthcheck.go

@@ -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}

+ 1 - 1
histogram.go

@@ -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{

+ 1 - 1
meter.go

@@ -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{

+ 3 - 3
metrics.go

@@ -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

+ 2 - 2
sample.go

@@ -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{
@@ -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}

+ 2 - 2
timer.go

@@ -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}
@@ -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{