diff --git a/instrument.go b/instrument.go index 052a66b..68c4ca5 100644 --- a/instrument.go +++ b/instrument.go @@ -4,36 +4,36 @@ import ( "sync/atomic" ) -type counter struct { +type Counter struct { value uint64 } -func (c *counter) Inc() { +func (c *Counter) Inc() { atomic.AddUint64(&c.value, 1) } -func NewCounter(name string) *counter { - c := new(counter) +func NewCounter(name string) *Counter { + c := new(Counter) Publish(name, func() interface{} { return c.value }) return c } -type gauge struct { +type Gauge struct { value int64 } -func (g *gauge) Inc() { +func (g *Gauge) Inc() { atomic.AddInt64(&g.value, 1) } -func (g *gauge) Dec() { +func (g *Gauge) Dec() { atomic.AddInt64(&g.value, -1) } -func NewGauge(name string) *gauge { - g := new(gauge) +func NewGauge(name string) *Gauge { + g := new(Gauge) Publish(name, func() interface{} { return g.value })