-
Notifications
You must be signed in to change notification settings - Fork 140
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
fix log and change rpc in response to json rpc error #474
fix log and change rpc in response to json rpc error #474
Conversation
common/geth/handle_error.go
Outdated
@@ -25,7 +25,7 @@ const ( | |||
func (f *FailoverController) handleHttpError(httpRespError rpc.HTTPError) (NextEndpoint, ImmediateAction) { | |||
sc := httpRespError.StatusCode | |||
// Default to rotation the current RPC, because it allows a higher chance to get the query completed. | |||
f.Logger.Info("[HTTP Response Error]", "Status Code", sc, "Error", httpRespError) | |||
f.Logger.Info("[HTTP Response Error]", "Curr Rpc Fault", f.numberRpcFault, "Status Code", sc, "Error", httpRespError) |
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.
Let's not use spaces as attribute labels
f.Logger.Info("[HTTP Response Error]", "numRPCFfault", f.numberRpcFault, "statusCode", sc, "err", httpRespError)
common/geth/handle_error.go
Outdated
f.Logger.Info("[JSON RPC Response Error]", "Error Code", ec, "Error", rpcError) | ||
// we always attribute JSON RPC error as sender's fault, i.e no connection rotation | ||
return CurrentRPC, Return | ||
f.Logger.Warn("[JSON RPC Response Error]", "numRPCFfault", f.numberRpcFault, "errorCode", ec, "err", rpcError) |
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.
Is it possible to extract top level domain (ie strip api token) from url and include it in message so that oncall knows exactly which provider failed?
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.
addressed, please take a look
common/geth/handle_error.go
Outdated
} | ||
|
||
// If no http response or no rpc response is returned, it is a connection issue, | ||
// since we can't accurately attribute the network issue to neither sender nor receiver | ||
// side. Optimistically, switch rpc client | ||
f.Logger.Info("[Default Response Error]", err) | ||
f.Logger.Warn("[Default Response Error]", "numRPCFfault", f.numberRpcFault, "err", 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.
Is it logged anywhere when it switches to a different RPC endpoint? That'd be a useful information to see from logs
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.
yes, logged
common/geth/handle_error.go
Outdated
@@ -51,7 +51,8 @@ func (f *FailoverController) handleHttpError(httpRespError rpc.HTTPError) (NextE | |||
// If the error is http, non2xx error would generate HTTP error, https://github.com/ethereum/go-ethereum/blob/master/rpc/http.go#L233 | |||
// but a 2xx http response could contain JSON RPC error, https://github.com/ethereum/go-ethereum/blob/master/rpc/http.go#L181 | |||
// If the error is Websocket or IPC, we only look for JSON error, https://github.com/ethereum/go-ethereum/blob/master/rpc/json.go#L67 | |||
|
|||
// | |||
// This function is protected by mutex from the outside |
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.
nit: "This function assumes the mutex protection from caller to ensure thread safety"
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.
will remove
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.
🙏
Why are these changes needed?
Checks