Skip to content

Commit 3b9f858

Browse files
committed
debug(todo-rm): print log
1 parent ee9c127 commit 3b9f858

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

api/handler/service_check.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package handler
2121
import (
2222
"context"
2323
"fmt"
24+
"github.com/goodrain/rainbond/pkg/component/etcd"
2425
"strings"
2526
"time"
2627

@@ -82,7 +83,7 @@ func (s *ServiceAction) GetServiceCheckInfo(uuid string) (*exector.ServiceCheckR
8283
var si exector.ServiceCheckResult
8384
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
8485
defer cancel()
85-
resp, err := s.EtcdCli.Get(ctx, k)
86+
resp, err := etcd.Default().EtcdClient.Get(ctx, k)
8687
if err != nil {
8788
logrus.Errorf("get etcd k %s error, %v", k, err)
8889
return nil, util.CreateAPIHandleError(503, err)

pkg/interceptors/http.go

+4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import (
2626
"github.com/goodrain/rainbond/pkg/component/hubregistry"
2727
"github.com/goodrain/rainbond/pkg/component/mq"
2828
"github.com/goodrain/rainbond/pkg/component/prom"
29+
"github.com/sirupsen/logrus"
2930
"net/http"
31+
"runtime/debug"
3032
"strings"
3133
)
3234

@@ -35,6 +37,8 @@ func Recoverer(next http.Handler) http.Handler {
3537
fn := func(w http.ResponseWriter, r *http.Request) {
3638
defer func() {
3739
if rvr := recover(); rvr != nil && rvr != http.ErrAbortHandler {
40+
debug.PrintStack()
41+
logrus.Errorf("panic: %v", rvr)
3842
handleServiceUnavailable(w, r)
3943
}
4044
}()

0 commit comments

Comments
 (0)