add metrics

This commit is contained in:
ginuerzh
2022-03-16 21:21:47 +08:00
parent 7db81fcfeb
commit 6b2ccaad38
13 changed files with 522 additions and 12 deletions

23
metrics/nop.go Normal file
View File

@ -0,0 +1,23 @@
package metrics
var (
nilGauge = &nopGauge{}
nilCounter = &nopCounter{}
nilObserver = &nopObserver{}
)
type nopGauge struct{}
func (*nopGauge) Inc() {}
func (*nopGauge) Dec() {}
func (*nopGauge) Add(v float64) {}
func (*nopGauge) Set(v float64) {}
type nopCounter struct{}
func (*nopCounter) Inc() {}
func (*nopCounter) Add(v float64) {}
type nopObserver struct{}
func (*nopObserver) Observe(v float64) {}