health

package
v0.0.72 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package health is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Pattern_HealthService_Alive_0             = pattern_HealthService_Alive_0
	Pattern_HealthService_Ready_0             = pattern_HealthService_Ready_0
	Pattern_HealthService_MetricsPrometheus_0 = pattern_HealthService_MetricsPrometheus_0
	Pattern_HealthService_Version_0           = pattern_HealthService_Version_0
)

export some private fields

View Source
var (
	Status_name = map[int32]string{
		0: "ok",
	}
	Status_value = map[string]int32{
		"ok": 0,
	}
)

Enum value maps for Status.

View Source
var File_v1_health_health_proto protoreflect.FileDescriptor
View Source
var HealthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "sole.api.v1.health.HealthService",
	HandlerType: (*HealthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Alive",
			Handler:    _HealthService_Alive_Handler,
		},
		{
			MethodName: "Ready",
			Handler:    _HealthService_Ready_Handler,
		},
		{
			MethodName: "Version",
			Handler:    _HealthService_Version_Handler,
		},
		{
			MethodName: "MetricsPrometheus",
			Handler:    _HealthService_MetricsPrometheus_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "v1/health/health.proto",
}

HealthService_ServiceDesc is the grpc.ServiceDesc for HealthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHealthServiceHandler

func RegisterHealthServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterHealthServiceHandler registers the http handlers for service HealthService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterHealthServiceHandlerClient

func RegisterHealthServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HealthServiceClient) error

RegisterHealthServiceHandlerClient registers the http handlers for service HealthService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HealthServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HealthServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HealthServiceClient" to call the correct interceptors.

func RegisterHealthServiceHandlerFromEndpoint

func RegisterHealthServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterHealthServiceHandlerFromEndpoint is same as RegisterHealthServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterHealthServiceHandlerServer

func RegisterHealthServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HealthServiceServer) error

RegisterHealthServiceHandlerServer registers the http handlers for service HealthService to "mux". UnaryRPC :call HealthServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterHealthServiceHandlerFromEndpoint instead.

func RegisterHealthServiceServer

func RegisterHealthServiceServer(s grpc.ServiceRegistrar, srv HealthServiceServer)

Types

type AliveResponse

type AliveResponse struct {

	// Status always contains "ok".
	Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=sole.api.v1.health.Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*AliveResponse) Descriptor deprecated

func (*AliveResponse) Descriptor() ([]byte, []int)

Deprecated: Use AliveResponse.ProtoReflect.Descriptor instead.

func (*AliveResponse) GetStatus

func (x *AliveResponse) GetStatus() Status

func (*AliveResponse) ProtoMessage

func (*AliveResponse) ProtoMessage()

func (*AliveResponse) ProtoReflect

func (x *AliveResponse) ProtoReflect() protoreflect.Message

func (*AliveResponse) Reset

func (x *AliveResponse) Reset()

func (*AliveResponse) String

func (x *AliveResponse) String() string

type HealthServiceClient

type HealthServiceClient interface {
	// 节点启动状态检测
	Alive(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*AliveResponse, error)
	// 节点就绪状态监测
	Ready(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ReadyResponse, error)
	// 服务版本查询
	Version(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*VersionResponse, error)
	// Prometheus监控
	MetricsPrometheus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
}

HealthServiceClient is the client API for HealthService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type HealthServiceServer

type HealthServiceServer interface {
	// 节点启动状态检测
	Alive(context.Context, *emptypb.Empty) (*AliveResponse, error)
	// 节点就绪状态监测
	Ready(context.Context, *emptypb.Empty) (*ReadyResponse, error)
	// 服务版本查询
	Version(context.Context, *emptypb.Empty) (*VersionResponse, error)
	// Prometheus监控
	MetricsPrometheus(context.Context, *emptypb.Empty) (*httpbody.HttpBody, error)
	// contains filtered or unexported methods
}

HealthServiceServer is the server API for HealthService service. All implementations must embed UnimplementedHealthServiceServer for forward compatibility

type ReadyResponse

type ReadyResponse struct {

	// Status always contains "ok".
	Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=sole.api.v1.health.Status" json:"status,omitempty"`
	// Errors contains a list of errors that caused the not ready status.
	Errors map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ReadyResponse) Descriptor deprecated

func (*ReadyResponse) Descriptor() ([]byte, []int)

Deprecated: Use ReadyResponse.ProtoReflect.Descriptor instead.

func (*ReadyResponse) GetErrors

func (x *ReadyResponse) GetErrors() map[string]string

func (*ReadyResponse) GetStatus

func (x *ReadyResponse) GetStatus() Status

func (*ReadyResponse) ProtoMessage

func (*ReadyResponse) ProtoMessage()

func (*ReadyResponse) ProtoReflect

func (x *ReadyResponse) ProtoReflect() protoreflect.Message

func (*ReadyResponse) Reset

func (x *ReadyResponse) Reset()

func (*ReadyResponse) String

func (x *ReadyResponse) String() string

type Status

type Status int32
const (
	Status_ok Status = 0
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type UnimplementedHealthServiceServer

type UnimplementedHealthServiceServer struct {
}

UnimplementedHealthServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedHealthServiceServer) Alive

func (UnimplementedHealthServiceServer) MetricsPrometheus

func (UnimplementedHealthServiceServer) Ready

func (UnimplementedHealthServiceServer) Version

type UnsafeHealthServiceServer

type UnsafeHealthServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeHealthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HealthServiceServer will result in compilation errors.

type VersionResponse

type VersionResponse struct {

	// 服务软件版本
	Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

func (*VersionResponse) Descriptor deprecated

func (*VersionResponse) Descriptor() ([]byte, []int)

Deprecated: Use VersionResponse.ProtoReflect.Descriptor instead.

func (*VersionResponse) GetVersion

func (x *VersionResponse) GetVersion() string

func (*VersionResponse) ProtoMessage

func (*VersionResponse) ProtoMessage()

func (*VersionResponse) ProtoReflect

func (x *VersionResponse) ProtoReflect() protoreflect.Message

func (*VersionResponse) Reset

func (x *VersionResponse) Reset()

func (*VersionResponse) String

func (x *VersionResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL