forked from vitessio/vitess
/
status.go
30 lines (27 loc) · 975 Bytes
/
status.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
package main
import (
"github.com/youtube/vitess/go/vt/discovery"
"github.com/youtube/vitess/go/vt/servenv"
_ "github.com/youtube/vitess/go/vt/status"
"github.com/youtube/vitess/go/vt/vtgate"
"github.com/youtube/vitess/go/vt/vtgate/gateway"
)
// For use by plugins which wish to avoid racing when registering status page parts.
var onStatusRegistered func()
func addStatusParts(vtg *vtgate.VTGate) {
servenv.AddStatusPart("VSchema", vtgate.VSchemaTemplate, func() interface{} {
return vtg.VSchemaStats()
})
servenv.AddStatusPart("Topology Cache", vtgate.TopoTemplate, func() interface{} {
return resilientSrvTopoServer.CacheStatus()
})
servenv.AddStatusPart("Gateway Status", gateway.StatusTemplate, func() interface{} {
return vtg.GetGatewayCacheStatus()
})
servenv.AddStatusPart("Health Check Cache", discovery.HealthCheckTemplate, func() interface{} {
return healthCheck.CacheStatus()
})
if onStatusRegistered != nil {
onStatusRegistered()
}
}