From 9e34ca490bdc28e4445df81d0a6dc2d70a558ae3 Mon Sep 17 00:00:00 2001 From: PoAn Yang Date: Wed, 5 Jun 2024 17:48:30 +0800 Subject: [PATCH] feat: migrate profilerpb from go-common-libs to types Signed-off-by: PoAn Yang --- go.mod | 6 +- go.sum | 14 +- pkg/controller/rpc/server.go | 4 +- pkg/replica/rpc/server.go | 4 +- .../generated/profilerpb/profiler.pb.go | 287 ------------------ .../go-common-libs/profiler/profiler.go | 34 +-- .../longhorn/go-common-libs/utils/misc.go | 3 +- .../generated/profilerrpc/profilerrpc.pb.go | 284 +++++++++++++++++ .../profilerrpc/profilerrpc_grpc.pb.go} | 20 +- .../gopsutil/v3/internal/common/sleep.go | 2 +- vendor/modules.txt | 10 +- 11 files changed, 335 insertions(+), 333 deletions(-) delete mode 100644 vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler.pb.go create mode 100644 vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc.pb.go rename vendor/github.com/longhorn/{go-common-libs/generated/profilerpb/profiler_grpc.pb.go => types/pkg/generated/profilerrpc/profilerrpc_grpc.pb.go} (88%) diff --git a/go.mod b/go.mod index 9f593f436..12352c135 100644 --- a/go.mod +++ b/go.mod @@ -9,10 +9,10 @@ require ( github.com/gorilla/handlers v1.5.2 github.com/gorilla/mux v1.8.1 github.com/longhorn/backupstore v0.0.0-20240509144945-3bce6e69af15 - github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90 + github.com/longhorn/go-common-libs v0.0.0-20240605094403-68743dacbcb1 github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8 - github.com/longhorn/types v0.0.0-20240510221052-ab949bbedea3 + github.com/longhorn/types v0.0.0-20240605091135-ef450e1c04cd github.com/moby/moby v24.0.9+incompatible github.com/pkg/errors v0.9.1 github.com/rancher/go-fibmap v0.0.0-20160418233256-5fc9f8c1ed47 @@ -61,7 +61,7 @@ require ( github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/shirou/gopsutil/v3 v3.24.3 // indirect + github.com/shirou/gopsutil/v3 v3.24.4 // indirect github.com/slok/goresilience v0.2.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index 701f6a0a8..d8dc7e320 100644 --- a/go.sum +++ b/go.sum @@ -68,14 +68,14 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/longhorn/backupstore v0.0.0-20240509144945-3bce6e69af15 h1:D838/RWPKmP9ozjOM2Al8s11NbTGLC2m+ZKT3JAogfY= github.com/longhorn/backupstore v0.0.0-20240509144945-3bce6e69af15/go.mod h1:n210xpMUVrSn/W4Za/9BZhyXLCTVfAOq5lNdLrRSyz8= -github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90 h1:uBVee6AulPsgSvsvaxdj4xIdgkIvjIqA0j7ZD+Hg/Mc= -github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90/go.mod h1:qppGSy9WsxH1C9T6yhSMvG53ynpasyKOH/n9e1jr8mw= +github.com/longhorn/go-common-libs v0.0.0-20240605094403-68743dacbcb1 h1:Q0/LpqfbGG++p1S+3LaYmEWD5+QTP/hZou2f861zUMM= +github.com/longhorn/go-common-libs v0.0.0-20240605094403-68743dacbcb1/go.mod h1:C1B3gmrgMK2bgQhU7wntbFy6PiJDucNFRcoQKjrTu8k= github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce h1:PxKniE9F6IZ2DMKfmxDsbqeAxQI1TZhnw7/HOBMs1Is= github.com/longhorn/go-iscsi-helper v0.0.0-20240427164656-e9439c0018ce/go.mod h1:d9t3gtE+UPjescbCFluXd4xBc8OQT/JrC2cdkk2IXWQ= github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8 h1:lwtmZEomiv8uchwo9JIyoo+lK8J3cLCm7/qzpn6wmzo= github.com/longhorn/sparse-tools v0.0.0-20240427164751-a7b9f1b2c8a8/go.mod h1:pvlUkVwRGojXhcTkkzksOe4i7GVk59P2PbJjHIB2Yj0= -github.com/longhorn/types v0.0.0-20240510221052-ab949bbedea3 h1:yCn2uYikI3xW3i1HHpKytitJ2lc7S5obDMKIa7ZIuc8= -github.com/longhorn/types v0.0.0-20240510221052-ab949bbedea3/go.mod h1:1oEh1cnDDqNSuFh/dH/lvJ3Ssq83SOweTAAPLRY4PMI= +github.com/longhorn/types v0.0.0-20240605091135-ef450e1c04cd h1:gzvHnEc4vdHmOtxwgjC/7YmChbzDsfYiY0wpI3RgB1A= +github.com/longhorn/types v0.0.0-20240605091135-ef450e1c04cd/go.mod h1:1oEh1cnDDqNSuFh/dH/lvJ3Ssq83SOweTAAPLRY4PMI= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -121,8 +121,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shirou/gopsutil/v3 v3.24.3 h1:eoUGJSmdfLzJ3mxIhmOAhgKEKgQkeOwKpz1NbhVnuPE= -github.com/shirou/gopsutil/v3 v3.24.3/go.mod h1:JpND7O217xa72ewWz9zN2eIIkPWsDN/3pl0H8Qt0uwg= +github.com/shirou/gopsutil/v3 v3.24.4 h1:dEHgzZXt4LMNm+oYELpzl9YCqV65Yr/6SfrvgRBtXeU= +github.com/shirou/gopsutil/v3 v3.24.4/go.mod h1:lTd2mdiOspcqLgAnr9/nGi71NkeMpWKdmhuxm9GusH8= github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ= github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= @@ -184,7 +184,7 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= diff --git a/pkg/controller/rpc/server.go b/pkg/controller/rpc/server.go index d1f02db4b..ead3f09c7 100644 --- a/pkg/controller/rpc/server.go +++ b/pkg/controller/rpc/server.go @@ -10,10 +10,10 @@ import ( "google.golang.org/grpc/reflection" "google.golang.org/protobuf/types/known/emptypb" - "github.com/longhorn/go-common-libs/generated/profilerpb" "github.com/longhorn/go-common-libs/profiler" journal "github.com/longhorn/sparse-tools/stats" "github.com/longhorn/types/pkg/generated/enginerpc" + "github.com/longhorn/types/pkg/generated/profilerrpc" "github.com/longhorn/longhorn-engine/pkg/controller" "github.com/longhorn/longhorn-engine/pkg/interceptor" @@ -52,7 +52,7 @@ func GetControllerGRPCServer(volumeName, instanceName string, c *controller.Cont enginerpc.RegisterControllerServiceServer(server, cs) healthpb.RegisterHealthServer(server, NewControllerHealthCheckServer(cs)) reflection.Register(server) - profilerpb.RegisterProfilerServer(server, profiler.NewServer(volumeName)) + profilerrpc.RegisterProfilerServer(server, profiler.NewServer(volumeName)) return server } diff --git a/pkg/replica/rpc/server.go b/pkg/replica/rpc/server.go index b68e8f354..5b3f87642 100644 --- a/pkg/replica/rpc/server.go +++ b/pkg/replica/rpc/server.go @@ -4,9 +4,9 @@ import ( "fmt" "strconv" - "github.com/longhorn/go-common-libs/generated/profilerpb" "github.com/longhorn/go-common-libs/profiler" "github.com/longhorn/types/pkg/generated/enginerpc" + "github.com/longhorn/types/pkg/generated/profilerrpc" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -35,7 +35,7 @@ func NewReplicaServer(volumeName, instanceName string, s *replica.Server) *grpc. enginerpc.RegisterReplicaServiceServer(server, rs) healthpb.RegisterHealthServer(server, NewReplicaHealthCheckServer(rs)) reflection.Register(server) - profilerpb.RegisterProfilerServer(server, profiler.NewServer(volumeName)) + profilerrpc.RegisterProfilerServer(server, profiler.NewServer(volumeName)) return server } diff --git a/vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler.pb.go b/vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler.pb.go deleted file mode 100644 index e8785604b..000000000 --- a/vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler.pb.go +++ /dev/null @@ -1,287 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.28.1 -// protoc v4.25.1 -// source: profiler.proto - -package profilerpb - -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) -) - -type Op int32 - -const ( - Op_SHOW Op = 0 - Op_ENABLE Op = 1 - Op_DISABLE Op = 2 -) - -// Enum value maps for Op. -var ( - Op_name = map[int32]string{ - 0: "SHOW", - 1: "ENABLE", - 2: "DISABLE", - } - Op_value = map[string]int32{ - "SHOW": 0, - "ENABLE": 1, - "DISABLE": 2, - } -) - -func (x Op) Enum() *Op { - p := new(Op) - *p = x - return p -} - -func (x Op) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Op) Descriptor() protoreflect.EnumDescriptor { - return file_profiler_proto_enumTypes[0].Descriptor() -} - -func (Op) Type() protoreflect.EnumType { - return &file_profiler_proto_enumTypes[0] -} - -func (x Op) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Op.Descriptor instead. -func (Op) EnumDescriptor() ([]byte, []int) { - return file_profiler_proto_rawDescGZIP(), []int{0} -} - -type ProfilerOPRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - RequestOp Op `protobuf:"varint,1,opt,name=request_op,json=requestOp,proto3,enum=longhorn.common.profiler.Op" json:"request_op,omitempty"` - PortNumber int32 `protobuf:"varint,2,opt,name=port_number,json=portNumber,proto3" json:"port_number,omitempty"` -} - -func (x *ProfilerOPRequest) Reset() { - *x = ProfilerOPRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_profiler_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProfilerOPRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProfilerOPRequest) ProtoMessage() {} - -func (x *ProfilerOPRequest) ProtoReflect() protoreflect.Message { - mi := &file_profiler_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 ProfilerOPRequest.ProtoReflect.Descriptor instead. -func (*ProfilerOPRequest) Descriptor() ([]byte, []int) { - return file_profiler_proto_rawDescGZIP(), []int{0} -} - -func (x *ProfilerOPRequest) GetRequestOp() Op { - if x != nil { - return x.RequestOp - } - return Op_SHOW -} - -func (x *ProfilerOPRequest) GetPortNumber() int32 { - if x != nil { - return x.PortNumber - } - return 0 -} - -type ProfilerOPResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ProfilerAddr string `protobuf:"bytes,1,opt,name=profiler_addr,json=profilerAddr,proto3" json:"profiler_addr,omitempty"` -} - -func (x *ProfilerOPResponse) Reset() { - *x = ProfilerOPResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_profiler_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProfilerOPResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProfilerOPResponse) ProtoMessage() {} - -func (x *ProfilerOPResponse) ProtoReflect() protoreflect.Message { - mi := &file_profiler_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 ProfilerOPResponse.ProtoReflect.Descriptor instead. -func (*ProfilerOPResponse) Descriptor() ([]byte, []int) { - return file_profiler_proto_rawDescGZIP(), []int{1} -} - -func (x *ProfilerOPResponse) GetProfilerAddr() string { - if x != nil { - return x.ProfilerAddr - } - return "" -} - -var File_profiler_proto protoreflect.FileDescriptor - -var file_profiler_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x18, 0x6c, 0x6f, 0x6e, 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x22, 0x71, 0x0a, 0x11, 0x50, 0x72, - 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x3b, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2e, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x4f, - 0x70, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x70, 0x12, 0x1f, 0x0a, 0x0b, - 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0a, 0x70, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x39, 0x0a, - 0x12, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x66, - 0x69, 0x6c, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x2a, 0x27, 0x0a, 0x02, 0x4f, 0x70, 0x12, 0x08, - 0x0a, 0x04, 0x53, 0x48, 0x4f, 0x57, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x45, 0x4e, 0x41, 0x42, - 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x49, 0x53, 0x41, 0x42, 0x4c, 0x45, 0x10, - 0x02, 0x32, 0x75, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x12, 0x69, 0x0a, - 0x0a, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x12, 0x2b, 0x2e, 0x6c, 0x6f, - 0x6e, 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, - 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6c, 0x6f, 0x6e, 0x67, 0x68, - 0x6f, 0x72, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, - 0x6c, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x6f, 0x6e, 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2f, - 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2d, 0x6c, 0x69, 0x62, 0x73, 0x2f, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, - 0x72, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_profiler_proto_rawDescOnce sync.Once - file_profiler_proto_rawDescData = file_profiler_proto_rawDesc -) - -func file_profiler_proto_rawDescGZIP() []byte { - file_profiler_proto_rawDescOnce.Do(func() { - file_profiler_proto_rawDescData = protoimpl.X.CompressGZIP(file_profiler_proto_rawDescData) - }) - return file_profiler_proto_rawDescData -} - -var file_profiler_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_profiler_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_profiler_proto_goTypes = []interface{}{ - (Op)(0), // 0: longhorn.common.profiler.Op - (*ProfilerOPRequest)(nil), // 1: longhorn.common.profiler.ProfilerOPRequest - (*ProfilerOPResponse)(nil), // 2: longhorn.common.profiler.ProfilerOPResponse -} -var file_profiler_proto_depIdxs = []int32{ - 0, // 0: longhorn.common.profiler.ProfilerOPRequest.request_op:type_name -> longhorn.common.profiler.Op - 1, // 1: longhorn.common.profiler.Profiler.ProfilerOP:input_type -> longhorn.common.profiler.ProfilerOPRequest - 2, // 2: longhorn.common.profiler.Profiler.ProfilerOP:output_type -> longhorn.common.profiler.ProfilerOPResponse - 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_profiler_proto_init() } -func file_profiler_proto_init() { - if File_profiler_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_profiler_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProfilerOPRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_profiler_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProfilerOPResponse); 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_profiler_proto_rawDesc, - NumEnums: 1, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_profiler_proto_goTypes, - DependencyIndexes: file_profiler_proto_depIdxs, - EnumInfos: file_profiler_proto_enumTypes, - MessageInfos: file_profiler_proto_msgTypes, - }.Build() - File_profiler_proto = out.File - file_profiler_proto_rawDesc = nil - file_profiler_proto_goTypes = nil - file_profiler_proto_depIdxs = nil -} diff --git a/vendor/github.com/longhorn/go-common-libs/profiler/profiler.go b/vendor/github.com/longhorn/go-common-libs/profiler/profiler.go index ea01e71bd..a890cde58 100644 --- a/vendor/github.com/longhorn/go-common-libs/profiler/profiler.go +++ b/vendor/github.com/longhorn/go-common-libs/profiler/profiler.go @@ -10,11 +10,11 @@ import ( "sync" "time" + "github.com/longhorn/types/pkg/generated/profilerrpc" "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "github.com/longhorn/go-common-libs/generated/profilerpb" "github.com/longhorn/go-common-libs/utils" ) @@ -24,7 +24,7 @@ import ( // - service: the ProfilerClient type ClientContext struct { conn *grpc.ClientConn - service profilerpb.ProfilerClient + service profilerrpc.ProfilerClient } // Close closes the connection for the gRPC server @@ -43,7 +43,7 @@ func (c ClientContext) Close() error { // - server: the http server for the profiler // - lock: the RW lock for the server type Server struct { - profilerpb.UnimplementedProfilerServer + profilerrpc.UnimplementedProfilerServer name string errMsg string @@ -87,7 +87,7 @@ func NewClient(address, name string, dialOpts ...grpc.DialOption) (*Client, erro return ClientContext{ conn: connection, - service: profilerpb.NewProfilerClient(connection), + service: profilerrpc.NewProfilerClient(connection), }, nil } @@ -106,20 +106,20 @@ func NewClient(address, name string, dialOpts ...grpc.DialOption) (*Client, erro } // ProfilerOP is the gRPC function to provide the entry point for the profiler operations -func (s *Server) ProfilerOP(_ context.Context, req *profilerpb.ProfilerOPRequest) (*profilerpb.ProfilerOPResponse, error) { +func (s *Server) ProfilerOP(_ context.Context, req *profilerrpc.ProfilerOPRequest) (*profilerrpc.ProfilerOPResponse, error) { logrus.Infof("Profiler operation: %v, port: %v", req.RequestOp, req.PortNumber) var err error switch req.RequestOp { - case profilerpb.Op_SHOW: - reply := &profilerpb.ProfilerOPResponse{} + case profilerrpc.Op_SHOW: + reply := &profilerrpc.ProfilerOPResponse{} reply.ProfilerAddr, err = s.ShowProfiler() return reply, err - case profilerpb.Op_ENABLE: - reply := &profilerpb.ProfilerOPResponse{} + case profilerrpc.Op_ENABLE: + reply := &profilerrpc.ProfilerOPResponse{} reply.ProfilerAddr, err = s.EnableProfiler(req.PortNumber) return reply, err - case profilerpb.Op_DISABLE: - reply := &profilerpb.ProfilerOPResponse{} + case profilerrpc.Op_DISABLE: + reply := &profilerrpc.ProfilerOPResponse{} reply.ProfilerAddr, err = s.DisableProfiler() return reply, err default: @@ -210,7 +210,7 @@ func (s *Server) EnableProfiler(portNumber int32) (string, error) { return s.server.Addr, nil } -// DisableProfiler disables the profilerpb. +// DisableProfiler disables the profilerrpc. // It will return the error when fails to shut down the profiler server. func (s *Server) DisableProfiler() (string, error) { s.lock.Lock() @@ -236,20 +236,20 @@ func (s *Server) DisableProfiler() (string, error) { // ProfilerOP will call the doProfilerOP for the ProfilerServer. // It will convert the hunam readable op to internal usage and is the entry point for the profiler operations. func (c *Client) ProfilerOP(op string, portNumber int32) (string, error) { - opValue, exists := profilerpb.Op_value[op] + opValue, exists := profilerrpc.Op_value[op] if !exists { return "", fmt.Errorf("invalid operation: %v", op) } - return c.doProfilerOP(profilerpb.Op(opValue), portNumber) + return c.doProfilerOP(profilerrpc.Op(opValue), portNumber) } // doProfilerOP is the internal function to call the ProfilerOP for the ProfilerServer. -func (c *Client) doProfilerOP(op profilerpb.Op, portNumber int32) (string, error) { +func (c *Client) doProfilerOP(op profilerrpc.Op, portNumber int32) (string, error) { controllerServiceClient := c.getProfilerServiceClient() ctx, cancel := context.WithTimeout(context.Background(), utils.GRPCServiceTimeout) defer cancel() - reply, err := controllerServiceClient.ProfilerOP(ctx, &profilerpb.ProfilerOPRequest{ + reply, err := controllerServiceClient.ProfilerOP(ctx, &profilerrpc.ProfilerOPRequest{ RequestOp: op, PortNumber: portNumber, }) @@ -260,6 +260,6 @@ func (c *Client) doProfilerOP(op profilerpb.Op, portNumber int32) (string, error } // getProfilerServiceClient returns the ProfilerClient (internal function) -func (c *Client) getProfilerServiceClient() profilerpb.ProfilerClient { +func (c *Client) getProfilerServiceClient() profilerrpc.ProfilerClient { return c.service } diff --git a/vendor/github.com/longhorn/go-common-libs/utils/misc.go b/vendor/github.com/longhorn/go-common-libs/utils/misc.go index 8eeb4177b..8485c6797 100644 --- a/vendor/github.com/longhorn/go-common-libs/utils/misc.go +++ b/vendor/github.com/longhorn/go-common-libs/utils/misc.go @@ -6,6 +6,7 @@ import ( "path/filepath" "reflect" "runtime" + "strings" "github.com/google/uuid" "github.com/pkg/errors" @@ -67,7 +68,7 @@ func RandomID(randomIDLenth int) string { randomIDLenth = types.RandomIDDefaultLength } - uuid := UUID() + uuid := strings.Replace(UUID(), "-", "", -1) if len(uuid) > randomIDLenth { uuid = uuid[:randomIDLenth] diff --git a/vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc.pb.go b/vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc.pb.go new file mode 100644 index 000000000..ad11aa0f3 --- /dev/null +++ b/vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc.pb.go @@ -0,0 +1,284 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.24.3 +// source: profilerrpc/profilerrpc.proto + +package profilerrpc + +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) +) + +type Op int32 + +const ( + Op_SHOW Op = 0 + Op_ENABLE Op = 1 + Op_DISABLE Op = 2 +) + +// Enum value maps for Op. +var ( + Op_name = map[int32]string{ + 0: "SHOW", + 1: "ENABLE", + 2: "DISABLE", + } + Op_value = map[string]int32{ + "SHOW": 0, + "ENABLE": 1, + "DISABLE": 2, + } +) + +func (x Op) Enum() *Op { + p := new(Op) + *p = x + return p +} + +func (x Op) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Op) Descriptor() protoreflect.EnumDescriptor { + return file_profilerrpc_profilerrpc_proto_enumTypes[0].Descriptor() +} + +func (Op) Type() protoreflect.EnumType { + return &file_profilerrpc_profilerrpc_proto_enumTypes[0] +} + +func (x Op) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Op.Descriptor instead. +func (Op) EnumDescriptor() ([]byte, []int) { + return file_profilerrpc_profilerrpc_proto_rawDescGZIP(), []int{0} +} + +type ProfilerOPRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RequestOp Op `protobuf:"varint,1,opt,name=request_op,json=requestOp,proto3,enum=profilerrpc.Op" json:"request_op,omitempty"` + PortNumber int32 `protobuf:"varint,2,opt,name=port_number,json=portNumber,proto3" json:"port_number,omitempty"` +} + +func (x *ProfilerOPRequest) Reset() { + *x = ProfilerOPRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_profilerrpc_profilerrpc_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProfilerOPRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProfilerOPRequest) ProtoMessage() {} + +func (x *ProfilerOPRequest) ProtoReflect() protoreflect.Message { + mi := &file_profilerrpc_profilerrpc_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 ProfilerOPRequest.ProtoReflect.Descriptor instead. +func (*ProfilerOPRequest) Descriptor() ([]byte, []int) { + return file_profilerrpc_profilerrpc_proto_rawDescGZIP(), []int{0} +} + +func (x *ProfilerOPRequest) GetRequestOp() Op { + if x != nil { + return x.RequestOp + } + return Op_SHOW +} + +func (x *ProfilerOPRequest) GetPortNumber() int32 { + if x != nil { + return x.PortNumber + } + return 0 +} + +type ProfilerOPResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProfilerAddr string `protobuf:"bytes,1,opt,name=profiler_addr,json=profilerAddr,proto3" json:"profiler_addr,omitempty"` +} + +func (x *ProfilerOPResponse) Reset() { + *x = ProfilerOPResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_profilerrpc_profilerrpc_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProfilerOPResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProfilerOPResponse) ProtoMessage() {} + +func (x *ProfilerOPResponse) ProtoReflect() protoreflect.Message { + mi := &file_profilerrpc_profilerrpc_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 ProfilerOPResponse.ProtoReflect.Descriptor instead. +func (*ProfilerOPResponse) Descriptor() ([]byte, []int) { + return file_profilerrpc_profilerrpc_proto_rawDescGZIP(), []int{1} +} + +func (x *ProfilerOPResponse) GetProfilerAddr() string { + if x != nil { + return x.ProfilerAddr + } + return "" +} + +var File_profilerrpc_profilerrpc_proto protoreflect.FileDescriptor + +var file_profilerrpc_profilerrpc_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x72, + 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0b, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x72, 0x70, 0x63, 0x22, 0x64, 0x0a, 0x11, + 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x2e, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, + 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x70, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, + 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x70, 0x6f, 0x72, 0x74, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x22, 0x39, 0x0a, 0x12, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x66, + 0x69, 0x6c, 0x65, 0x72, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0c, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x2a, 0x27, 0x0a, + 0x02, 0x4f, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x48, 0x4f, 0x57, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x45, 0x4e, 0x41, 0x42, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x49, 0x53, + 0x41, 0x42, 0x4c, 0x45, 0x10, 0x02, 0x32, 0x5b, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, + 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, + 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x72, 0x70, 0x63, 0x2e, 0x50, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1f, 0x2e, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x72, 0x70, 0x63, 0x2e, 0x50, + 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x72, 0x4f, 0x50, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6c, 0x6f, 0x6e, 0x67, 0x68, 0x6f, 0x72, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x66, 0x69, + 0x6c, 0x65, 0x72, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_profilerrpc_profilerrpc_proto_rawDescOnce sync.Once + file_profilerrpc_profilerrpc_proto_rawDescData = file_profilerrpc_profilerrpc_proto_rawDesc +) + +func file_profilerrpc_profilerrpc_proto_rawDescGZIP() []byte { + file_profilerrpc_profilerrpc_proto_rawDescOnce.Do(func() { + file_profilerrpc_profilerrpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_profilerrpc_profilerrpc_proto_rawDescData) + }) + return file_profilerrpc_profilerrpc_proto_rawDescData +} + +var file_profilerrpc_profilerrpc_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_profilerrpc_profilerrpc_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_profilerrpc_profilerrpc_proto_goTypes = []interface{}{ + (Op)(0), // 0: profilerrpc.Op + (*ProfilerOPRequest)(nil), // 1: profilerrpc.ProfilerOPRequest + (*ProfilerOPResponse)(nil), // 2: profilerrpc.ProfilerOPResponse +} +var file_profilerrpc_profilerrpc_proto_depIdxs = []int32{ + 0, // 0: profilerrpc.ProfilerOPRequest.request_op:type_name -> profilerrpc.Op + 1, // 1: profilerrpc.Profiler.ProfilerOP:input_type -> profilerrpc.ProfilerOPRequest + 2, // 2: profilerrpc.Profiler.ProfilerOP:output_type -> profilerrpc.ProfilerOPResponse + 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_profilerrpc_profilerrpc_proto_init() } +func file_profilerrpc_profilerrpc_proto_init() { + if File_profilerrpc_profilerrpc_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_profilerrpc_profilerrpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProfilerOPRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_profilerrpc_profilerrpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProfilerOPResponse); 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_profilerrpc_profilerrpc_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_profilerrpc_profilerrpc_proto_goTypes, + DependencyIndexes: file_profilerrpc_profilerrpc_proto_depIdxs, + EnumInfos: file_profilerrpc_profilerrpc_proto_enumTypes, + MessageInfos: file_profilerrpc_profilerrpc_proto_msgTypes, + }.Build() + File_profilerrpc_profilerrpc_proto = out.File + file_profilerrpc_profilerrpc_proto_rawDesc = nil + file_profilerrpc_profilerrpc_proto_goTypes = nil + file_profilerrpc_profilerrpc_proto_depIdxs = nil +} diff --git a/vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler_grpc.pb.go b/vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc_grpc.pb.go similarity index 88% rename from vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler_grpc.pb.go rename to vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc_grpc.pb.go index aa27c9894..19868c6ee 100644 --- a/vendor/github.com/longhorn/go-common-libs/generated/profilerpb/profiler_grpc.pb.go +++ b/vendor/github.com/longhorn/types/pkg/generated/profilerrpc/profilerrpc_grpc.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v4.25.1 -// source: profiler.proto +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.24.3 +// source: profilerrpc/profilerrpc.proto -package profilerpb +package profilerrpc import ( context "context" @@ -18,6 +18,10 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + Profiler_ProfilerOP_FullMethodName = "/profilerrpc.Profiler/ProfilerOP" +) + // ProfilerClient is the client API for Profiler 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. @@ -35,7 +39,7 @@ func NewProfilerClient(cc grpc.ClientConnInterface) ProfilerClient { func (c *profilerClient) ProfilerOP(ctx context.Context, in *ProfilerOPRequest, opts ...grpc.CallOption) (*ProfilerOPResponse, error) { out := new(ProfilerOPResponse) - err := c.cc.Invoke(ctx, "/longhorn.common.profiler.Profiler/ProfilerOP", in, out, opts...) + err := c.cc.Invoke(ctx, Profiler_ProfilerOP_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -80,7 +84,7 @@ func _Profiler_ProfilerOP_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/longhorn.common.profiler.Profiler/ProfilerOP", + FullMethod: Profiler_ProfilerOP_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(ProfilerServer).ProfilerOP(ctx, req.(*ProfilerOPRequest)) @@ -92,7 +96,7 @@ func _Profiler_ProfilerOP_Handler(srv interface{}, ctx context.Context, dec func // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Profiler_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "longhorn.common.profiler.Profiler", + ServiceName: "profilerrpc.Profiler", HandlerType: (*ProfilerServer)(nil), Methods: []grpc.MethodDesc{ { @@ -101,5 +105,5 @@ var Profiler_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "profiler.proto", + Metadata: "profilerrpc/profilerrpc.proto", } diff --git a/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go b/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go index 9bed2419e..94cedfd34 100644 --- a/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go +++ b/vendor/github.com/shirou/gopsutil/v3/internal/common/sleep.go @@ -6,7 +6,7 @@ import ( ) // Sleep awaits for provided interval. -// Can be interrupted by context cancelation. +// Can be interrupted by context cancellation. func Sleep(ctx context.Context, interval time.Duration) error { timer := time.NewTimer(interval) select { diff --git a/vendor/modules.txt b/vendor/modules.txt index 7f3d4eb77..fd1d0fb74 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -144,10 +144,9 @@ github.com/longhorn/backupstore/systembackup github.com/longhorn/backupstore/types github.com/longhorn/backupstore/util github.com/longhorn/backupstore/vfs -# github.com/longhorn/go-common-libs v0.0.0-20240427164621-70d1933bfa90 -## explicit; go 1.22 +# github.com/longhorn/go-common-libs v0.0.0-20240605094403-68743dacbcb1 +## explicit; go 1.22.0 github.com/longhorn/go-common-libs/exec -github.com/longhorn/go-common-libs/generated/profilerpb github.com/longhorn/go-common-libs/io github.com/longhorn/go-common-libs/ns github.com/longhorn/go-common-libs/proc @@ -171,9 +170,10 @@ github.com/longhorn/sparse-tools/sparse/rest github.com/longhorn/sparse-tools/stats github.com/longhorn/sparse-tools/types github.com/longhorn/sparse-tools/util -# github.com/longhorn/types v0.0.0-20240510221052-ab949bbedea3 +# github.com/longhorn/types v0.0.0-20240605091135-ef450e1c04cd ## explicit; go 1.21 github.com/longhorn/types/pkg/generated/enginerpc +github.com/longhorn/types/pkg/generated/profilerrpc # github.com/mattn/go-colorable v0.1.4 ## explicit github.com/mattn/go-colorable @@ -235,7 +235,7 @@ github.com/rogpeppe/go-internal/fmtsort # github.com/russross/blackfriday/v2 v2.1.0 ## explicit github.com/russross/blackfriday/v2 -# github.com/shirou/gopsutil/v3 v3.24.3 +# github.com/shirou/gopsutil/v3 v3.24.4 ## explicit; go 1.15 github.com/shirou/gopsutil/v3/common github.com/shirou/gopsutil/v3/disk