heartbeat updates the instance timestamp within the ring. This function is guaranteed to be called within the lifecycler main goroutine.
(ctx context.Context)
| 517 | // heartbeat updates the instance timestamp within the ring. This function is guaranteed |
| 518 | // to be called within the lifecycler main goroutine. |
| 519 | func (l *BasicLifecycler) heartbeat(ctx context.Context) { |
| 520 | err := l.updateInstance(ctx, func(r *Desc, i *InstanceDesc) bool { |
| 521 | l.delegate.OnRingInstanceHeartbeat(l, r, i) |
| 522 | i.Timestamp = time.Now().Unix() |
| 523 | return true |
| 524 | }) |
| 525 | |
| 526 | if err != nil { |
| 527 | level.Warn(l.logger).Log("msg", "failed to heartbeat instance in the ring", "ring", l.ringName, "err", err) |
| 528 | return |
| 529 | } |
| 530 | |
| 531 | l.metrics.heartbeats.Inc() |
| 532 | } |
| 533 | |
| 534 | // changeState of the instance within the ring. This function is guaranteed |
| 535 | // to be called within the lifecycler main goroutine. |
no test coverage detected