update conditional metrics usage

This commit is contained in:
ginuerzh
2022-07-29 21:18:01 +08:00
parent 5a15f53fc6
commit 513eefe034
5 changed files with 22 additions and 15 deletions

View File

@ -29,7 +29,7 @@ var (
global Metrics = Noop()
)
func SetGlobal(m Metrics) {
func Init(m Metrics) {
if m != nil {
global = m
} else {
@ -37,8 +37,8 @@ func SetGlobal(m Metrics) {
}
}
func Global() Metrics {
return global
func IsEnabled() bool {
return global != Noop()
}
type Gauge interface {