|
@@ -44,7 +44,6 @@ func NewFunctionalGauge(f func() int64) Gauge {
|
|
|
return &FunctionalGauge{value: f}
|
|
return &FunctionalGauge{value: f}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// NewRegisteredFunctionalGauge constructs and registers a new StandardGauge.
|
|
// NewRegisteredFunctionalGauge constructs and registers a new StandardGauge.
|
|
|
func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge {
|
|
func NewRegisteredFunctionalGauge(name string, r Registry, f func() int64) Gauge {
|
|
|
c := NewFunctionalGauge(f)
|
|
c := NewFunctionalGauge(f)
|
|
@@ -101,6 +100,7 @@ func (g *StandardGauge) Update(v int64) {
|
|
|
func (g *StandardGauge) Value() int64 {
|
|
func (g *StandardGauge) Value() int64 {
|
|
|
return atomic.LoadInt64(&g.value)
|
|
return atomic.LoadInt64(&g.value)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
// FunctionalGauge returns value from given function
|
|
// FunctionalGauge returns value from given function
|
|
|
type FunctionalGauge struct {
|
|
type FunctionalGauge struct {
|
|
|
value func() int64
|
|
value func() int64
|
|
@@ -117,4 +117,4 @@ func (g FunctionalGauge) Snapshot() Gauge { return GaugeSnapshot(g.Value()) }
|
|
|
// Update panics.
|
|
// Update panics.
|
|
|
func (FunctionalGauge) Update(int64) {
|
|
func (FunctionalGauge) Update(int64) {
|
|
|
panic("Update called on a FunctionalGauge")
|
|
panic("Update called on a FunctionalGauge")
|
|
|
-}
|
|
|
|
|
|
|
+}
|