SetErrorAndReset zeroes all the container statistics and store the error. It is used when receiving time out error during statistics collecting to reduce lock overhead
(err error)
| 61 | // SetErrorAndReset zeroes all the container statistics and store the error. |
| 62 | // It is used when receiving time out error during statistics collecting to reduce lock overhead |
| 63 | func (cs *Stats) SetErrorAndReset(err error) { |
| 64 | cs.mutex.Lock() |
| 65 | defer cs.mutex.Unlock() |
| 66 | cs.CPUPercentage = 0 |
| 67 | cs.Memory = 0 |
| 68 | cs.MemoryPercentage = 0 |
| 69 | cs.MemoryLimit = 0 |
| 70 | cs.NetworkRx = 0 |
| 71 | cs.NetworkTx = 0 |
| 72 | cs.BlockRead = 0 |
| 73 | cs.BlockWrite = 0 |
| 74 | cs.PidsCurrent = 0 |
| 75 | cs.err = err |
| 76 | cs.IsInvalid = true |
| 77 | } |
| 78 | |
| 79 | // SetError sets container statistics error |
| 80 | func (cs *Stats) SetError(err error) { |