37 lines
623 B
Go
37 lines
623 B
Go
//go:build client
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
"repositories.action2quare.com/ayo/gocommon/flagx"
|
|
"repositories.action2quare.com/ayo/houston/client"
|
|
|
|
"net/http"
|
|
"runtime"
|
|
)
|
|
|
|
func main() {
|
|
runtime.GOMAXPROCS(1)
|
|
|
|
flagx.Parse()
|
|
|
|
hc, err := client.NewClient(true)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
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)
|
|
|
|
server.Shutdown(ctx)
|
|
cancel()
|
|
}
|