Update metrics & fix grpc error

This commit is contained in:
criyle 2020-12-28 16:48:40 -08:00
parent 2df163126c
commit d66889f475
2 changed files with 2 additions and 6 deletions

View File

@ -58,7 +58,7 @@ func (e *execServer) Exec(ctx context.Context, req *pb.Request) (*pb.Response, e
rt := <-e.worker.Submit(ctx, r) rt := <-e.worker.Submit(ctx, r)
e.logger.Sugar().Debugf("response: %+v", rt) e.logger.Sugar().Debugf("response: %+v", rt)
if rt.Error != nil { if rt.Error != nil {
return nil, err return nil, rt.Error
} }
return convertPBResponse(rt), nil return convertPBResponse(rt), nil
} }

View File

@ -245,11 +245,7 @@ func newGRPCServer(conf *config.Config, esServer pb.ExecutorServer) *grpc.Server
func initGinMetrics(r *gin.Engine) { func initGinMetrics(r *gin.Engine) {
p := ginprometheus.NewPrometheus("gin") p := ginprometheus.NewPrometheus("gin")
p.ReqCntURLLabelMappingFn = func(c *gin.Context) string { p.ReqCntURLLabelMappingFn = func(c *gin.Context) string {
url := c.Request.URL.Path return c.FullPath()
for _, p := range c.Params {
url = strings.Replace(url, p.Value, ":"+p.Key, 1)
}
return url
} }
p.Use(r) p.Use(r)
} }