-
Notifications
You must be signed in to change notification settings - Fork 18
/
diag.go
34 lines (30 loc) · 979 Bytes
/
diag.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
package restful
import (
"github.com/Cepave/open-falcon-backend/common/gin/mvc"
apiModel "github.com/Cepave/open-falcon-backend/common/model/mysqlapi"
"github.com/Cepave/open-falcon-backend/modules/mysqlapi/rdb"
"github.com/Cepave/open-falcon-backend/modules/mysqlapi/service"
)
func health() mvc.OutputBody {
portalRdbDiag := rdb.GlobalDbHolder.Diagnose(rdb.DB_PORTAL)
graphRdbDiag := rdb.GlobalDbHolder.Diagnose(rdb.DB_GRAPH)
health := &apiModel.HealthView{
Rdb: &apiModel.AllRdbHealth{
Dsn: portalRdbDiag.Dsn,
OpenConnections: portalRdbDiag.OpenConnections,
PingResult: portalRdbDiag.PingResult,
PingMessage: portalRdbDiag.PingMessage,
Portal: portalRdbDiag,
Graph: graphRdbDiag,
},
Http: &apiModel.Http{
Listening: GinConfig.GetAddress(),
},
Nqm: &apiModel.Nqm{
Heartbeat: &apiModel.Heartbeat{
Count: service.NqmQueue.ConsumedCount(),
},
},
}
return mvc.JsonOutputBody(health)
}