Skip to content

Quiet more error logs on stream canceled. #494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/agent/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import (

"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
"k8s.io/klog/v2"

commonmetrics "sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/common/metrics"
Expand Down Expand Up @@ -332,7 +334,11 @@ func (a *Client) Serve() {
klog.V(2).InfoS("received EOF, exit", "serverID", a.serverID, "agentID", a.agentID)
return
}
klog.ErrorS(err, "could not read stream", "serverID", a.serverID, "agentID", a.agentID)
if status.Code(err) == codes.Canceled {
klog.V(2).InfoS("stream canceled", "serverID", a.serverID, "agentID", a.agentID)
} else {
klog.ErrorS(err, "could not read stream", "serverID", a.serverID, "agentID", a.agentID)
}
return
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,11 @@ func (s *ProxyServer) readBackendToChannel(backend Backend, recvCh chan *client.
return
}
if err != nil {
klog.ErrorS(err, "Receive stream from agent read failure")
if status.Code(err) == codes.Canceled {
klog.V(2).InfoS("Stream read from agent cancelled", "agentID", agentID)
} else {
klog.ErrorS(err, "Receive stream from agent read failure", "agentID", agentID)
}
stopCh <- err
close(stopCh)
return
Expand Down