GrpcReflection (grpc_reflection v0.4.0)

View Source

Reflection support for the grpc-elixir package

Protos compiled with gen_descriptors=true provide the richest reflection output. If that option is omitted, this library synthesizes descriptors from runtime module metadata (__message_props__, __rpc_calls__). The synthesized path produces equivalent output for standard gRPC reflection clients; only proto2 extensions and custom proto options are unavailable without gen_descriptors=true.

To turn on reflection in your application, do the following:

  1. Create your reflection server

    defmodule Helloworld.Reflection.Server do
    use GrpcReflection.Server,
     version: :v1,
     services: [Helloworld.Greeter.Service]
    end
  2. Add the reflection supervisor to your supervision tree

    children = [
    {GRPC.Server.Supervisor, endpoint: Helloworld.Endpoint, port: 50051, start_server: true},
    GrpcReflection
    ]
  3. Add your reflection server to your endpoint

    defmodule Helloworld.Endpoint do
    use GRPC.Endpoint
    
    intercept(GRPC.Server.Interceptors.Logger)
    run(Helloworld.Greeter.Server)
    run(Helloworld.Reflection.Server)
    end