-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathmonitoring.go
38 lines (32 loc) · 967 Bytes
/
monitoring.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 service
import (
ffclient "github.com/thomaspoignant/go-feature-flag"
"github.com/thomaspoignant/go-feature-flag/cmd/relayproxy/model"
)
// Monitoring is the interface of the monitoring service
type Monitoring interface {
Health() model.HealthResponse
Info() model.InfoResponse
}
// NewMonitoring creates a new implementation of Monitoring
func NewMonitoring(goFF *ffclient.GoFeatureFlag) Monitoring {
return &monitoringImpl{
goFF: goFF,
}
}
// monitoringImpl is one implementation of the Monitoring interface
type monitoringImpl struct {
goFF *ffclient.GoFeatureFlag
}
// Health returns a static object to show that the server is initialized
func (m *monitoringImpl) Health() model.HealthResponse {
return model.HealthResponse{
Initialized: true,
}
}
// Info returns information about the relay-proxy
func (m *monitoringImpl) Info() model.InfoResponse {
return model.InfoResponse{
LatestCacheRefresh: m.goFF.GetCacheRefreshDate(),
}
}