diff --git a/core/nacos.go b/core/nacos.go index 4c4d1ce..9412e1d 100644 --- a/core/nacos.go +++ b/core/nacos.go @@ -49,6 +49,7 @@ func (n nacosClient) Remote(ctx *gin.Context) { }) if err != nil { Log.Error("获取健康服务失败: %v\n", err.Error()) + ctx.String(http.StatusBadGateway, "服务异常: %v", err.Error()) return } // 组装内部接口 @@ -57,6 +58,7 @@ func (n nacosClient) Remote(ctx *gin.Context) { req, err := http.NewRequest(ctx.Request.Method, apiUrl, ctx.Request.Body) if err != nil { Log.Error("请求异常: %v\n", err) + ctx.String(http.StatusBadGateway, "请求异常: %v", err.Error()) return } // 填充Form参数(大概率用不上) @@ -72,6 +74,7 @@ func (n nacosClient) Remote(ctx *gin.Context) { response, err := client.Do(req) if err != nil { Log.Error("请求异常: %v\n", err) + ctx.String(http.StatusBadGateway, "请求异常:%v", err.Error()) return } // 返回结果到前端 diff --git a/middleware/jaeger.go b/middleware/jaeger.go index f35c2b5..b699f7f 100644 --- a/middleware/jaeger.go +++ b/middleware/jaeger.go @@ -66,10 +66,10 @@ func NewJaegerTracer() (opentracing.Tracer, io.Closer) { tracer, closer, err := cfg.NewTracer() if err != nil { - core.Log.Error("Jaeger连接失败: %v", err.Error()) + //core.Log.Error("Jaeger连接失败: %v", err.Error()) return nil, nil } - core.Log.Debug("Jaeger连接成功") + //core.Log.Debug("Jaeger连接成功") opentracing.SetGlobalTracer(tracer) return tracer, closer }