Status returns the current status for this healthcheck instance.
()
| 234 | |
| 235 | // Status returns the current status for this healthcheck instance. |
| 236 | func (hc *Check) Status() Status { |
| 237 | hc.lock.RLock() |
| 238 | defer hc.lock.RUnlock() |
| 239 | status := Status{ |
| 240 | LastCheck: hc.start, |
| 241 | Failures: hc.failures, |
| 242 | Successes: hc.successes, |
| 243 | State: hc.state, |
| 244 | } |
| 245 | if hc.result != nil { |
| 246 | status.Duration = hc.result.Duration |
| 247 | status.Message = hc.result.String() |
| 248 | } |
| 249 | return status |
| 250 | } |
| 251 | |
| 252 | // Run invokes a healthcheck. It waits for the initial configuration to be |
| 253 | // provided via the configuration channel, after which the configured |