-
Notifications
You must be signed in to change notification settings - Fork 14
/
healthcheck.go
38 lines (33 loc) · 1.11 KB
/
healthcheck.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package healthcheck
import (
"context"
"sync"
pluginpb "github.com/dsrvlabs/vatz-proto/plugin/v1"
"github.com/dsrvlabs/vatz/manager/config"
dp "github.com/dsrvlabs/vatz/manager/dispatcher"
tp "github.com/dsrvlabs/vatz/manager/types"
)
// HealthCheck provides interfaces to check health.
type HealthCheck interface {
PluginHealthCheck(ctx context.Context, gClient pluginpb.PluginClient, plugin config.Plugin, dispatcher []dp.Dispatcher) (tp.AliveStatus, error)
VATZHealthCheck(schedule []string, dispatcher []dp.Dispatcher) error
PluginStatus(ctx context.Context) []tp.PluginStatus
}
// GetHealthChecker creates instance of HealchChecker
func GetHealthChecker() HealthCheck {
healthCheckerOnce.Do(func() {
option := map[string]interface{}{"pUnique": "VATZHealthChecker"}
healthCheckerSingle = healthChecker{
healthMSG: tp.ReqMsg{
FuncName: "VATZHealthCheck",
State: pluginpb.STATE_SUCCESS,
Msg: "VATZ is Alive!!",
Severity: pluginpb.SEVERITY_INFO,
ResourceType: "VATZ",
Options: option,
},
pluginStatus: sync.Map{},
}
})
return &healthCheckerSingle
}