question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

any way to get the state in GrpcChannel

See original GitHub issue

In grpc C# (core library based) , Channel has a State property, which Gets current connectivity state of this channel.

Any way to get the state in grpc-dotnet

https://github.com/grpc/grpc/blob/master/src/csharp/Grpc.Core/Channel.cs


        /// <summary>
        /// Gets current connectivity state of this channel.
        /// After channel has been shutdown, <c>ChannelState.Shutdown</c> will be returned.
        /// </summary>
        public ChannelState State
        {
            get
            {
                return GetConnectivityState(false);
            }
        }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
JamesNKcommented, Sep 26, 2021

This is supported in the latest preview*. There is a state property and method to subscribe to state changes.

https://github.com/grpc/grpc-dotnet/blob/7c35727de4e3f4782808021ace55c441783f119d/src/Grpc.Net.Client/GrpcChannel.cs#L520-L581

*Note that it is only available in previews at the moment. Stable versions are skipping this feature until it is properly tested.

1reaction
tank104commented, Nov 13, 2022

@JamesNK when you say its supported in Preview - it looks like we need to compile with SUPPORT_LOAD_BALANCING. Is this kind of a preview compilation tag? Also has been a year, so just wondering when plans would be to incorporate it into main build?

Read more comments on GitHub >

github_iconTop Results From Across the Web

gRPC Connectivity Semantics and API
All gRPC libraries will expose a channel-level API method to poll the current state of a channel. In C++, this method is called...
Read more >
java - getting connection state for GRPC
I am trying to get the connection state for a GRPC (Java API) connection via the call copied below. Based on the notes...
Read more >
Call gRPC services with the .NET client
Make gRPC calls. A gRPC call is initiated by calling a method on the client. The gRPC client will handle message serialization and...
Read more >
A Deep Dive into Working with gRPC in .NET 6
In this article, I'll look at the basics of gRPC, including how to create a simple service with gRPC in ASP.NET Core application...
Read more >
Core concepts, architecture and lifecycle
A channel has state, including connected and idle . How gRPC deals with closing a channel is language dependent. Some languages also permit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found