grpc-mate icon indicating copy to clipboard operation
grpc-mate copied to clipboard

Support filtering results from /actuator/services endpoint

Open gdong42 opened this issue 5 years ago • 0 comments

Currently grpc-mate provides /actuator/services endpoint that returns all services, methods and types. An example response:

{
   "services":[
      {
         "name":"grpc.examples.echo.Echo",
         "methods":[
            {
               "name":"UnaryEcho",
               "input":"grpc.examples.echo.EchoRequest",
               "output":"grpc.examples.echo.EchoResponse",
               "route":"/grpc.examples.echo.Echo/UnaryEcho"
            },
            {
               "name":"ServerStreamingEcho",
               "input":"grpc.examples.echo.EchoRequest",
               "output":"grpc.examples.echo.EchoResponse",
               "route":"/grpc.examples.echo.Echo/ServerStreamingEcho"
            },
            {
               "name":"ClientStreamingEcho",
               "input":"grpc.examples.echo.EchoRequest",
               "output":"grpc.examples.echo.EchoResponse",
               "route":"/grpc.examples.echo.Echo/ClientStreamingEcho"
            },
            {
               "name":"BidirectionalStreamingEcho",
               "input":"grpc.examples.echo.EchoRequest",
               "output":"grpc.examples.echo.EchoResponse",
               "route":"/grpc.examples.echo.Echo/BidirectionalStreamingEcho"
            }
         ]
      },
      {
         "name":"grpc.reflection.v1alpha.ServerReflection",
         "methods":[
            {
               "name":"ServerReflectionInfo",
               "input":"grpc.reflection.v1alpha.ServerReflectionRequest",
               "output":"grpc.reflection.v1alpha.ServerReflectionResponse",
               "route":"/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo"
            }
         ]
      },
      {
         "name":"helloworld.Greeter",
         "methods":[
            {
               "name":"SayHello",
               "input":"helloworld.HelloRequest",
               "output":"helloworld.HelloReply",
               "route":"/helloworld.Greeter/SayHello"
            }
         ]
      }
   ],
   "types":[
      {
         "name":"grpc.examples.echo.EchoResponse",
         "template":{
            "message":""
         }
      },
      {
         "name":"grpc.reflection.v1alpha.ServerReflectionRequest",
         "template":{
            "host":"",
            "fileContainingExtension":{
               "containingType":"",
               "extensionNumber":0
            }
         }
      },
      {
         "name":"grpc.reflection.v1alpha.ServerReflectionResponse",
         "template":{
            "validHost":"",
            "originalRequest":{
               "host":"",
               "fileContainingExtension":{
                  "containingType":"",
                  "extensionNumber":0
               }
            },
            "errorResponse":{
               "errorCode":0,
               "errorMessage":""
            }
         }
      },
      {
         "name":"helloworld.HelloRequest",
         "template":{
            "name":""
         }
      },
      {
         "name":"helloworld.HelloReply",
         "template":{
            "message":""
         }
      },
      {
         "name":"grpc.examples.echo.EchoRequest",
         "template":{
            "message":""
         }
      }
   ]
}

The resulting output could be quite long and hard to read for a real-world gRPC server that has loads of services. It would be nice to filter these results by service name and method to only show relevant parts.

e.g.

  • /actuator/services?name=grpc.examples.echo.Echo returns only service with name grpc.examples.echo.Echo, its methods, and types that are relevant.
  • /actuator/services?method=ServerStreamingEcho returns services that have method name as ServerStreamingEcho, this method, and types that are relevant.

Of course, both name and method can be specified at the same time.

Not sure if filtering type is a valid use case as well. Let's not add the type parameter for now. Keep it simple.

gdong42 avatar Jul 10 '19 16:07 gdong42