grpc / grpc/grpc-java

Getting feedback on errors while using waitForReady or enableRetry

Open
#6,569 5 comments 0 reactions 1 assignee Claimed by @ejona86 View on GitHub
enhancement
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

### Is your feature request related to a problem?
yes using the connection retry and/or , rpc retry blocks all feedback from coming back to the user.

### Describe the solution you'd like

i'd like to have an onError callback either for the context/stream/channel that i'd be able to report back to the user, i'm aware that while the error is being reported a race condition may occur that will no longer make it valid for that time, but the user should have the option to decide if they should respond or do something with it.

since GRPC's logging is based on java logging, it cannot be integrated with the standard application logging framework, so even the errors themselves aren't always visible at all.

this is problematic when you situations where failure in services are being reported to a main dashboard or SLA team, the retry logic should continue to execute, while a reporting mechanism should be in place to send feedback in real time if the failures have stopped happening.

### Describe alternatives you've considered
attempting to use getState(false) or notifyStateChanged proved to be unreliable
notifyStateChange doesn't tell why it has happened, and getState is too transient to be called periodically.

attempting to subclass netty proved to be too sensitive and will brake in future versions:

```
NettyChannelBuilder.forAddress("",0)
.withOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 50)
.channelFactory(new ChannelFactory() {
@override
public io.netty.channel.Channel newChannel() {
final NioSocketChannel nioSocketChannel = new
NioSocketChannel() {
@override
public ChannelFuture connect(SocketAddress remoteAddress) {
final ChannelFuture connect =
super.connect(remoteAddress);

connect.addListener((GenericFutureListener)
channelFuture -> {
final Throwable cause = channelFuture.cause();
if (cause != null) {
cause.printStackTrace();
}
});
return connect;
}
};

return nioSocketChannel;

}
})
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.