-
Notifications
You must be signed in to change notification settings - Fork 1
/
observer.go
27 lines (22 loc) · 836 Bytes
/
observer.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
package http
import (
"github.com/alexfalkowski/go-health/server"
"github.com/alexfalkowski/go-service/health/transport/http"
"github.com/alexfalkowski/konfig/source"
)
// NewHealthObserver for HTTP.
func NewHealthObserver(healthServer *server.Server, source *source.Config) *http.HealthObserver {
names := []string{"vault"}
if source.IsGit() {
names = append(names, "git")
}
return &http.HealthObserver{Observer: healthServer.Observe(names...)}
}
// NewLivenessObserver for HTTP.
func NewLivenessObserver(healthServer *server.Server) *http.LivenessObserver {
return &http.LivenessObserver{Observer: healthServer.Observe("noop")}
}
// NewReadinessObserver for HTTP.
func NewReadinessObserver(healthServer *server.Server) *http.ReadinessObserver {
return &http.ReadinessObserver{Observer: healthServer.Observe("noop")}
}