github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/controller/pkg/counters/default.go (about) 1 package counters 2 3 import ( 4 "go.aporeto.io/enforcerd/trireme-lib/collector" 5 ) 6 7 // defaultCounters are a global instance of counters. 8 // These are used when we dont have a PU context. 9 var defaultCounters = NewCounters() 10 11 // CounterError is a convinence function which returns error as well as increments the counter. 12 func CounterError(t CounterType, err error) error { // nolint 13 return defaultCounters.CounterError(t, err) 14 } 15 16 // IncrementCounter increments counters for a given PU 17 func IncrementCounter(err CounterType) { 18 defaultCounters.IncrementCounter(err) 19 } 20 21 // GetErrorCounters returns the error counters and resets the counters to zero 22 func GetErrorCounters() []collector.Counters { 23 return defaultCounters.GetErrorCounters() 24 }