package tabletserver
import (
"github.com/youtube/vitess/go/vt/servenv"
)
// This file contains the status web page export for tabletserver
var queryserviceStatusTemplate = `
State: {{.State}}
QPS: {{.CurrentQPS}}
`
type queryserviceStatus struct {
State string
CurrentQPS float64
}
// AddStatusPart registers the status part for the status page.
func AddStatusPart() {
servenv.AddStatusPart("Queryservice", queryserviceStatusTemplate, func() interface{} {
status := queryserviceStatus{
State: SqlQueryRpcService.GetState(),
}
rates := qpsRates.Get()
if qps, ok := rates["All"]; ok && len(qps) > 0 {
status.CurrentQPS = qps[0]
}
return status
})
}