1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00

32 lines
737 B
Go
Raw Normal View History

2017-05-19 11:32:22 +02:00
package main
2017-05-19 11:57:25 +02:00
var version = "unknown"
2017-05-19 11:32:22 +02:00
// Gather application status information
type AppStatus struct {
2017-06-23 17:40:19 +02:00
Version string `json:"version"`
Routes RoutesStoreStats `json:"routes"`
Neighbours NeighboursStoreStats `json:"neighbours"`
2017-05-19 11:32:22 +02:00
}
// Get application status, perform health checks
// on backends.
func NewAppStatus() (*AppStatus, error) {
2017-06-23 16:25:33 +02:00
routesStatus := RoutesStoreStats{}
if AliceRoutesStore != nil {
routesStatus = AliceRoutesStore.Stats()
}
2017-06-23 17:40:19 +02:00
neighboursStatus := NeighboursStoreStats{}
if AliceRoutesStore != nil {
neighboursStatus = AliceNeighboursStore.Stats()
}
2017-05-19 11:32:22 +02:00
status := &AppStatus{
2017-06-23 17:40:19 +02:00
Version: version,
Routes: routesStatus,
Neighbours: neighboursStatus,
2017-05-19 11:32:22 +02:00
}
return status, nil
}