-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor(bigquery/storage/managedwriter): refactor error metrics #8314
refactor(bigquery/storage/managedwriter): refactor error metrics #8314
Conversation
This is a small refactor to how opencensus metrics are reported when receiving responses from the server. There's effectively two cases where we consider an error to have occurred on receive: * Invoking gRPC Recv() on the connection emitted an error, typically a transport issue * The service embedded an error in the response, which is more akin to an application error (failed to commit data, offset mismatch, etc). This CL ensures we increment the existing AppendResponseError count metric in both causes, and deals with the unlikely scenario where we're unable to tag the report with the status code. When that happens, we simply record the metric uncoded.
@@ -494,18 +494,29 @@ func connRecvProcessor(ctx context.Context, co *connection, arc storagepb.BigQue | |||
resp, err := arc.Recv() | |||
co.release(nextWrite) | |||
if err != nil { | |||
// The Recv() itself yielded an error. We increment AppendResponseErrors by one, tagged by the status | |||
// code. | |||
status := grpcstatus.Convert(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if status
can be nil
here as this err
is coming from a grpc stream method. Might worth add the extra check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an io.EOF
will probably cause grpcstatus.Convert
to return nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wraps the error as a code.Unknown if it doesn't embed an rpc status error, ex: https://github.com/grpc/grpc-go/blob/faab8736bf73291f92b867d5dae31c927d53d508/status/status.go#L96-L125
This is a small refactor to how opencensus metrics are reported when receiving responses from the server.
There's effectively two cases where we consider an error to have occurred on receive:
Invoking gRPC Recv() on the connection emitted an error, typically a transport issue
The service embedded an error in the response, which is more akin to an application error (failed to commit data, offset mismatch, etc).
This CL ensures we increment the existing AppendResponseError count metric in both causes, and deals with the unlikely scenario where we're unable to tag the report with the status code. When that happens, we simply record the metric uncoded.
Towards: #8311