To provide better debugging information for my GRPC server/client setup, I am trying to find an API for grpc.server
that allows me to inspect what clients are connected to the server.
The most promising question I have found is question, which gives a starting point on how to do this in Java GRPC. However, the Java API doesn't exist in the Python GRPC implementation.
So far, I keep track of unique peers using the context.peer()
method in a grpc.ServicerContext
. If a peer hasn't sent a request in a while (a timeout I set to 2 seconds) I assume the client has disconnected.
I've started looking at the python-grpc source code but I haven't made any headway.
If anyone knows of a similar API in python I could use, that would be appreciated! Even an internal API would be sufficient for these debugging needs.
grpc-channelz
, then I'll be able to pull channelz statistics from "C-Core", but there is no documentation or examples as to how to do this programmatically in Python. Although if someone does have this documentation, I would love to discuss it in an answer! – Quitt