8 type statsTicker struct {
13 ErrorCodes map[string]uint64 `json:",omitempty"`
17 // Tick increments each of the given counters by 1 using
19 func (s *statsTicker) Tick(counters ...*uint64) {
20 for _, counter := range counters {
21 atomic.AddUint64(counter, 1)
25 // TickErr increments the overall error counter, as well as the
26 // ErrorCodes entry for the given errType. If err is nil, TickErr is a
28 func (s *statsTicker) TickErr(err error, errType string) {
35 if s.ErrorCodes == nil {
36 s.ErrorCodes = make(map[string]uint64)
38 s.ErrorCodes[errType]++
42 // TickInBytes increments the incoming byte counter by n.
43 func (s *statsTicker) TickInBytes(n uint64) {
44 atomic.AddUint64(&s.InBytes, n)
47 // TickOutBytes increments the outgoing byte counter by n.
48 func (s *statsTicker) TickOutBytes(n uint64) {
49 atomic.AddUint64(&s.OutBytes, n)