api/internal/rpc/health_server.go
Peter Kurfer af31b1166a
Audit API prototype
- watch events interactively
- pipe events to files
- remove file subscriptions
2021-01-26 18:19:03 +01:00

30 lines
639 B
Go

package rpc
import (
"context"
"gitlab.com/inetmock/inetmock/internal/app"
)
type healthServer struct {
UnimplementedHealthServer
app app.App
}
func (h healthServer) GetHealth(_ context.Context, _ *HealthRequest) (resp *HealthResponse, err error) {
checker := h.app.Checker()
result := checker.IsHealthy()
resp = &HealthResponse{
OverallHealthState: HealthState(result.Status),
ComponentsHealth: map[string]*ComponentHealth{}}
for component, status := range result.Components {
resp.ComponentsHealth[component] = &ComponentHealth{
State: HealthState(status.Status),
Message: status.Message,
}
}
return
}