// NewGauge initializes a new Gauge, registers it with the "expvar" package and // returns it. The initial value is NaN. func NewGauge(id api.Identifier) *Gauge { g := &Gauge{ id: id, value: api.Gauge(math.NaN()), } Publish(g) expvar.Publish(id.String(), g) return g }
// NewDerive initializes a new Derive, registers it with the "expvar" package // and returns it. The initial value is zero. func NewDerive(id api.Identifier) *Derive { d := &Derive{ id: id, value: 0, } Publish(d) expvar.Publish(id.String(), d) return d }