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