fix: regression in internode bytes counting (#18880)

wire up missing metrics since #18461

Bonus: fix trace output inconsistency
This commit is contained in:
Harshavardhana
2024-01-27 00:25:49 -08:00
committed by GitHub
parent 1a91edecae
commit c51f9ef940
3 changed files with 29 additions and 15 deletions

View File

@@ -757,6 +757,10 @@ func (c *Connection) receive(conn net.Conn, r receiver) error {
if op != ws.OpBinary {
return fmt.Errorf("unexpected connect response type %v", op)
}
if c.incomingBytes != nil {
c.incomingBytes(int64(len(b)))
}
var m message
_, _, err = m.parse(b)
if err != nil {
@@ -938,9 +942,6 @@ func (c *Connection) handleMessages(ctx context.Context, conn net.Conn) {
logger.LogIfNot(ctx, fmt.Errorf("ws read: %w", err), net.ErrClosed, io.EOF)
return
}
if c.incomingBytes != nil {
c.incomingBytes(int64(len(msg)))
}
// Parse the received message
var m message
subID, remain, err := m.parse(msg)