From d978563d6482414d2448057c1ec68a4ff09e4dac Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:13:55 +0900 Subject: [PATCH 01/11] feat: impl deep health check --- internal/infrastructure/dependency/dependency.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/infrastructure/dependency/dependency.go b/internal/infrastructure/dependency/dependency.go index b215322b2..7fd274a56 100644 --- a/internal/infrastructure/dependency/dependency.go +++ b/internal/infrastructure/dependency/dependency.go @@ -19,6 +19,7 @@ import ( ) type Dependency struct { + DatabaseCli *database.Client // public PublicAuthenticationInteractor usecase.PublicAuthenticationInteractor @@ -39,7 +40,7 @@ func (d *Dependency) Inject( ctx context.Context, e *environment.Environment, ) { - _ = database.NewClient(e.DBHost, e.DBUser, e.DBPassword, e.DBDatabase) + d.DatabaseCli = database.NewClient(e.DBHost, e.DBUser, e.DBPassword, e.DBDatabase) firebaseCli := firebase.NewClient(e.GCPProjectID) From 9e7581fb70448d7ccf1de23706ff6d916fcdf4fa Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:13:57 +0900 Subject: [PATCH 02/11] feat: impl deep health check --- .../infrastructure/grpc/internal/handler/public/handler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/infrastructure/grpc/internal/handler/public/handler.go b/internal/infrastructure/grpc/internal/handler/public/handler.go index 2f7257a52..081569c4b 100644 --- a/internal/infrastructure/grpc/internal/handler/public/handler.go +++ b/internal/infrastructure/grpc/internal/handler/public/handler.go @@ -1,21 +1,25 @@ package public import ( + "github.com/abyssparanoia/rapid-go/internal/infrastructure/database" public_apiv1 "github.com/abyssparanoia/rapid-go/internal/infrastructure/grpc/pb/rapid/public_api/v1" "github.com/abyssparanoia/rapid-go/internal/usecase" ) type PublicHandler struct { + databaseCli *database.Client public_apiv1.UnimplementedPublicV1ServiceServer authenticationInteractor usecase.PublicAuthenticationInteractor tenantInteractor usecase.PublicTenantInteractor } func NewPublicHandler( + databaseCli *database.Client, authenticationInteractor usecase.PublicAuthenticationInteractor, tenantInteractor usecase.PublicTenantInteractor, ) public_apiv1.PublicV1ServiceServer { return &PublicHandler{ + databaseCli: databaseCli, authenticationInteractor: authenticationInteractor, tenantInteractor: tenantInteractor, } From 03a4792d6157ccf61ec25bf11e38130f2a22bd18 Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:00 +0900 Subject: [PATCH 03/11] feat: impl deep health check --- .../internal/handler/public/health_check.go | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 internal/infrastructure/grpc/internal/handler/public/health_check.go diff --git a/internal/infrastructure/grpc/internal/handler/public/health_check.go b/internal/infrastructure/grpc/internal/handler/public/health_check.go new file mode 100644 index 000000000..37a553620 --- /dev/null +++ b/internal/infrastructure/grpc/internal/handler/public/health_check.go @@ -0,0 +1,22 @@ +package public + +import ( + "context" + + public_apiv1 "github.com/abyssparanoia/rapid-go/internal/infrastructure/grpc/pb/rapid/public_api/v1" + "github.com/abyssparanoia/rapid-go/internal/pkg/logger" + "go.uber.org/zap" +) + +func (h *PublicHandler) PublicDeepHealthCheck(ctx context.Context, req *public_apiv1.PublicDeepHealthCheckRequest) (*public_apiv1.PublicDeepHealthCheckResponse, error) { + + databaseStatus := "up" + if err := h.databaseCli.DB.Ping(); err != nil { + logger.L(ctx).Error("failed to h.databaseCli.DB.Ping", zap.Error(err)) + databaseStatus = "down" + } + + return &public_apiv1.PublicDeepHealthCheckResponse{ + DatabaseStatus: databaseStatus, + }, nil +} From 46cd149d5c7b13dd6b11ac3927997ccc446956f8 Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:02 +0900 Subject: [PATCH 04/11] feat: impl deep health check --- .../pb/rapid/public_api/v1/health_check.pb.go | 221 ++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 internal/infrastructure/grpc/pb/rapid/public_api/v1/health_check.pb.go diff --git a/internal/infrastructure/grpc/pb/rapid/public_api/v1/health_check.pb.go b/internal/infrastructure/grpc/pb/rapid/public_api/v1/health_check.pb.go new file mode 100644 index 000000000..c1e3d036c --- /dev/null +++ b/internal/infrastructure/grpc/pb/rapid/public_api/v1/health_check.pb.go @@ -0,0 +1,221 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: rapid/public_api/v1/health_check.proto + +package public_apiv1 + +import ( + reflect "reflect" + sync "sync" + + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +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 PublicDeepHealthCheckRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PublicDeepHealthCheckRequest) Reset() { + *x = PublicDeepHealthCheckRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_rapid_public_api_v1_health_check_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublicDeepHealthCheckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublicDeepHealthCheckRequest) ProtoMessage() {} + +func (x *PublicDeepHealthCheckRequest) ProtoReflect() protoreflect.Message { + mi := &file_rapid_public_api_v1_health_check_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 PublicDeepHealthCheckRequest.ProtoReflect.Descriptor instead. +func (*PublicDeepHealthCheckRequest) Descriptor() ([]byte, []int) { + return file_rapid_public_api_v1_health_check_proto_rawDescGZIP(), []int{0} +} + +type PublicDeepHealthCheckResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DatabaseStatus string `protobuf:"bytes,1,opt,name=database_status,json=databaseStatus,proto3" json:"database_status,omitempty"` +} + +func (x *PublicDeepHealthCheckResponse) Reset() { + *x = PublicDeepHealthCheckResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_rapid_public_api_v1_health_check_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublicDeepHealthCheckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublicDeepHealthCheckResponse) ProtoMessage() {} + +func (x *PublicDeepHealthCheckResponse) ProtoReflect() protoreflect.Message { + mi := &file_rapid_public_api_v1_health_check_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 PublicDeepHealthCheckResponse.ProtoReflect.Descriptor instead. +func (*PublicDeepHealthCheckResponse) Descriptor() ([]byte, []int) { + return file_rapid_public_api_v1_health_check_proto_rawDescGZIP(), []int{1} +} + +func (x *PublicDeepHealthCheckResponse) GetDatabaseStatus() string { + if x != nil { + return x.DatabaseStatus + } + return "" +} + +var File_rapid_public_api_v1_health_check_proto protoreflect.FileDescriptor + +var file_rapid_public_api_v1_health_check_proto_rawDesc = []byte{ + 0x0a, 0x26, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, + 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x1a, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, + 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, + 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1e, 0x0a, + 0x1c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x65, 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x61, 0x0a, + 0x1d, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x65, 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, + 0x0a, 0x0f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x3a, 0x17, 0x92, 0x41, 0x14, 0x0a, 0x12, 0xd2, 0x01, + 0x0f, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x42, 0xf9, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x10, 0x48, 0x65, + 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x62, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x79, + 0x73, 0x73, 0x70, 0x61, 0x72, 0x61, 0x6e, 0x6f, 0x69, 0x61, 0x2f, 0x72, 0x61, 0x70, 0x69, 0x64, + 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, + 0x72, 0x61, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x2f, 0x70, 0x62, 0x2f, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, + 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x61, 0x70, + 0x69, 0x64, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x12, 0x52, 0x61, 0x70, 0x69, 0x64, 0x5c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, + 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x61, 0x70, 0x69, 0x64, 0x5c, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x61, 0x70, 0x69, 0x64, 0x3a, 0x3a, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_rapid_public_api_v1_health_check_proto_rawDescOnce sync.Once + file_rapid_public_api_v1_health_check_proto_rawDescData = file_rapid_public_api_v1_health_check_proto_rawDesc +) + +func file_rapid_public_api_v1_health_check_proto_rawDescGZIP() []byte { + file_rapid_public_api_v1_health_check_proto_rawDescOnce.Do(func() { + file_rapid_public_api_v1_health_check_proto_rawDescData = protoimpl.X.CompressGZIP(file_rapid_public_api_v1_health_check_proto_rawDescData) + }) + return file_rapid_public_api_v1_health_check_proto_rawDescData +} + +var file_rapid_public_api_v1_health_check_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_rapid_public_api_v1_health_check_proto_goTypes = []interface{}{ + (*PublicDeepHealthCheckRequest)(nil), // 0: rapid.public_api.v1.PublicDeepHealthCheckRequest + (*PublicDeepHealthCheckResponse)(nil), // 1: rapid.public_api.v1.PublicDeepHealthCheckResponse +} +var file_rapid_public_api_v1_health_check_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_rapid_public_api_v1_health_check_proto_init() } +func file_rapid_public_api_v1_health_check_proto_init() { + if File_rapid_public_api_v1_health_check_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_rapid_public_api_v1_health_check_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublicDeepHealthCheckRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_rapid_public_api_v1_health_check_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PublicDeepHealthCheckResponse); 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_rapid_public_api_v1_health_check_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_rapid_public_api_v1_health_check_proto_goTypes, + DependencyIndexes: file_rapid_public_api_v1_health_check_proto_depIdxs, + MessageInfos: file_rapid_public_api_v1_health_check_proto_msgTypes, + }.Build() + File_rapid_public_api_v1_health_check_proto = out.File + file_rapid_public_api_v1_health_check_proto_rawDesc = nil + file_rapid_public_api_v1_health_check_proto_goTypes = nil + file_rapid_public_api_v1_health_check_proto_depIdxs = nil +} From 254e44e023f96d4298b5d1d94cab6ee31cdb8286 Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:04 +0900 Subject: [PATCH 05/11] feat: impl deep health check --- .../pb/rapid/public_api/v1/public_grpc.pb.go | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/internal/infrastructure/grpc/pb/rapid/public_api/v1/public_grpc.pb.go b/internal/infrastructure/grpc/pb/rapid/public_api/v1/public_grpc.pb.go index 8666ef529..b1217b973 100644 --- a/internal/infrastructure/grpc/pb/rapid/public_api/v1/public_grpc.pb.go +++ b/internal/infrastructure/grpc/pb/rapid/public_api/v1/public_grpc.pb.go @@ -19,6 +19,7 @@ const _ = grpc.SupportPackageIsVersion7 // // 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 PublicV1ServiceClient interface { + PublicDeepHealthCheck(ctx context.Context, in *PublicDeepHealthCheckRequest, opts ...grpc.CallOption) (*PublicDeepHealthCheckResponse, error) PublicSignIn(ctx context.Context, in *PublicSignInRequest, opts ...grpc.CallOption) (*PublicSignInResponse, error) PublicGetTenant(ctx context.Context, in *PublicGetTenantRequest, opts ...grpc.CallOption) (*PublicGetTenantResponse, error) } @@ -31,6 +32,15 @@ func NewPublicV1ServiceClient(cc grpc.ClientConnInterface) PublicV1ServiceClient return &publicV1ServiceClient{cc} } +func (c *publicV1ServiceClient) PublicDeepHealthCheck(ctx context.Context, in *PublicDeepHealthCheckRequest, opts ...grpc.CallOption) (*PublicDeepHealthCheckResponse, error) { + out := new(PublicDeepHealthCheckResponse) + err := c.cc.Invoke(ctx, "/rapid.public_api.v1.PublicV1Service/PublicDeepHealthCheck", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *publicV1ServiceClient) PublicSignIn(ctx context.Context, in *PublicSignInRequest, opts ...grpc.CallOption) (*PublicSignInResponse, error) { out := new(PublicSignInResponse) err := c.cc.Invoke(ctx, "/rapid.public_api.v1.PublicV1Service/PublicSignIn", in, out, opts...) @@ -53,6 +63,7 @@ func (c *publicV1ServiceClient) PublicGetTenant(ctx context.Context, in *PublicG // All implementations should embed UnimplementedPublicV1ServiceServer // for forward compatibility type PublicV1ServiceServer interface { + PublicDeepHealthCheck(context.Context, *PublicDeepHealthCheckRequest) (*PublicDeepHealthCheckResponse, error) PublicSignIn(context.Context, *PublicSignInRequest) (*PublicSignInResponse, error) PublicGetTenant(context.Context, *PublicGetTenantRequest) (*PublicGetTenantResponse, error) } @@ -61,6 +72,9 @@ type PublicV1ServiceServer interface { type UnimplementedPublicV1ServiceServer struct { } +func (UnimplementedPublicV1ServiceServer) PublicDeepHealthCheck(context.Context, *PublicDeepHealthCheckRequest) (*PublicDeepHealthCheckResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublicDeepHealthCheck not implemented") +} func (UnimplementedPublicV1ServiceServer) PublicSignIn(context.Context, *PublicSignInRequest) (*PublicSignInResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PublicSignIn not implemented") } @@ -79,6 +93,24 @@ func RegisterPublicV1ServiceServer(s grpc.ServiceRegistrar, srv PublicV1ServiceS s.RegisterService(&PublicV1Service_ServiceDesc, srv) } +func _PublicV1Service_PublicDeepHealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublicDeepHealthCheckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PublicV1ServiceServer).PublicDeepHealthCheck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rapid.public_api.v1.PublicV1Service/PublicDeepHealthCheck", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PublicV1ServiceServer).PublicDeepHealthCheck(ctx, req.(*PublicDeepHealthCheckRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _PublicV1Service_PublicSignIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PublicSignInRequest) if err := dec(in); err != nil { @@ -122,6 +154,10 @@ var PublicV1Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "rapid.public_api.v1.PublicV1Service", HandlerType: (*PublicV1ServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "PublicDeepHealthCheck", + Handler: _PublicV1Service_PublicDeepHealthCheck_Handler, + }, { MethodName: "PublicSignIn", Handler: _PublicV1Service_PublicSignIn_Handler, From d6cb2d18a6f4f15bbac0c5e4b45561de3e04774e Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:06 +0900 Subject: [PATCH 06/11] feat: impl deep health check --- .../grpc/pb/rapid/public_api/v1/public.pb.go | 117 ++++++++++-------- 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.go b/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.go index 9ee4f1b77..d5a944d55 100644 --- a/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.go +++ b/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.go @@ -29,61 +29,77 @@ var file_rapid_public_api_v1_public_proto_rawDesc = []byte{ 0x74, 0x6f, 0x12, 0x13, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 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, 0x20, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x61, 0x6e, - 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x28, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, - 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x32, 0x9e, 0x02, 0x0a, 0x0f, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x56, 0x31, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7b, 0x0a, 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x28, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x29, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x69, 0x67, 0x6e, - 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x10, 0x3a, 0x01, 0x2a, 0x22, 0x0b, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x5f, - 0x69, 0x6e, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x47, 0x65, 0x74, - 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x12, 0x2b, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x47, 0x65, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, - 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x73, 0x2f, 0x7b, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, - 0x64, 0x7d, 0x42, 0xf4, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, - 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x0b, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x62, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x79, 0x73, 0x73, 0x70, - 0x61, 0x72, 0x61, 0x6e, 0x6f, 0x69, 0x61, 0x2f, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2d, 0x67, 0x6f, - 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x73, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x62, - 0x2f, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x61, 0x70, 0x69, 0x64, 0x2e, - 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, - 0x61, 0x70, 0x69, 0x64, 0x5c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x5c, 0x56, - 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x61, 0x70, 0x69, 0x64, 0x5c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x61, 0x70, 0x69, 0x64, 0x3a, 0x3a, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x26, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x72, + 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x28, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, + 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xbe, 0x03, 0x0a, 0x0f, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x56, 0x31, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x9d, 0x01, + 0x0a, 0x15, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x65, 0x70, 0x48, 0x65, 0x61, 0x6c, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x31, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x65, 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, 0x72, 0x61, 0x70, + 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, + 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x44, 0x65, 0x65, 0x70, 0x48, 0x65, 0x61, 0x6c, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x65, 0x70, + 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x7b, 0x0a, + 0x0c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x12, 0x28, 0x2e, + 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, + 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x53, 0x69, 0x67, 0x6e, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x01, 0x2a, 0x22, 0x0b, 0x2f, + 0x76, 0x31, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x5f, 0x69, 0x6e, 0x12, 0x8d, 0x01, 0x0a, 0x0f, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x12, 0x2b, + 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x47, 0x65, 0x74, 0x54, 0x65, + 0x6e, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x72, 0x61, + 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x47, 0x65, 0x74, 0x54, 0x65, 0x6e, 0x61, 0x6e, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x19, 0x12, 0x17, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x73, 0x2f, 0x7b, + 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x42, 0xf4, 0x01, 0x0a, 0x17, 0x63, + 0x6f, 0x6d, 0x2e, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, + 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x62, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x61, 0x62, 0x79, 0x73, 0x73, 0x70, 0x61, 0x72, 0x61, 0x6e, 0x6f, 0x69, 0x61, 0x2f, + 0x72, 0x61, 0x70, 0x69, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x62, 0x2f, 0x72, 0x61, 0x70, 0x69, 0x64, 0x2f, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x3b, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x5f, 0x61, 0x70, 0x69, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x50, 0x58, 0xaa, + 0x02, 0x12, 0x52, 0x61, 0x70, 0x69, 0x64, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, + 0x69, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, 0x61, 0x70, 0x69, 0x64, 0x5c, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x61, 0x70, 0x69, + 0x64, 0x5c, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x31, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x61, 0x70, + 0x69, 0x64, 0x3a, 0x3a, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_rapid_public_api_v1_public_proto_goTypes = []interface{}{ - (*PublicSignInRequest)(nil), // 0: rapid.public_api.v1.PublicSignInRequest - (*PublicGetTenantRequest)(nil), // 1: rapid.public_api.v1.PublicGetTenantRequest - (*PublicSignInResponse)(nil), // 2: rapid.public_api.v1.PublicSignInResponse - (*PublicGetTenantResponse)(nil), // 3: rapid.public_api.v1.PublicGetTenantResponse + (*PublicDeepHealthCheckRequest)(nil), // 0: rapid.public_api.v1.PublicDeepHealthCheckRequest + (*PublicSignInRequest)(nil), // 1: rapid.public_api.v1.PublicSignInRequest + (*PublicGetTenantRequest)(nil), // 2: rapid.public_api.v1.PublicGetTenantRequest + (*PublicDeepHealthCheckResponse)(nil), // 3: rapid.public_api.v1.PublicDeepHealthCheckResponse + (*PublicSignInResponse)(nil), // 4: rapid.public_api.v1.PublicSignInResponse + (*PublicGetTenantResponse)(nil), // 5: rapid.public_api.v1.PublicGetTenantResponse } var file_rapid_public_api_v1_public_proto_depIdxs = []int32{ - 0, // 0: rapid.public_api.v1.PublicV1Service.PublicSignIn:input_type -> rapid.public_api.v1.PublicSignInRequest - 1, // 1: rapid.public_api.v1.PublicV1Service.PublicGetTenant:input_type -> rapid.public_api.v1.PublicGetTenantRequest - 2, // 2: rapid.public_api.v1.PublicV1Service.PublicSignIn:output_type -> rapid.public_api.v1.PublicSignInResponse - 3, // 3: rapid.public_api.v1.PublicV1Service.PublicGetTenant:output_type -> rapid.public_api.v1.PublicGetTenantResponse - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type + 0, // 0: rapid.public_api.v1.PublicV1Service.PublicDeepHealthCheck:input_type -> rapid.public_api.v1.PublicDeepHealthCheckRequest + 1, // 1: rapid.public_api.v1.PublicV1Service.PublicSignIn:input_type -> rapid.public_api.v1.PublicSignInRequest + 2, // 2: rapid.public_api.v1.PublicV1Service.PublicGetTenant:input_type -> rapid.public_api.v1.PublicGetTenantRequest + 3, // 3: rapid.public_api.v1.PublicV1Service.PublicDeepHealthCheck:output_type -> rapid.public_api.v1.PublicDeepHealthCheckResponse + 4, // 4: rapid.public_api.v1.PublicV1Service.PublicSignIn:output_type -> rapid.public_api.v1.PublicSignInResponse + 5, // 5: rapid.public_api.v1.PublicV1Service.PublicGetTenant:output_type -> rapid.public_api.v1.PublicGetTenantResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] 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 @@ -94,6 +110,7 @@ func file_rapid_public_api_v1_public_proto_init() { if File_rapid_public_api_v1_public_proto != nil { return } + file_rapid_public_api_v1_health_check_proto_init() file_rapid_public_api_v1_tenant_proto_init() file_rapid_public_api_v1_authentication_proto_init() type x struct{} From 450a5173b75181e34dde96b0a1affbbfb9c56cc7 Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:08 +0900 Subject: [PATCH 07/11] feat: impl deep health check --- .../pb/rapid/public_api/v1/public.pb.gw.go | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.gw.go b/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.gw.go index e0f832825..63bf6c8eb 100644 --- a/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.gw.go +++ b/internal/infrastructure/grpc/pb/rapid/public_api/v1/public.pb.gw.go @@ -31,6 +31,24 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = metadata.Join +func request_PublicV1Service_PublicDeepHealthCheck_0(ctx context.Context, marshaler runtime.Marshaler, client PublicV1ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PublicDeepHealthCheckRequest + var metadata runtime.ServerMetadata + + msg, err := client.PublicDeepHealthCheck(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_PublicV1Service_PublicDeepHealthCheck_0(ctx context.Context, marshaler runtime.Marshaler, server PublicV1ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PublicDeepHealthCheckRequest + var metadata runtime.ServerMetadata + + msg, err := server.PublicDeepHealthCheck(ctx, &protoReq) + return msg, metadata, err + +} + func request_PublicV1Service_PublicSignIn_0(ctx context.Context, marshaler runtime.Marshaler, client PublicV1ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq PublicSignInRequest var metadata runtime.ServerMetadata @@ -123,6 +141,31 @@ func local_request_PublicV1Service_PublicGetTenant_0(ctx context.Context, marsha // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPublicV1ServiceHandlerFromEndpoint instead. func RegisterPublicV1ServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PublicV1ServiceServer) error { + mux.Handle("GET", pattern_PublicV1Service_PublicDeepHealthCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/rapid.public_api.v1.PublicV1Service/PublicDeepHealthCheck", runtime.WithHTTPPathPattern("/v1/deep_health_check")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_PublicV1Service_PublicDeepHealthCheck_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_PublicV1Service_PublicDeepHealthCheck_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_PublicV1Service_PublicSignIn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -214,6 +257,28 @@ func RegisterPublicV1ServiceHandler(ctx context.Context, mux *runtime.ServeMux, // "PublicV1ServiceClient" to call the correct interceptors. func RegisterPublicV1ServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PublicV1ServiceClient) error { + mux.Handle("GET", pattern_PublicV1Service_PublicDeepHealthCheck_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/rapid.public_api.v1.PublicV1Service/PublicDeepHealthCheck", runtime.WithHTTPPathPattern("/v1/deep_health_check")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_PublicV1Service_PublicDeepHealthCheck_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_PublicV1Service_PublicDeepHealthCheck_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("POST", pattern_PublicV1Service_PublicSignIn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -262,12 +327,16 @@ func RegisterPublicV1ServiceHandlerClient(ctx context.Context, mux *runtime.Serv } var ( + pattern_PublicV1Service_PublicDeepHealthCheck_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "deep_health_check"}, "")) + pattern_PublicV1Service_PublicSignIn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sign_in"}, "")) pattern_PublicV1Service_PublicGetTenant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "tenants", "tenant_id"}, "")) ) var ( + forward_PublicV1Service_PublicDeepHealthCheck_0 = runtime.ForwardResponseMessage + forward_PublicV1Service_PublicSignIn_0 = runtime.ForwardResponseMessage forward_PublicV1Service_PublicGetTenant_0 = runtime.ForwardResponseMessage From f0a82440056d3f080ae91b6a8dfd2e7686da61ac Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:10 +0900 Subject: [PATCH 08/11] feat: impl deep health check --- internal/infrastructure/grpc/run.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/infrastructure/grpc/run.go b/internal/infrastructure/grpc/run.go index ad1ba0272..7c68f048f 100644 --- a/internal/infrastructure/grpc/run.go +++ b/internal/infrastructure/grpc/run.go @@ -84,6 +84,7 @@ func NewServer(ctx context.Context, public_apiv1.RegisterPublicV1ServiceServer( server, public.NewPublicHandler( + dependency.DatabaseCli, dependency.PublicAuthenticationInteractor, dependency.PublicTenantInteractor, ), From 41fda5a79ebd9bae363700ef503f78d6427cb064 Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:13 +0900 Subject: [PATCH 09/11] feat: impl deep health check --- schema/openapi/apidocs.swagger.json | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/schema/openapi/apidocs.swagger.json b/schema/openapi/apidocs.swagger.json index 5e2a14fda..fd4c7b127 100644 --- a/schema/openapi/apidocs.swagger.json +++ b/schema/openapi/apidocs.swagger.json @@ -237,6 +237,22 @@ ] } }, + "/v1/deep_health_check": { + "get": { + "operationId": "PublicDeepHealthCheck", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1PublicDeepHealthCheckResponse" + } + } + }, + "tags": [ + "PublicV1Service" + ] + } + }, "/v1/sign_in": { "post": { "operationId": "PublicSignIn", @@ -486,6 +502,17 @@ "has_next" ] }, + "v1PublicDeepHealthCheckResponse": { + "type": "object", + "properties": { + "database_status": { + "type": "string" + } + }, + "required": [ + "database_status" + ] + }, "v1PublicGetTenantResponse": { "type": "object", "properties": { From 062218de5ed38199b9c1b05461af0842da2f941d Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:15 +0900 Subject: [PATCH 10/11] feat: impl deep health check --- .../rapid/public_api/v1/health_check.proto | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 schema/proto/rapid/public_api/v1/health_check.proto diff --git a/schema/proto/rapid/public_api/v1/health_check.proto b/schema/proto/rapid/public_api/v1/health_check.proto new file mode 100644 index 000000000..0a8776afa --- /dev/null +++ b/schema/proto/rapid/public_api/v1/health_check.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; + +package rapid.public_api.v1; + +import "protoc-gen-openapiv2/options/annotations.proto"; + +message PublicDeepHealthCheckRequest { +} + +message PublicDeepHealthCheckResponse { + string database_status = 1; + + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { + json_schema: { + required: ["database_status"] + } + }; +} \ No newline at end of file From 17d461c89d8ea563455beca662c77b46a656e224 Mon Sep 17 00:00:00 2001 From: abyssparanoia Date: Fri, 6 Jan 2023 00:14:17 +0900 Subject: [PATCH 11/11] feat: impl deep health check --- schema/proto/rapid/public_api/v1/public.proto | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/schema/proto/rapid/public_api/v1/public.proto b/schema/proto/rapid/public_api/v1/public.proto index 733356216..c5906702c 100644 --- a/schema/proto/rapid/public_api/v1/public.proto +++ b/schema/proto/rapid/public_api/v1/public.proto @@ -3,10 +3,17 @@ syntax = "proto3"; package rapid.public_api.v1; import "google/api/annotations.proto"; +import "rapid/public_api/v1/health_check.proto"; import "rapid/public_api/v1/tenant.proto"; import "rapid/public_api/v1/authentication.proto"; service PublicV1Service { + rpc PublicDeepHealthCheck(PublicDeepHealthCheckRequest) returns(PublicDeepHealthCheckResponse) { + option (google.api.http) = { + get: "/v1/deep_health_check" + }; + } + rpc PublicSignIn(PublicSignInRequest) returns (PublicSignInResponse) { option (google.api.http) = { post: "/v1/sign_in",