0

I need to implement gRPC health check so I can use my gRPC API in Kubernetes.

I've worked out that I need to put the health checking proto file in my server, and implement it.

It looks like there's a library that already implements it for Ruby, but I can't work out how to use it.

I've got the 'grpc' gem installed and I've tried this:

require 'grpc/health/checker'

# Implement health service.
health_svc = Grpc::Health::Checker.new
health_svc.add_status("plugin", Grpc::Health::V1::HealthCheckResponse::
ServingStatus::SERVING)

And I've tried this:

require 'health_check_services_pb'

class HealthCheckService < Grpc::Health::V1::Health::Service
  def check(req, req_view)
    checker = Grpc::Health::Checker.new
    checker.check(req, req_view)
  end
end

but I keep getting the error:

NameError: uninitialized constant Grpc::Health::Checker

So how do I use the library (other than copy all the library code from GitHub into my server)?

Toby 1 Kenobi
  • 4,717
  • 2
  • 29
  • 43

1 Answers1

2

Looks like the correct requires for the protobufs are

require 'grpc/health/v1/health_pb'
require 'grpc/health/v1/health_services_pb'

as found in checker_spec.rb