envoyproxy / envoyproxy/java-control-plane

Refactoring to onStreamOpen, onStreamClose, and onStreamCloseWithError to include Node

オープン
#40 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
312
フォーク
149
PR マージ指標
30日以内にマージされた PR はありません

説明

Relevant discussion: https://github.com/envoyproxy/java-control-plane/pull/35#discussion_r177099465

Ideally we would have access to the `Node` during the stream open and close callbacks. Due to the stream observer design, there are some tradeoffs in order to support that.

For `onStreamOpen`, currently we're triggering that callback outside of the request `StreamObserver`. At that point, we haven't actually received a `DiscoveryRequest` yet, so we haven't been given the `Node` yet. A potential workaround would be to delay the `onStreamOpen` event until we receive the first request message. In theory there could be an arbitrarily large gap between when the stream is actually opened and when the first request is sent and with this approach we lose the ability to measure that. In practice, is that something that we really care about for this use case? With the ADS/xDS protocol design, the first message is always sent from the client and it occurs immediately after the stream is opened.

For `onStreamClose` and `onStreamCloseWithError`, we can just cache the `Node` from the last request message. Consumers will just need to be aware that the node parameter in this scenario is `@Nullable` because the stream could close without ever receiving a request.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。