포트 수정 및 로그 추가

This commit is contained in:
2025-06-25 19:43:36 +09:00
parent 965d6fa5b9
commit cf4a2a3ea5

View File

@ -8,6 +8,7 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
"repositories.action2quare.com/ayo/gocommon/flagx" "repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/gocommon/logger"
"repositories.action2quare.com/ayo/houston/client" "repositories.action2quare.com/ayo/houston/client"
"net/http" "net/http"
@ -22,8 +23,18 @@ func main() {
} }
http.Handle("/metrics", promhttp.Handler()) http.Handle("/metrics", promhttp.Handler())
server := &http.Server{Addr: ":9100", Handler: nil} server := &http.Server{Addr: ":9200", Handler: nil}
go server.ListenAndServe() go func() {
defer func() {
logger.Println("metric server shutdown")
r := recover()
if r != nil {
logger.Println(r)
}
}()
server.ListenAndServe()
}()
hc.Start() hc.Start()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)