Profile the grpc server.
Provide a grpc interceptor to profile each request in the cProfile module.
$ pip install -U py-grpc-profile
Load the module and set the interceptors.
from concurrent import futures
import grpc
from py_grpc_profile.server.interceptor import ProfileInterceptor
# ...
server = grpc.server(
futures.ThreadPoolExecutor(max_workers=10),
interceptors=[ProfileInterceptor()],
)
# ...
The complete code is available in example. You can find more details there.