Add health endpoint for worker (#2442)
* Return worker process information in the health endpoint. Experimental: The worker_info and returned worker_process_info fields are experimental and can change or be removed without notice. When a user passes in "worker_info=1" or "worker_info=true" and a worker is running the returned json will be returned with a key named "worker_process_info" which value is a json object with information about the worker process.
This commit is contained in:
19 files changed
+848
-401
No files matched your search
@@ -815,7 +815,7 @@ func (c *Command) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
|
||||
opsServer, err := ops.NewServer(c.Logger, c.controller, c.Listeners...)
|
||||
opsServer, err := ops.NewServer(c.Logger, c.controller, c.worker, c.Listeners...)
|
||||
if err != nil {
|
||||
c.UI.Error(fmt.Errorf("Failed to start ops listeners: %w", err).Error())
|
||||
return base.CommandCliError
|
||||
|
||||
@@ -492,7 +492,7 @@ func (c *Command) Run(args []string) int {
|
||||
return base.CommandCliError
|
||||
}
|
||||
|
||||
opsServer, err := ops.NewServer(c.Logger, c.controller, c.Listeners...)
|
||||
opsServer, err := ops.NewServer(c.Logger, c.controller, c.worker, c.Listeners...)
|
||||
if err != nil {
|
||||
c.UI.Error(err.Error())
|
||||
return base.CommandCliError
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller"
|
||||
"github.com/hashicorp/boundary/internal/daemon/worker"
|
||||
"github.com/hashicorp/go-cleanhttp"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
@@ -36,7 +37,7 @@ type opsBundle struct {
|
||||
|
||||
// NewServer iterates through all the listeners and sets up HTTP Servers for each, along with individual handlers.
|
||||
// If Controller is set-up, NewServer will set-up a health endpoint for it.
|
||||
func NewServer(l hclog.Logger, c *controller.Controller, listeners ...*base.ServerListener) (*Server, error) {
|
||||
func NewServer(l hclog.Logger, c *controller.Controller, w *worker.Worker, listeners ...*base.ServerListener) (*Server, error) {
|
||||
const op = "ops.NewServer()"
|
||||
if l == nil {
|
||||
return nil, fmt.Errorf("%s: missing logger", op)
|
||||
@@ -54,7 +55,7 @@ func NewServer(l hclog.Logger, c *controller.Controller, listeners ...*base.Serv
|
||||
return nil, fmt.Errorf("%s: missing ops listener", op)
|
||||
}
|
||||
|
||||
h, err := createOpsHandler(ln.Config, c)
|
||||
h, err := createOpsHandler(ln.Config, c, w)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -128,16 +129,30 @@ func (s *Server) WaitIfHealthExists(d time.Duration, ui cli.Ui) {
|
||||
<-time.After(d)
|
||||
}
|
||||
|
||||
func createOpsHandler(lncfg *listenerutil.ListenerConfig, c *controller.Controller) (http.Handler, error) {
|
||||
func createOpsHandler(lncfg *listenerutil.ListenerConfig, c *controller.Controller, w *worker.Worker) (http.Handler, error) {
|
||||
mux := http.NewServeMux()
|
||||
if c != nil && c.HealthService != nil {
|
||||
h, err := c.GetHealthHandler(lncfg)
|
||||
var h http.Handler
|
||||
var err error
|
||||
switch {
|
||||
case c != nil && c.HealthService != nil:
|
||||
h, err = c.GetHealthHandler(lncfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if w != nil {
|
||||
c.HealthService.SetWorkerProcessInformationFunc(w.HealthInformation)
|
||||
}
|
||||
case w != nil:
|
||||
h, err = w.GetHealthHandler()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if h != nil {
|
||||
// Shouldn't happen since this function should only be called when
|
||||
// either a controller or worker is starting up, but just to be safe.
|
||||
mux.Handle("/health", h)
|
||||
}
|
||||
|
||||
mux.Handle("/metrics", promhttp.Handler())
|
||||
return cleanhttp.PrintablePathCheckHandler(mux, nil), nil
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"crypto/x509"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math/big"
|
||||
"net"
|
||||
@@ -17,16 +18,25 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller"
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/handlers/health"
|
||||
"github.com/hashicorp/boundary/internal/daemon/worker"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/ops/services"
|
||||
pbhealth "github.com/hashicorp/boundary/internal/gen/worker/health"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-secure-stdlib/base62"
|
||||
"github.com/hashicorp/go-secure-stdlib/configutil/v2"
|
||||
"github.com/hashicorp/go-secure-stdlib/listenerutil"
|
||||
"github.com/hashicorp/go-secure-stdlib/reloadutil"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
func TestNewServer(t *testing.T) {
|
||||
@@ -34,6 +44,7 @@ func TestNewServer(t *testing.T) {
|
||||
name string
|
||||
logger hclog.Logger
|
||||
c *controller.Controller
|
||||
w *worker.Worker
|
||||
listeners []*base.ServerListener
|
||||
assertions func(t *testing.T, s *Server)
|
||||
expErr bool
|
||||
@@ -93,7 +104,7 @@ func TestNewServer(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
s, err := NewServer(tt.logger, tt.c, tt.listeners...)
|
||||
s, err := NewServer(tt.logger, tt.c, tt.w, tt.listeners...)
|
||||
if tt.expErr {
|
||||
require.EqualError(t, err, tt.expErrMsg)
|
||||
require.Nil(t, s)
|
||||
@@ -265,7 +276,7 @@ func TestNewServerIntegration(t *testing.T) {
|
||||
err := bs.SetupListeners(nil, &configutil.SharedConfig{Listeners: tt.listeners}, []string{"ops"})
|
||||
require.NoError(t, err)
|
||||
|
||||
s, err := NewServer(hclog.Default(), nil, bs.Listeners...)
|
||||
s, err := NewServer(hclog.Default(), nil, nil, bs.Listeners...)
|
||||
if tt.expErr {
|
||||
require.EqualError(t, err, tt.expErrMsg)
|
||||
require.Nil(t, s)
|
||||
@@ -562,7 +573,7 @@ func TestHealthEndpointLifecycle(t *testing.T) {
|
||||
t.Cleanup(tc.Shutdown)
|
||||
|
||||
// Controller has started and is set onto our Command object, start ops.
|
||||
opsServer, err := NewServer(hclog.Default(), tc.Controller(), tc.Config().Listeners...)
|
||||
opsServer, err := NewServer(hclog.Default(), tc.Controller(), nil, tc.Config().Listeners...)
|
||||
require.NoError(t, err)
|
||||
opsServer.Start()
|
||||
|
||||
@@ -655,6 +666,7 @@ func TestCreateOpsHandler(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
setupController bool
|
||||
setupWorker bool
|
||||
lncfg *listenerutil.ListenerConfig
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
@@ -678,6 +690,64 @@ func TestCreateOpsHandler(t *testing.T) {
|
||||
rsp, err := http.Get("http://" + addr + "/health")
|
||||
require.NoError(t, err) // We can do the GET request
|
||||
require.Equal(t, http.StatusOK, rsp.StatusCode) // And the endpoint exists
|
||||
body, err := io.ReadAll(rsp.Body)
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, []byte("{}"), body)
|
||||
|
||||
rsp, err = http.Get("http://" + addr + "/health?worker_info=1")
|
||||
require.NoError(t, err) // We can do the GET request
|
||||
require.Equal(t, http.StatusOK, rsp.StatusCode) // And the endpoint exists
|
||||
body, err = io.ReadAll(rsp.Body)
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, []byte("{}"), body)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "worker set",
|
||||
setupWorker: true,
|
||||
lncfg: &listenerutil.ListenerConfig{},
|
||||
assertions: func(t *testing.T, addr string) {
|
||||
rsp, err := http.Get("http://" + addr + "/health")
|
||||
require.NoError(t, err) // We can do the GET request
|
||||
require.Equal(t, http.StatusOK, rsp.StatusCode) // And the endpoint exists
|
||||
body, err := io.ReadAll(rsp.Body)
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, []byte("{}"), body)
|
||||
|
||||
rsp, err = http.Get("http://" + addr + "/health?worker_info=1")
|
||||
require.NoError(t, err) // We can do the GET request
|
||||
require.Equal(t, http.StatusOK, rsp.StatusCode) // And the endpoint exists
|
||||
pbResp := &pbs.GetHealthResponse{}
|
||||
require.NoError(t, jsonpb.Unmarshal(rsp.Body, pbResp))
|
||||
want := &pbs.GetHealthResponse{WorkerProcessInfo: &pbhealth.HealthInfo{
|
||||
State: server.ActiveOperationalState.String(),
|
||||
ActiveSessionCount: wrapperspb.UInt32(0),
|
||||
}}
|
||||
assert.Empty(t, cmp.Diff(want, pbResp, protocmp.Transform()))
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "worker and controller set",
|
||||
setupController: true,
|
||||
setupWorker: true,
|
||||
lncfg: &listenerutil.ListenerConfig{},
|
||||
assertions: func(t *testing.T, addr string) {
|
||||
rsp, err := http.Get("http://" + addr + "/health")
|
||||
require.NoError(t, err) // We can do the GET request
|
||||
require.Equal(t, http.StatusOK, rsp.StatusCode) // And the endpoint exists
|
||||
body, err := io.ReadAll(rsp.Body)
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, []byte("{}"), body)
|
||||
rsp, err = http.Get("http://" + addr + "/health?worker_info=1")
|
||||
require.NoError(t, err) // We can do the GET request
|
||||
require.Equal(t, http.StatusOK, rsp.StatusCode) // And the endpoint exists
|
||||
pbResp := &pbs.GetHealthResponse{}
|
||||
require.NoError(t, jsonpb.Unmarshal(rsp.Body, pbResp))
|
||||
want := &pbs.GetHealthResponse{WorkerProcessInfo: &pbhealth.HealthInfo{
|
||||
State: server.ActiveOperationalState.String(),
|
||||
ActiveSessionCount: wrapperspb.UInt32(0),
|
||||
}}
|
||||
assert.Empty(t, cmp.Diff(want, pbResp, protocmp.Transform()))
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -698,8 +768,14 @@ func TestCreateOpsHandler(t *testing.T) {
|
||||
|
||||
c = tc.Controller()
|
||||
}
|
||||
var w *worker.Worker
|
||||
if tt.setupWorker {
|
||||
tc := worker.NewTestWorker(t, &worker.TestWorkerOpts{})
|
||||
t.Cleanup(tc.Shutdown)
|
||||
w = tc.Worker()
|
||||
}
|
||||
|
||||
h, err := createOpsHandler(tt.lncfg, c)
|
||||
h, err := createOpsHandler(tt.lncfg, c, w)
|
||||
if tt.expErr {
|
||||
require.EqualError(t, err, tt.expErrMsg)
|
||||
require.Nil(t, h)
|
||||
|
||||
@@ -39,7 +39,7 @@ import (
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/internal/metric"
|
||||
"github.com/hashicorp/boundary/internal/gen/controller/api/services"
|
||||
authpb "github.com/hashicorp/boundary/internal/gen/controller/auth"
|
||||
opsservices "github.com/hashicorp/boundary/internal/gen/controller/ops/services"
|
||||
opsservices "github.com/hashicorp/boundary/internal/gen/ops/services"
|
||||
"github.com/hashicorp/boundary/internal/observability/event"
|
||||
"github.com/hashicorp/go-cleanhttp"
|
||||
"github.com/hashicorp/go-secure-stdlib/listenerutil"
|
||||
|
||||
@@ -2,16 +2,22 @@ package health
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/daemon/controller/handlers"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/controller/ops/services"
|
||||
pbs "github.com/hashicorp/boundary/internal/gen/ops/services"
|
||||
pbhealth "github.com/hashicorp/boundary/internal/gen/worker/health"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
pbs.UnsafeHealthServiceServer
|
||||
|
||||
replyWithServiceUnavailable bool
|
||||
|
||||
workerInfoLock sync.RWMutex
|
||||
workerInfoOnce sync.Once
|
||||
workerInfoFn func() *pbhealth.HealthInfo
|
||||
}
|
||||
|
||||
var _ pbs.HealthServiceServer = (*Service)(nil)
|
||||
@@ -22,15 +28,25 @@ func NewService() *Service {
|
||||
}
|
||||
|
||||
func (s *Service) GetHealth(ctx context.Context, req *pbs.GetHealthRequest) (*pbs.GetHealthResponse, error) {
|
||||
resp := &pbs.GetHealthResponse{}
|
||||
|
||||
if req.GetWorkerInfo() {
|
||||
func() {
|
||||
s.workerInfoLock.RLock()
|
||||
defer s.workerInfoLock.RUnlock()
|
||||
if s.workerInfoFn != nil {
|
||||
resp.WorkerProcessInfo = s.workerInfoFn()
|
||||
}
|
||||
}()
|
||||
}
|
||||
if s.replyWithServiceUnavailable {
|
||||
err := handlers.SetStatusCode(ctx, http.StatusServiceUnavailable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pbs.GetHealthResponse{}, nil
|
||||
}
|
||||
|
||||
return &pbs.GetHealthResponse{}, nil
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// StartServiceUnavailableReplies gets returned to the caller of NewService.
|
||||
@@ -38,3 +54,17 @@ func (s *Service) GetHealth(ctx context.Context, req *pbs.GetHealthRequest) (*pb
|
||||
func (s *Service) StartServiceUnavailableReplies() {
|
||||
s.replyWithServiceUnavailable = true
|
||||
}
|
||||
|
||||
// SetWorkerProcessInformationFunc sets the function that can be used to get the
|
||||
// current worker related process information.
|
||||
func (s *Service) SetWorkerProcessInformationFunc(fn func() *pbhealth.HealthInfo) error {
|
||||
if fn == nil {
|
||||
return fmt.Errorf("CurrentWorkerConnection function was nil")
|
||||
}
|
||||
s.workerInfoLock.Lock()
|
||||
defer s.workerInfoLock.Unlock()
|
||||
s.workerInfoOnce.Do(func() {
|
||||
s.workerInfoFn = fn
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@@ -5,17 +5,32 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/boundary/internal/gen/controller/ops/services"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/boundary/internal/gen/ops/services"
|
||||
pbhealth "github.com/hashicorp/boundary/internal/gen/worker/health"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
func TestGetHealth(t *testing.T) {
|
||||
workerInfo := &pbhealth.HealthInfo{
|
||||
ActiveSessionCount: wrapperspb.UInt32(2),
|
||||
SessionConnections: map[string]uint32{
|
||||
"foo": uint32(2),
|
||||
"bar": uint32(1),
|
||||
},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
ctx context.Context
|
||||
workerInfoFn func() *pbhealth.HealthInfo
|
||||
serviceUnavailable bool
|
||||
request *services.GetHealthRequest
|
||||
expGetHealthResponse *services.GetHealthResponse
|
||||
expErr bool
|
||||
expErrMsg string
|
||||
@@ -24,20 +39,50 @@ func TestGetHealth(t *testing.T) {
|
||||
name: "healthy reply",
|
||||
ctx: context.Background(),
|
||||
serviceUnavailable: false,
|
||||
request: &services.GetHealthRequest{},
|
||||
expGetHealthResponse: &services.GetHealthResponse{},
|
||||
expErr: false,
|
||||
},
|
||||
{
|
||||
name: "with worker info no query parameter",
|
||||
ctx: context.Background(),
|
||||
workerInfoFn: func() *pbhealth.HealthInfo { return workerInfo },
|
||||
serviceUnavailable: false,
|
||||
request: &services.GetHealthRequest{},
|
||||
expGetHealthResponse: &services.GetHealthResponse{},
|
||||
expErr: false,
|
||||
},
|
||||
{
|
||||
name: "with worker info and query param",
|
||||
ctx: context.Background(),
|
||||
workerInfoFn: func() *pbhealth.HealthInfo { return workerInfo },
|
||||
serviceUnavailable: false,
|
||||
request: &services.GetHealthRequest{WorkerInfo: true},
|
||||
expGetHealthResponse: &services.GetHealthResponse{WorkerProcessInfo: workerInfo},
|
||||
expErr: false,
|
||||
},
|
||||
{
|
||||
name: "service unavailable reply",
|
||||
ctx: grpc.NewContextWithServerTransportStream(context.Background(), &testServerTransportStream{expHttpCode: "503"}),
|
||||
serviceUnavailable: true,
|
||||
request: &services.GetHealthRequest{},
|
||||
expGetHealthResponse: &services.GetHealthResponse{},
|
||||
expErr: false,
|
||||
},
|
||||
{
|
||||
name: "service unavailable with worker info reply",
|
||||
ctx: grpc.NewContextWithServerTransportStream(context.Background(), &testServerTransportStream{expHttpCode: "503"}),
|
||||
workerInfoFn: func() *pbhealth.HealthInfo { return workerInfo },
|
||||
serviceUnavailable: true,
|
||||
request: &services.GetHealthRequest{WorkerInfo: true},
|
||||
expGetHealthResponse: &services.GetHealthResponse{WorkerProcessInfo: workerInfo},
|
||||
expErr: false,
|
||||
},
|
||||
{
|
||||
name: "get health error",
|
||||
ctx: context.Background(),
|
||||
serviceUnavailable: true,
|
||||
request: &services.GetHealthRequest{},
|
||||
expErr: true,
|
||||
expErrMsg: "handlers.SetHttpStatusCode: internal error, unknown: error #500: rpc error: code = Internal desc = grpc: failed to fetch the stream from the context context.Background",
|
||||
},
|
||||
@@ -47,11 +92,15 @@ func TestGetHealth(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
hs := NewService()
|
||||
|
||||
if tt.workerInfoFn != nil {
|
||||
require.NoError(t, hs.SetWorkerProcessInformationFunc(tt.workerInfoFn))
|
||||
}
|
||||
|
||||
if tt.serviceUnavailable {
|
||||
hs.StartServiceUnavailableReplies()
|
||||
}
|
||||
|
||||
rsp, err := hs.GetHealth(tt.ctx, &services.GetHealthRequest{})
|
||||
rsp, err := hs.GetHealth(tt.ctx, tt.request)
|
||||
if tt.expErr {
|
||||
require.Error(t, err)
|
||||
require.EqualError(t, err, tt.expErrMsg)
|
||||
@@ -59,7 +108,7 @@ func TestGetHealth(t *testing.T) {
|
||||
}
|
||||
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, tt.expGetHealthResponse, rsp)
|
||||
assert.Empty(t, cmp.Diff(tt.expGetHealthResponse, rsp, protocmp.Transform()))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package worker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/hashicorp/boundary/internal/daemon/worker/session"
|
||||
opsservices "github.com/hashicorp/boundary/internal/gen/ops/services"
|
||||
pbhealth "github.com/hashicorp/boundary/internal/gen/worker/health"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
"github.com/hashicorp/boundary/internal/util"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
var healthCheckMarshaler = &runtime.JSONPb{
|
||||
MarshalOptions: protojson.MarshalOptions{
|
||||
// Ensures the json marshaler uses the snake casing as defined in the proto field names.
|
||||
UseProtoNames: true,
|
||||
// Do not add fields set to zero value to json.
|
||||
EmitUnpopulated: false,
|
||||
},
|
||||
UnmarshalOptions: protojson.UnmarshalOptions{
|
||||
// Allows requests to contain unknown fields.
|
||||
DiscardUnknown: true,
|
||||
},
|
||||
}
|
||||
|
||||
// workerHealthServer is the HealthServer for the worker process. This server
|
||||
// will always return a 200.
|
||||
type workerHealthServer struct {
|
||||
worker *Worker
|
||||
opsservices.UnimplementedHealthServiceServer
|
||||
}
|
||||
|
||||
// GetHealth satisfies the opsservices.HealthServiceServer interface.
|
||||
// This implementation will always return 200.
|
||||
func (w workerHealthServer) GetHealth(ctx context.Context, req *opsservices.GetHealthRequest) (*opsservices.GetHealthResponse, error) {
|
||||
resp := &opsservices.GetHealthResponse{}
|
||||
if req.GetWorkerInfo() {
|
||||
resp.WorkerProcessInfo = w.worker.HealthInformation()
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// HealthInformation returns the current worker process health information.
|
||||
func (w *Worker) HealthInformation() *pbhealth.HealthInfo {
|
||||
state := server.UnknownOperationalState
|
||||
if v := w.operationalState.Load(); !util.IsNil(v) {
|
||||
state = v.(server.OperationalState)
|
||||
}
|
||||
healthInfo := &pbhealth.HealthInfo{
|
||||
State: state.String(),
|
||||
}
|
||||
|
||||
if w.sessionManager == nil {
|
||||
// This is assigned in worker Start() which is called prior to the ops
|
||||
// listener so this should always be set. This check is here just to
|
||||
// be safe in case that changes.
|
||||
return healthInfo
|
||||
}
|
||||
|
||||
sessionConns := make(map[string]uint32)
|
||||
w.sessionManager.ForEachLocalSession(
|
||||
func(s session.Session) bool {
|
||||
if connCount := len(s.GetLocalConnections()); connCount > 0 {
|
||||
sessionConns[s.GetId()] = uint32(connCount)
|
||||
}
|
||||
return true
|
||||
})
|
||||
healthInfo.ActiveSessionCount = wrapperspb.UInt32(uint32(len(sessionConns)))
|
||||
healthInfo.SessionConnections = sessionConns
|
||||
return healthInfo
|
||||
}
|
||||
|
||||
// GetHealthHandler returns an http.Handler that can be used for handling
|
||||
// health check requests for just the worker.
|
||||
func (w *Worker) GetHealthHandler() (http.Handler, error) {
|
||||
const op = "worker.(Worker).GetHealthHandler"
|
||||
mux := runtime.NewServeMux(
|
||||
runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.HTTPBodyMarshaler{
|
||||
Marshaler: healthCheckMarshaler,
|
||||
}))
|
||||
err := opsservices.RegisterHealthServiceHandlerServer(w.baseContext, mux, workerHealthServer{worker: w})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: failed to register health service handler: %w", op, err)
|
||||
}
|
||||
|
||||
return mux, nil
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package worker
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
opsservices "github.com/hashicorp/boundary/internal/gen/ops/services"
|
||||
pbhealth "github.com/hashicorp/boundary/internal/gen/worker/health"
|
||||
"github.com/hashicorp/boundary/internal/server"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/testing/protocmp"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
)
|
||||
|
||||
func TestGetHealth(t *testing.T) {
|
||||
w := NewTestWorker(t, &TestWorkerOpts{
|
||||
InitialUpstreams: []string{"0.0.0.0"},
|
||||
})
|
||||
defer w.Shutdown()
|
||||
handler, err := w.Worker().GetHealthHandler()
|
||||
require.NoError(t, err)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
method string
|
||||
queryParams string
|
||||
expectedResponse opsservices.GetHealthResponse
|
||||
expCode int
|
||||
}{
|
||||
{
|
||||
name: "healthy reply",
|
||||
method: http.MethodGet,
|
||||
expCode: http.StatusOK,
|
||||
expectedResponse: opsservices.GetHealthResponse{},
|
||||
},
|
||||
{
|
||||
name: "healthy reply with worker info",
|
||||
method: http.MethodGet,
|
||||
queryParams: "worker_info=1",
|
||||
expCode: http.StatusOK,
|
||||
expectedResponse: opsservices.GetHealthResponse{
|
||||
WorkerProcessInfo: &pbhealth.HealthInfo{
|
||||
State: server.ActiveOperationalState.String(),
|
||||
ActiveSessionCount: wrapperspb.UInt32(0),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Post request",
|
||||
method: http.MethodPost,
|
||||
queryParams: "worker_info=1",
|
||||
expCode: http.StatusNotImplemented,
|
||||
expectedResponse: opsservices.GetHealthResponse{},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
path := "/health"
|
||||
if tt.queryParams != "" {
|
||||
path = fmt.Sprintf("%s?%s", path, tt.queryParams)
|
||||
}
|
||||
req, err := http.NewRequest(tt.method, path, nil)
|
||||
require.NoError(t, err)
|
||||
rr := httptest.NewRecorder()
|
||||
handler.ServeHTTP(rr, req)
|
||||
|
||||
assert.Equal(t, tt.expCode, rr.Result().StatusCode)
|
||||
b, err := io.ReadAll(rr.Result().Body)
|
||||
require.NoError(t, err)
|
||||
resp := &opsservices.GetHealthResponse{}
|
||||
require.NoError(t, healthCheckMarshaler.Unmarshal(b, resp))
|
||||
|
||||
assert.Empty(t, cmp.Diff(tt.expectedResponse, resp, protocmp.Transform()))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc (unknown)
|
||||
// source: controller/ops/services/v1/health_service.proto
|
||||
|
||||
package services
|
||||
|
||||
import (
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type GetHealthRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GetHealthRequest) Reset() {
|
||||
*x = GetHealthRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_ops_services_v1_health_service_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetHealthRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetHealthRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetHealthRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_ops_services_v1_health_service_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetHealthRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetHealthRequest) Descriptor() ([]byte, []int) {
|
||||
return file_controller_ops_services_v1_health_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type GetHealthResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GetHealthResponse) Reset() {
|
||||
*x = GetHealthResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_ops_services_v1_health_service_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetHealthResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetHealthResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetHealthResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_ops_services_v1_health_service_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetHealthResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetHealthResponse) Descriptor() ([]byte, []int) {
|
||||
return file_controller_ops_services_v1_health_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
var File_controller_ops_services_v1_health_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_controller_ops_services_v1_health_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x6f, 0x70, 0x73,
|
||||
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61,
|
||||
0x6c, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x1a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x6f, 0x70,
|
||||
0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x47,
|
||||
0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22,
|
||||
0x13, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8a, 0x01, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x79, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61,
|
||||
0x6c, 0x74, 0x68, 0x12, 0x2c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
|
||||
0x2e, 0x6f, 0x70, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x6f,
|
||||
0x70, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x22, 0x0f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x09, 0x12, 0x07, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x68, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61,
|
||||
0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x6f, 0x70, 0x73, 0x2f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_controller_ops_services_v1_health_service_proto_rawDescOnce sync.Once
|
||||
file_controller_ops_services_v1_health_service_proto_rawDescData = file_controller_ops_services_v1_health_service_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_controller_ops_services_v1_health_service_proto_rawDescGZIP() []byte {
|
||||
file_controller_ops_services_v1_health_service_proto_rawDescOnce.Do(func() {
|
||||
file_controller_ops_services_v1_health_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_ops_services_v1_health_service_proto_rawDescData)
|
||||
})
|
||||
return file_controller_ops_services_v1_health_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_controller_ops_services_v1_health_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_controller_ops_services_v1_health_service_proto_goTypes = []interface{}{
|
||||
(*GetHealthRequest)(nil), // 0: controller.ops.services.v1.GetHealthRequest
|
||||
(*GetHealthResponse)(nil), // 1: controller.ops.services.v1.GetHealthResponse
|
||||
}
|
||||
var file_controller_ops_services_v1_health_service_proto_depIdxs = []int32{
|
||||
0, // 0: controller.ops.services.v1.HealthService.GetHealth:input_type -> controller.ops.services.v1.GetHealthRequest
|
||||
1, // 1: controller.ops.services.v1.HealthService.GetHealth:output_type -> controller.ops.services.v1.GetHealthResponse
|
||||
1, // [1:2] is the sub-list for method output_type
|
||||
0, // [0:1] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_controller_ops_services_v1_health_service_proto_init() }
|
||||
func file_controller_ops_services_v1_health_service_proto_init() {
|
||||
if File_controller_ops_services_v1_health_service_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_controller_ops_services_v1_health_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetHealthRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_controller_ops_services_v1_health_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetHealthResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_controller_ops_services_v1_health_service_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_controller_ops_services_v1_health_service_proto_goTypes,
|
||||
DependencyIndexes: file_controller_ops_services_v1_health_service_proto_depIdxs,
|
||||
MessageInfos: file_controller_ops_services_v1_health_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_controller_ops_services_v1_health_service_proto = out.File
|
||||
file_controller_ops_services_v1_health_service_proto_rawDesc = nil
|
||||
file_controller_ops_services_v1_health_service_proto_goTypes = nil
|
||||
file_controller_ops_services_v1_health_service_proto_depIdxs = nil
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc (unknown)
|
||||
// source: ops/services/v1/health_service.proto
|
||||
|
||||
package services
|
||||
|
||||
import (
|
||||
health "github.com/hashicorp/boundary/internal/gen/worker/health"
|
||||
_ "google.golang.org/genproto/googleapis/api/annotations"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type GetHealthRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Experimental: This field may change or be removed without notice.
|
||||
WorkerInfo bool `protobuf:"varint,1,opt,name=worker_info,proto3" json:"worker_info,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetHealthRequest) Reset() {
|
||||
*x = GetHealthRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ops_services_v1_health_service_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetHealthRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetHealthRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetHealthRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ops_services_v1_health_service_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetHealthRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetHealthRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ops_services_v1_health_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GetHealthRequest) GetWorkerInfo() bool {
|
||||
if x != nil {
|
||||
return x.WorkerInfo
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type GetHealthResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Experimental: This field may change or be removed without notice.
|
||||
WorkerProcessInfo *health.HealthInfo `protobuf:"bytes,1,opt,name=worker_process_info,proto3" json:"worker_process_info,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetHealthResponse) Reset() {
|
||||
*x = GetHealthResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_ops_services_v1_health_service_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetHealthResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetHealthResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetHealthResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ops_services_v1_health_service_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetHealthResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetHealthResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ops_services_v1_health_service_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetHealthResponse) GetWorkerProcessInfo() *health.HealthInfo {
|
||||
if x != nil {
|
||||
return x.WorkerProcessInfo
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_ops_services_v1_health_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ops_services_v1_health_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x24, 0x6f, 0x70, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6f, 0x70, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
||||
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2f, 0x68, 0x65,
|
||||
0x61, 0x6c, 0x74, 0x68, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x10,
|
||||
0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x12, 0x20, 0x0a, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x69, 0x6e,
|
||||
0x66, 0x6f, 0x22, 0x63, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x65,
|
||||
0x72, 0x5f, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2e, 0x68, 0x65,
|
||||
0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x13, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x63, 0x65,
|
||||
0x73, 0x73, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x32, 0x74, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x48,
|
||||
0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x21, 0x2e, 0x6f, 0x70, 0x73, 0x2e, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6f, 0x70, 0x73, 0x2e, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x65,
|
||||
0x61, 0x6c, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0f, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x09, 0x12, 0x07, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x42, 0x42, 0x5a,
|
||||
0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68,
|
||||
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x6f, 0x70, 0x73, 0x2f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_ops_services_v1_health_service_proto_rawDescOnce sync.Once
|
||||
file_ops_services_v1_health_service_proto_rawDescData = file_ops_services_v1_health_service_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_ops_services_v1_health_service_proto_rawDescGZIP() []byte {
|
||||
file_ops_services_v1_health_service_proto_rawDescOnce.Do(func() {
|
||||
file_ops_services_v1_health_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_ops_services_v1_health_service_proto_rawDescData)
|
||||
})
|
||||
return file_ops_services_v1_health_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_ops_services_v1_health_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_ops_services_v1_health_service_proto_goTypes = []interface{}{
|
||||
(*GetHealthRequest)(nil), // 0: ops.services.v1.GetHealthRequest
|
||||
(*GetHealthResponse)(nil), // 1: ops.services.v1.GetHealthResponse
|
||||
(*health.HealthInfo)(nil), // 2: worker.health.v1.HealthInfo
|
||||
}
|
||||
var file_ops_services_v1_health_service_proto_depIdxs = []int32{
|
||||
2, // 0: ops.services.v1.GetHealthResponse.worker_process_info:type_name -> worker.health.v1.HealthInfo
|
||||
0, // 1: ops.services.v1.HealthService.GetHealth:input_type -> ops.services.v1.GetHealthRequest
|
||||
1, // 2: ops.services.v1.HealthService.GetHealth:output_type -> ops.services.v1.GetHealthResponse
|
||||
2, // [2:3] is the sub-list for method output_type
|
||||
1, // [1:2] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_ops_services_v1_health_service_proto_init() }
|
||||
func file_ops_services_v1_health_service_proto_init() {
|
||||
if File_ops_services_v1_health_service_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_ops_services_v1_health_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetHealthRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_ops_services_v1_health_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetHealthResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_ops_services_v1_health_service_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_ops_services_v1_health_service_proto_goTypes,
|
||||
DependencyIndexes: file_ops_services_v1_health_service_proto_depIdxs,
|
||||
MessageInfos: file_ops_services_v1_health_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_ops_services_v1_health_service_proto = out.File
|
||||
file_ops_services_v1_health_service_proto_rawDesc = nil
|
||||
file_ops_services_v1_health_service_proto_goTypes = nil
|
||||
file_ops_services_v1_health_service_proto_depIdxs = nil
|
||||
}
|
||||
+21
-3
@@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
|
||||
// source: controller/ops/services/v1/health_service.proto
|
||||
// source: ops/services/v1/health_service.proto
|
||||
|
||||
/*
|
||||
Package services is a reverse proxy.
|
||||
@@ -31,10 +31,21 @@ var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = metadata.Join
|
||||
|
||||
var (
|
||||
filter_HealthService_GetHealth_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_HealthService_GetHealth_0(ctx context.Context, marshaler runtime.Marshaler, client HealthServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq GetHealthRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_HealthService_GetHealth_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.GetHealth(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
@@ -44,6 +55,13 @@ func local_request_HealthService_GetHealth_0(ctx context.Context, marshaler runt
|
||||
var protoReq GetHealthRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_HealthService_GetHealth_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.GetHealth(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
@@ -63,7 +81,7 @@ func RegisterHealthServiceHandlerServer(ctx context.Context, mux *runtime.ServeM
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health"))
|
||||
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -127,7 +145,7 @@ func RegisterHealthServiceHandlerClient(ctx context.Context, mux *runtime.ServeM
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
var err error
|
||||
var annotatedContext context.Context
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/controller.ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health"))
|
||||
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ops.services.v1.HealthService/GetHealth", runtime.WithHTTPPathPattern("/health"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
+4
-4
@@ -31,7 +31,7 @@ func NewHealthServiceClient(cc grpc.ClientConnInterface) HealthServiceClient {
|
||||
|
||||
func (c *healthServiceClient) GetHealth(ctx context.Context, in *GetHealthRequest, opts ...grpc.CallOption) (*GetHealthResponse, error) {
|
||||
out := new(GetHealthResponse)
|
||||
err := c.cc.Invoke(ctx, "/controller.ops.services.v1.HealthService/GetHealth", in, out, opts...)
|
||||
err := c.cc.Invoke(ctx, "/ops.services.v1.HealthService/GetHealth", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func _HealthService_GetHealth_Handler(srv interface{}, ctx context.Context, dec
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/controller.ops.services.v1.HealthService/GetHealth",
|
||||
FullMethod: "/ops.services.v1.HealthService/GetHealth",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(HealthServiceServer).GetHealth(ctx, req.(*GetHealthRequest))
|
||||
@@ -88,7 +88,7 @@ func _HealthService_GetHealth_Handler(srv interface{}, ctx context.Context, dec
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var HealthService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "controller.ops.services.v1.HealthService",
|
||||
ServiceName: "ops.services.v1.HealthService",
|
||||
HandlerType: (*HealthServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
@@ -97,5 +97,5 @@ var HealthService_ServiceDesc = grpc.ServiceDesc{
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "controller/ops/services/v1/health_service.proto",
|
||||
Metadata: "ops/services/v1/health_service.proto",
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc (unknown)
|
||||
// source: worker/health/v1/health_service.proto
|
||||
|
||||
package health
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type HealthInfo struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
State string `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"`
|
||||
ActiveSessionCount *wrapperspb.UInt32Value `protobuf:"bytes,2,opt,name=active_session_count,json=active_connection_count,proto3" json:"active_session_count,omitempty"`
|
||||
SessionConnections map[string]uint32 `protobuf:"bytes,3,rep,name=session_connections,proto3" json:"session_connections,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (x *HealthInfo) Reset() {
|
||||
*x = HealthInfo{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_worker_health_v1_health_service_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *HealthInfo) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HealthInfo) ProtoMessage() {}
|
||||
|
||||
func (x *HealthInfo) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_worker_health_v1_health_service_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use HealthInfo.ProtoReflect.Descriptor instead.
|
||||
func (*HealthInfo) Descriptor() ([]byte, []int) {
|
||||
return file_worker_health_v1_health_service_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *HealthInfo) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HealthInfo) GetActiveSessionCount() *wrapperspb.UInt32Value {
|
||||
if x != nil {
|
||||
return x.ActiveSessionCount
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *HealthInfo) GetSessionConnections() map[string]uint32 {
|
||||
if x != nil {
|
||||
return x.SessionConnections
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_worker_health_v1_health_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_worker_health_v1_health_service_proto_rawDesc = []byte{
|
||||
0x0a, 0x25, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2e,
|
||||
0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70,
|
||||
0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa6, 0x02, 0x0a, 0x0a, 0x48, 0x65,
|
||||
0x61, 0x6c, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x53,
|
||||
0x0a, 0x14, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x55,
|
||||
0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x17, 0x61, 0x63, 0x74, 0x69,
|
||||
0x76, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f,
|
||||
0x75, 0x6e, 0x74, 0x12, 0x66, 0x0a, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x63,
|
||||
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x34, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x13, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f,
|
||||
0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x45, 0x0a, 0x17, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
|
||||
0x38, 0x01, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64,
|
||||
0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, 0x6e,
|
||||
0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x65, 0x72, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x3b, 0x68,
|
||||
0x65, 0x61, 0x6c, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_worker_health_v1_health_service_proto_rawDescOnce sync.Once
|
||||
file_worker_health_v1_health_service_proto_rawDescData = file_worker_health_v1_health_service_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_worker_health_v1_health_service_proto_rawDescGZIP() []byte {
|
||||
file_worker_health_v1_health_service_proto_rawDescOnce.Do(func() {
|
||||
file_worker_health_v1_health_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_worker_health_v1_health_service_proto_rawDescData)
|
||||
})
|
||||
return file_worker_health_v1_health_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_worker_health_v1_health_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_worker_health_v1_health_service_proto_goTypes = []interface{}{
|
||||
(*HealthInfo)(nil), // 0: worker.health.v1.HealthInfo
|
||||
nil, // 1: worker.health.v1.HealthInfo.SessionConnectionsEntry
|
||||
(*wrapperspb.UInt32Value)(nil), // 2: google.protobuf.UInt32Value
|
||||
}
|
||||
var file_worker_health_v1_health_service_proto_depIdxs = []int32{
|
||||
2, // 0: worker.health.v1.HealthInfo.active_session_count:type_name -> google.protobuf.UInt32Value
|
||||
1, // 1: worker.health.v1.HealthInfo.session_connections:type_name -> worker.health.v1.HealthInfo.SessionConnectionsEntry
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_worker_health_v1_health_service_proto_init() }
|
||||
func file_worker_health_v1_health_service_proto_init() {
|
||||
if File_worker_health_v1_health_service_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_worker_health_v1_health_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*HealthInfo); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_worker_health_v1_health_service_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_worker_health_v1_health_service_proto_goTypes,
|
||||
DependencyIndexes: file_worker_health_v1_health_service_proto_depIdxs,
|
||||
MessageInfos: file_worker_health_v1_health_service_proto_msgTypes,
|
||||
}.Build()
|
||||
File_worker_health_v1_health_service_proto = out.File
|
||||
file_worker_health_v1_health_service_proto_rawDesc = nil
|
||||
file_worker_health_v1_health_service_proto_goTypes = nil
|
||||
file_worker_health_v1_health_service_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.ops.resources.health.v1;
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/sdk/pbs/controller/ops/resources/health;health";
|
||||
|
||||
// Health is the underlying resource used by the Health Service.
|
||||
// Empty for now as we don't want to commit to an API yet.
|
||||
message Health {}
|
||||
@@ -1,19 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package controller.ops.services.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/controller/ops/services;services";
|
||||
|
||||
service HealthService {
|
||||
rpc GetHealth(GetHealthRequest) returns (GetHealthResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/health"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetHealthRequest {}
|
||||
|
||||
message GetHealthResponse {}
|
||||
@@ -0,0 +1,26 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ops.services.v1;
|
||||
|
||||
import "google/api/annotations.proto";
|
||||
import "worker/health/v1/health_service.proto";
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/ops/services;services";
|
||||
|
||||
service HealthService {
|
||||
rpc GetHealth(GetHealthRequest) returns (GetHealthResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/health"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
message GetHealthRequest {
|
||||
// Experimental: This field may change or be removed without notice.
|
||||
bool worker_info = 1 [json_name = "worker_info"];
|
||||
}
|
||||
|
||||
message GetHealthResponse {
|
||||
// Experimental: This field may change or be removed without notice.
|
||||
worker.health.v1.HealthInfo worker_process_info = 1 [json_name = "worker_process_info"];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package worker.health.v1;
|
||||
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
option go_package = "github.com/hashicorp/boundary/internal/gen/worker/health;health";
|
||||
|
||||
message HealthInfo {
|
||||
string state = 1;
|
||||
google.protobuf.UInt32Value active_session_count = 2 [json_name = "active_connection_count"];
|
||||
map<string, uint32> session_connections = 3 [json_name = "session_connections"];
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc (unknown)
|
||||
// source: controller/ops/resources/health/v1/health.proto
|
||||
|
||||
package health
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// Health is the underlying resource used by the Health Service.
|
||||
// Empty for now as we don't want to commit to an API yet.
|
||||
type Health struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *Health) Reset() {
|
||||
*x = Health{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_ops_resources_health_v1_health_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Health) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Health) ProtoMessage() {}
|
||||
|
||||
func (x *Health) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_ops_resources_health_v1_health_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Health.ProtoReflect.Descriptor instead.
|
||||
func (*Health) Descriptor() ([]byte, []int) {
|
||||
return file_controller_ops_resources_health_v1_health_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
var File_controller_ops_resources_health_v1_health_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_controller_ops_resources_health_v1_health_proto_rawDesc = []byte{
|
||||
0x0a, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x6f, 0x70, 0x73,
|
||||
0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x68, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x22, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x6f, 0x70,
|
||||
0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x68, 0x65, 0x61, 0x6c,
|
||||
0x74, 0x68, 0x2e, 0x76, 0x31, 0x22, 0x08, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x42,
|
||||
0x4e, 0x5a, 0x4c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61,
|
||||
0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79,
|
||||
0x2f, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x62, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
|
||||
0x6c, 0x65, 0x72, 0x2f, 0x6f, 0x70, 0x73, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||
0x73, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x3b, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_controller_ops_resources_health_v1_health_proto_rawDescOnce sync.Once
|
||||
file_controller_ops_resources_health_v1_health_proto_rawDescData = file_controller_ops_resources_health_v1_health_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_controller_ops_resources_health_v1_health_proto_rawDescGZIP() []byte {
|
||||
file_controller_ops_resources_health_v1_health_proto_rawDescOnce.Do(func() {
|
||||
file_controller_ops_resources_health_v1_health_proto_rawDescData = protoimpl.X.CompressGZIP(file_controller_ops_resources_health_v1_health_proto_rawDescData)
|
||||
})
|
||||
return file_controller_ops_resources_health_v1_health_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_controller_ops_resources_health_v1_health_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_controller_ops_resources_health_v1_health_proto_goTypes = []interface{}{
|
||||
(*Health)(nil), // 0: controller.ops.resources.health.v1.Health
|
||||
}
|
||||
var file_controller_ops_resources_health_v1_health_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_controller_ops_resources_health_v1_health_proto_init() }
|
||||
func file_controller_ops_resources_health_v1_health_proto_init() {
|
||||
if File_controller_ops_resources_health_v1_health_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_controller_ops_resources_health_v1_health_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Health); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_controller_ops_resources_health_v1_health_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_controller_ops_resources_health_v1_health_proto_goTypes,
|
||||
DependencyIndexes: file_controller_ops_resources_health_v1_health_proto_depIdxs,
|
||||
MessageInfos: file_controller_ops_resources_health_v1_health_proto_msgTypes,
|
||||
}.Build()
|
||||
File_controller_ops_resources_health_v1_health_proto = out.File
|
||||
file_controller_ops_resources_health_v1_health_proto_rawDesc = nil
|
||||
file_controller_ops_resources_health_v1_health_proto_goTypes = nil
|
||||
file_controller_ops_resources_health_v1_health_proto_depIdxs = nil
|
||||
}
|
||||
Reference in new issue
Block a user