Log tier1 client disconnects as Canceled, not Unknown#832
Open
sduchesneau wants to merge 1 commit into
Open
Conversation
toGrpcTier1Error returned a connect error for the context-canceled case,
while every other branch returns a gRPC status error. status.Code() on a
connect error resolves to Unknown, so client disconnects were logged as a
WARN ("Blocks request completed with error") and the gRPC middleware
reported the call at ERROR with code Unknown. Return codes.Canceled so
the disconnect is logged quietly at Debug/Info.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Client disconnects on a tier1 Blocks stream (
context canceled) are logged noisily atWARNINGandERROR:Root cause
toGrpcTier1Error(service/error.go) returns a connect error for the context-canceled case:Every other branch in that function returns a gRPC
status.Error(codes.X, ...). The caller inservice_grpc.gothen doesstatus.Code(grpcErr)— andstatus.Code()on a connect error (not a gRPC status) returnscodes.Unknown. So:service_grpc.gofalls through todefault→logger.Warn("Blocks request completed with error")instead of thecodes.Canceledcase (Debug).Unknown→ logs the finished call atERROR(grpc_zapmapsUnknown→Error,Canceled→Info).Fix
Return a gRPC status error for the canceled branch, consistent with the rest of the function:
Now
status.Code()resolves tocodes.Canceled:service_grpc.gologs at Debug ("Blocks request canceled by user"), and the middleware logs the call at Info. The connect path (toConnectError) already handled this correctly and is unchanged.🤖 Generated with Claude Code