1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00
2017-06-23 17:40:19 +02:00

32 lines
737 B
Go

package main
var version = "unknown"
// Gather application status information
type AppStatus struct {
Version string `json:"version"`
Routes RoutesStoreStats `json:"routes"`
Neighbours NeighboursStoreStats `json:"neighbours"`
}
// Get application status, perform health checks
// on backends.
func NewAppStatus() (*AppStatus, error) {
routesStatus := RoutesStoreStats{}
if AliceRoutesStore != nil {
routesStatus = AliceRoutesStore.Stats()
}
neighboursStatus := NeighboursStoreStats{}
if AliceRoutesStore != nil {
neighboursStatus = AliceNeighboursStore.Stats()
}
status := &AppStatus{
Version: version,
Routes: routesStatus,
Neighbours: neighboursStatus,
}
return status, nil
}