rcrowley / go-metrics

Go port of Coda Hale's Metrics library
Other
3.46k stars 494 forks source link

the interfce Histogram need a Get function #170

Open zlm3110561045 opened 8 years ago

zlm3110561045 commented 8 years ago

func GetOrRegisterHistogram(name string, r Registry, s Sample) Histogram { if nil == r { r = DefaultRegistry } return r.GetOrRegister(name, func() Histogram { return NewHistogram(s) }).(Histogram) }

if we update the Histogram values frequently,we need use method GetOrRegisterHistogram first to get Histogram and then update it,but the third parameter need to new a interface Sample,it spend to much time on alloc memory,so a Get function to get Histogram maybe a good way to aviod to much unuseful action.