The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Richard Belleville d932d2368e
Merge pull request #19852 from gnossen/server_termination
5 years ago
..
test Remove unused imports 6 years ago
BUILD.bazel Fix up examples. 5 years ago
README.md
debug_server.py Quit waiting for a day 5 years ago
get_stats.py Add TODOs for prefix stripping 5 years ago
send_message.py

README.md

gRPC Python Debug Example

This example demonstrate the usage of Channelz. For a better looking website, the gdebug uses gRPC-Web protocol and will serve all useful information in web pages.

Channelz: Live Channel Tracing

Channelz is a channel tracing feature. It will track statistics like how many messages have been sent, how many of them failed, what are the connected sockets. Since it is implemented in C-Core and has low-overhead, it is recommended to turn on for production services. See Channelz design doc.

How to enable tracing log

The tracing log generation might have larger overhead, especially when you try to trace transport. It would result in replicating the traffic loads. However, it is still the most powerful tool when you need to dive in.

The Most Verbose Tracing Log

Specify environment variables, then run your application:

GRPC_VERBOSITY=debug
GRPC_TRACE=all

For more granularity, please see environment_variables.

Debug Transport Protocol

GRPC_VERBOSITY=debug
GRPC_TRACE=tcp,http,secure_endpoint,transport_security

Debug Connection Behavior

GRPC_VERBOSITY=debug
GRPC_TRACE=call_error,connectivity_state,pick_first,round_robin,glb

How to debug your application?

pdb is a debugging tool that is available for Python interpreters natively. You can set breakpoint, and execute commands while the application is stopped.

The simplest usage is add a single line in the place you want to inspect: import pdb; pdb.set_trace(). When interpreter see this line, it would pop out a interactive command line interface for you to inspect the application state.

For more detailed usage, see https://docs.python.org/3/library/pdb.html.

Caveat: gRPC Python uses C-Extension under-the-hood, so pdb may not be able to trace through the whole stack.

gRPC Command Line Tool

grpc_cli is a handy tool to interact with gRPC backend easily. Imageine you can inspect what service does a server provide without writing any code, and make gRPC calls just like curl.

The installation guide: https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md#code-location The usage guide: https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md#usage The source code: https://github.com/grpc/grpc/blob/master/test/cpp/util/grpc_cli.cc