Path: blob/main/component/mimir/rules/kubernetes/health.go
4096 views
package rules12import (3"time"45"github.com/grafana/agent/component"6)78func (c *Component) reportUnhealthy(err error) {9c.healthMut.Lock()10defer c.healthMut.Unlock()11c.health = component.Health{12Health: component.HealthTypeUnhealthy,13Message: err.Error(),14UpdateTime: time.Now(),15}16}1718func (c *Component) reportHealthy() {19c.healthMut.Lock()20defer c.healthMut.Unlock()21c.health = component.Health{22Health: component.HealthTypeHealthy,23UpdateTime: time.Now(),24}25}2627func (c *Component) CurrentHealth() component.Health {28c.healthMut.RLock()29defer c.healthMut.RUnlock()30return c.health31}323334