mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-29 18:27:58 +08:00
[ADD] mq healthcheck api
This commit is contained in:
parent
9fc2bcbcbc
commit
5c228878fa
@ -43,6 +43,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/prometheus/common/version"
|
||||
httputil "github.com/goodrain/rainbond/util/http"
|
||||
)
|
||||
|
||||
type Manager struct {
|
||||
@ -105,6 +106,7 @@ func NewManager(c option.Config) (*Manager, error) {
|
||||
}
|
||||
go func() {
|
||||
Prometheus()
|
||||
health()
|
||||
if err := http.ListenAndServe(":6301", nil); err != nil {
|
||||
logrus.Error("mq pprof listen error.", err.Error())
|
||||
}
|
||||
@ -185,3 +187,11 @@ func Prometheus() {
|
||||
prometheus.MustRegister(exporter)
|
||||
http.Handle("/metrics", promhttp.Handler())
|
||||
}
|
||||
|
||||
func health() {
|
||||
http.HandleFunc("/health", checkHalth)
|
||||
}
|
||||
|
||||
func checkHalth(w http.ResponseWriter, r *http.Request) {
|
||||
httputil.ReturnSuccess(r, w, map[string]string{"status": "health", "info": "mq service health"})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user