Skip to content
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

Stabilize channel state API #4359

Open
ejona86 opened this issue Apr 19, 2018 · 7 comments
Open

Stabilize channel state API #4359

ejona86 opened this issue Apr 19, 2018 · 7 comments
Labels
experimental API Issue tracks stabilizing an experimental API
Milestone

Comments

@ejona86
Copy link
Member

ejona86 commented Apr 19, 2018

ManagedChannel.getState(), ManagedChannel.notifyWhenStateChanged(), and ConnectivityState.

@ejona86 ejona86 added the experimental API Issue tracks stabilizing an experimental API label Apr 19, 2018
@ejona86 ejona86 added this to the Next milestone Apr 19, 2018
@ejona86 ejona86 changed the title Channel state API is experimental Stabilize channel state API Apr 19, 2018
@chbatey
Copy link

chbatey commented Jul 10, 2018

Would it be possible to extend this API to observe every state change? E.g. rather than a one off callback a consumer that receives the previous and new state for each state change?

@ejona86
Copy link
Member Author

ejona86 commented Jul 10, 2018

Not really. It was an explicit design goal to avoid showing every state change. Basically, state changes can happen very rapidly and that would cause them to queue up, depending on the processing speed of the application.

@chbatey, what is your use-case for seeing every transition?

@abekenza
Copy link

abekenza commented Aug 7, 2018

Not sure if I am writing in correct thread, but in my use case users should be able to see current connection state like: connecting and connected

ezgif com-video-to-gif

@ejona86
Copy link
Member Author

ejona86 commented Aug 8, 2018

@abekenza, yes, this is the correct API. You can use ManagedChannel.getState() and notifyWhenStateChanged()

@ptravers
Copy link

👋 I am planning to use this API in a production setting so was curious as to what work is left to stabilise this API?

@ejona86
Copy link
Member Author

ejona86 commented Mar 11, 2021

There are no plans to change the methods and enum list. However, the specific meaning/transitions between states is a little in flux. In particular, after TRANSIENT_FAILURE we go back to IDLE (and then later CONNECTING) after a backoff period. However, that causes "lurches" of extremely poor RPC latency when things are broken, for little benefit, because we queue RPCs for IDLE/CONNECTING and broken networks can take a long time for connection attempts to fail. It is described in part in #6650 . But essentially, I want to make a similar change to pick_first where things stay in TRANSIENT_FAILURE until proven to be healthy again (at which point we've clearly minorly redefined the meaning of the enum states). But there's difficulty with pick_first that needs to be discussed cross-language.

I don't expect any changes to break users of this API using it for health/status notification. But if someone is using the API and changing their RPC behavior because of what it returns (e.g., not sending RPCs if the Channel is TRANSIENT_FAILURE), then there could be surprises (it should be fine, but technically it is a behavior/API change and I really don't want to argue with people if it causes minor problems). I also wouldn't be surprised if some users were using the API to reverse engineer our exponential backoff state, and that would definitely break.

@larry-safran
Copy link
Contributor

The 2 methods are okay, but for ConnectivityState we recently changed the behavior with pickFirst sticky TF state and some of the descriptions are not true.
Shouldn't talk about transitions in the state descriptions.

Prereq cross language definition of states

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental API Issue tracks stabilizing an experimental API
Projects
None yet
Development

No branches or pull requests

5 participants