mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
Update metrics & fix grpc error
This commit is contained in:
parent
2df163126c
commit
d66889f475
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user