Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/component/mimir/rules/kubernetes/health.go
4096 views
1
package rules
2
3
import (
4
"time"
5
6
"github.com/grafana/agent/component"
7
)
8
9
func (c *Component) reportUnhealthy(err error) {
10
c.healthMut.Lock()
11
defer c.healthMut.Unlock()
12
c.health = component.Health{
13
Health: component.HealthTypeUnhealthy,
14
Message: err.Error(),
15
UpdateTime: time.Now(),
16
}
17
}
18
19
func (c *Component) reportHealthy() {
20
c.healthMut.Lock()
21
defer c.healthMut.Unlock()
22
c.health = component.Health{
23
Health: component.HealthTypeHealthy,
24
UpdateTime: time.Now(),
25
}
26
}
27
28
func (c *Component) CurrentHealth() component.Health {
29
c.healthMut.RLock()
30
defer c.healthMut.RUnlock()
31
return c.health
32
}
33
34