grpc / grpc/grpc-java

Getting feedback on errors while using waitForReady or enableRetry

Aperta
#6,569 5 commenti 0 reazioni 1 assegnatario Rivendicata da @ejona86 Vedi su GitHub
enhancement
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

### 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;

}
})
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.