Files
houston/main_client.go

34 lines
588 B
Go
Raw Normal View History

//go:build client
package main
import (
"context"
"time"
2023-11-16 19:47:30 +09:00
"github.com/prometheus/client_golang/prometheus/promhttp"
"repositories.action2quare.com/ayo/gocommon/flagx"
"repositories.action2quare.com/ayo/houston/client"
"net/http"
)
func main() {
flagx.Parse()
hc, err := client.NewClient(true)
if err != nil {
panic(err)
}
2023-11-16 19:47:30 +09:00
http.Handle("/metrics", promhttp.Handler())
server := &http.Server{Addr: ":9100", Handler: nil}
go server.ListenAndServe()
hc.Start()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
2023-11-16 19:47:30 +09:00
server.Shutdown(ctx)
cancel()
}