envoyproxy / java-control-plane

Java implementation of an Envoy gRPC control plane

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DiscoveryRequest validation and returning custom error response

MarcinFalkowski opened this issue · comments

Sometimes we need to validate DiscoveryRequest (mostly node metadata). Currently we can do it in DiscoveryServerCallbacks.onStreamRequest, but there is no simple way to return custom error response. Throwing exception in that method will result in returning status UNKNOWN without any description.

It would be nice to return custom status with description what actually is wrong with the request. This way in Envoy logs we will see that description instead of enigmatic line: gRPC config stream closed: 2,.

I prepared a PR with implementation.