update grpc, service: implements reflection.GRPCService

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2022-03-11 13:42:02 +01:00
parent 08a67bf162
commit 2832f13f3c
5 changed files with 105 additions and 144 deletions

View File

@ -11,6 +11,7 @@ import (
"strings"
"time"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@ -119,11 +120,18 @@ func run(opts ...service.Option) {
panic(err)
}
RegisterGreeterServer(svc, &GreeterHandler{})
metrics2.Register(svc)
go func() {
if err := svc.Start(); err != nil {
panic(err)
}
}()
go func() {
http.Handle("/metrics", promhttp.Handler())
if err := http.ListenAndServe(":9992", nil); err != nil {
panic(err)
}
}()
<-ready
s, err := client.New(
// client.WithName(name),