Skip to content

Commit b4bd4aa

Browse files
committed
pkg/loop/loop/net: log improvements
1 parent e5da126 commit b4bd4aa

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

pkg/loop/internal/net/broker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (b *BrokerExt) Serve(name string, server *grpc.Server, deps ...Resource) (u
108108
lis, err := b.Broker.Accept(id)
109109
if err != nil {
110110
b.CloseAll(deps...)
111-
return 0, Resource{}, ErrConnAccept{Name: name, ID: id, Err: err}
111+
return 0, Resource{}, ErrConnAccept{Broker: fmt.Sprintf("%p", b.Broker), Name: name, ID: id, Err: err}
112112
}
113113

114114
var wg sync.WaitGroup

pkg/loop/internal/net/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (c *clientConn) Invoke(ctx context.Context, method string, args interface{}
6464
c.Logger.Warnw("clientConn: Invoke: terminal error", "method", method, "err", err)
6565
return err
6666
}
67-
c.Logger.Warnw("clientConn: Invoke: terminal error, refreshing connection", "method", method, "err", err)
67+
c.Logger.Errorw("clientConn: Invoke: terminal error, refreshing connection", "method", method, "err", err)
6868
cc = c.refresh(ctx, cc)
6969
continue
7070
}
@@ -84,7 +84,7 @@ func (c *clientConn) NewStream(ctx context.Context, desc *grpc.StreamDesc, metho
8484
for cc != nil {
8585
s, err := cc.NewStream(ctx, desc, method, opts...)
8686
if isErrTerminal(err) {
87-
c.Logger.Warnw("clientConn: NewStream: terminal error, refreshing connection", "err", err)
87+
c.Logger.Errorw("clientConn: NewStream: terminal error, refreshing connection", "err", err)
8888
cc = c.refresh(ctx, cc)
8989
continue
9090
}

pkg/loop/internal/net/errors.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ import (
99
)
1010

1111
type ErrConnAccept struct {
12-
ID uint32
13-
Name string
14-
Err error
12+
Broker string
13+
ID uint32
14+
Name string
15+
Err error
1516
}
1617

1718
func (e ErrConnAccept) Error() string {
18-
return fmt.Sprintf("failed to accept %s server connection %d: %s", e.Name, e.ID, e.Err)
19+
return fmt.Sprintf("broker %s failed to accept %s server connection %d: %s", e.Broker, e.Name, e.ID, e.Err)
1920
}
2021

2122
func (e ErrConnAccept) Unwrap() error {

0 commit comments

Comments
 (0)