From 69a99ebaac1977bf1c1c148a08b23ac48d0db976 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Wed, 7 Aug 2019 00:54:16 -0400 Subject: [PATCH 1/6] Add ability to configure reflection for query GRPC server --- src/cmd/services/m3query/config/config.go | 4 ++++ src/query/server/server.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/cmd/services/m3query/config/config.go b/src/cmd/services/m3query/config/config.go index 8c66ac4166..8caa2d1735 100644 --- a/src/cmd/services/m3query/config/config.go +++ b/src/cmd/services/m3query/config/config.go @@ -440,6 +440,10 @@ type RPCConfiguration struct { // NB: this is deprecated in favor of using RemoteZones, as setting // RemoteListenAddresses will only allow for a single remote zone to be used. RemoteListenAddresses []string `yaml:"remoteListenAddresses"` + + // ReflectionEnabled will enable reflection on the GRPC server, useful + // for testing connectivity with grpcurl, etc. + ReflectionEnabled bool `yaml:"reflectionEnabled"` } // TagOptionsConfiguration is the configuration for shared tag options diff --git a/src/query/server/server.go b/src/query/server/server.go index 1fa6e1d02a..c1fc1d569c 100644 --- a/src/query/server/server.go +++ b/src/query/server/server.go @@ -69,6 +69,7 @@ import ( "github.com/uber-go/tally" "go.uber.org/zap" "google.golang.org/grpc" + "google.golang.org/grpc/reflection" ) const ( @@ -822,9 +823,17 @@ func startGRPCServer( instrumentOpts instrument.Options, ) (*grpc.Server, error) { logger := instrumentOpts.Logger() + logger.Info("creating gRPC server") server := tsdbRemote.NewGRPCServer(storage, queryContextOptions, poolWrapper, instrumentOpts) + if cfg.ReflectionEnabled { + reflection.Register(server) + } + + logger.Info("gRPC server reflection configured", + zap.Bool("enabled", cfg.ReflectionEnabled)) + listener, err := net.Listen("tcp", cfg.ListenAddress) if err != nil { return nil, err From 57b38bf6564e3a101402c6f758822cb4fd93a3f7 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Wed, 7 Aug 2019 01:00:11 -0400 Subject: [PATCH 2/6] Add Health() endpoint --- src/query/generated/proto/rpcpb/query.proto | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/query/generated/proto/rpcpb/query.proto b/src/query/generated/proto/rpcpb/query.proto index 38a4ac8da1..50fff9d681 100644 --- a/src/query/generated/proto/rpcpb/query.proto +++ b/src/query/generated/proto/rpcpb/query.proto @@ -7,12 +7,17 @@ option go_package = "rpcpb"; import "github.com/m3db/m3/src/metrics/generated/proto/policypb/policy.proto"; service Query { + rpc Health() returns (HealthResponse); rpc Fetch(FetchRequest) returns (stream FetchResponse); - rpc Search(SearchRequest) returns (stream SearchResponse); rpc CompleteTags(CompleteTagsRequest) returns (stream CompleteTagsResponse); } +message HealthResponse { + string uptimeDuration = 1; + int64 uptimeNanoseconds = 2; +} + message FetchRequest { int64 start = 1; int64 end = 2; From f6315d6399b09efa557113ad29ba89c4acd6f22c Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Wed, 7 Aug 2019 01:01:19 -0400 Subject: [PATCH 3/6] Add HealthRequest message --- src/query/generated/proto/rpcpb/query.proto | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/query/generated/proto/rpcpb/query.proto b/src/query/generated/proto/rpcpb/query.proto index 50fff9d681..90fad9122d 100644 --- a/src/query/generated/proto/rpcpb/query.proto +++ b/src/query/generated/proto/rpcpb/query.proto @@ -7,12 +7,15 @@ option go_package = "rpcpb"; import "github.com/m3db/m3/src/metrics/generated/proto/policypb/policy.proto"; service Query { - rpc Health() returns (HealthResponse); + rpc Health(HealthRequest) returns (HealthResponse); rpc Fetch(FetchRequest) returns (stream FetchResponse); rpc Search(SearchRequest) returns (stream SearchResponse); rpc CompleteTags(CompleteTagsRequest) returns (stream CompleteTagsResponse); } +message HealthRequest { +} + message HealthResponse { string uptimeDuration = 1; int64 uptimeNanoseconds = 2; From 1b76f466caaaabffad5c71fc2c4598ffed64bf73 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Wed, 7 Aug 2019 05:01:52 +0000 Subject: [PATCH 4/6] Generate protobuf --- src/query/generated/proto/rpcpb/query.pb.go | 508 +++++++++++++++----- 1 file changed, 398 insertions(+), 110 deletions(-) diff --git a/src/query/generated/proto/rpcpb/query.pb.go b/src/query/generated/proto/rpcpb/query.pb.go index 20e9eea64a..e443016f28 100644 --- a/src/query/generated/proto/rpcpb/query.pb.go +++ b/src/query/generated/proto/rpcpb/query.pb.go @@ -28,6 +28,8 @@ github.com/m3db/m3/src/query/generated/proto/rpcpb/query.proto It has these top-level messages: + HealthRequest + HealthResponse FetchRequest TagMatchers TagMatcher @@ -168,6 +170,38 @@ func (x CompleteTagsType) String() string { } func (CompleteTagsType) EnumDescriptor() ([]byte, []int) { return fileDescriptorQuery, []int{2} } +type HealthRequest struct { +} + +func (m *HealthRequest) Reset() { *m = HealthRequest{} } +func (m *HealthRequest) String() string { return proto.CompactTextString(m) } +func (*HealthRequest) ProtoMessage() {} +func (*HealthRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{0} } + +type HealthResponse struct { + UptimeDuration string `protobuf:"bytes,1,opt,name=uptimeDuration,proto3" json:"uptimeDuration,omitempty"` + UptimeNanoseconds int64 `protobuf:"varint,2,opt,name=uptimeNanoseconds,proto3" json:"uptimeNanoseconds,omitempty"` +} + +func (m *HealthResponse) Reset() { *m = HealthResponse{} } +func (m *HealthResponse) String() string { return proto.CompactTextString(m) } +func (*HealthResponse) ProtoMessage() {} +func (*HealthResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{1} } + +func (m *HealthResponse) GetUptimeDuration() string { + if m != nil { + return m.UptimeDuration + } + return "" +} + +func (m *HealthResponse) GetUptimeNanoseconds() int64 { + if m != nil { + return m.UptimeNanoseconds + } + return 0 +} + type FetchRequest struct { Start int64 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"` End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` @@ -180,7 +214,7 @@ type FetchRequest struct { func (m *FetchRequest) Reset() { *m = FetchRequest{} } func (m *FetchRequest) String() string { return proto.CompactTextString(m) } func (*FetchRequest) ProtoMessage() {} -func (*FetchRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{0} } +func (*FetchRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{2} } type isFetchRequest_Matchers interface { isFetchRequest_Matchers() @@ -291,7 +325,7 @@ type TagMatchers struct { func (m *TagMatchers) Reset() { *m = TagMatchers{} } func (m *TagMatchers) String() string { return proto.CompactTextString(m) } func (*TagMatchers) ProtoMessage() {} -func (*TagMatchers) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{1} } +func (*TagMatchers) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{3} } func (m *TagMatchers) GetTagMatchers() []*TagMatcher { if m != nil { @@ -309,7 +343,7 @@ type TagMatcher struct { func (m *TagMatcher) Reset() { *m = TagMatcher{} } func (m *TagMatcher) String() string { return proto.CompactTextString(m) } func (*TagMatcher) ProtoMessage() {} -func (*TagMatcher) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{2} } +func (*TagMatcher) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{4} } func (m *TagMatcher) GetName() []byte { if m != nil { @@ -341,7 +375,7 @@ type FetchOptions struct { func (m *FetchOptions) Reset() { *m = FetchOptions{} } func (m *FetchOptions) String() string { return proto.CompactTextString(m) } func (*FetchOptions) ProtoMessage() {} -func (*FetchOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{3} } +func (*FetchOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{5} } func (m *FetchOptions) GetLimit() int64 { if m != nil { @@ -372,7 +406,7 @@ type RestrictFetchOptions struct { func (m *RestrictFetchOptions) Reset() { *m = RestrictFetchOptions{} } func (m *RestrictFetchOptions) String() string { return proto.CompactTextString(m) } func (*RestrictFetchOptions) ProtoMessage() {} -func (*RestrictFetchOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{4} } +func (*RestrictFetchOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{6} } func (m *RestrictFetchOptions) GetMetricsType() MetricsType { if m != nil { @@ -395,7 +429,7 @@ type FetchResponse struct { func (m *FetchResponse) Reset() { *m = FetchResponse{} } func (m *FetchResponse) String() string { return proto.CompactTextString(m) } func (*FetchResponse) ProtoMessage() {} -func (*FetchResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{5} } +func (*FetchResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{7} } func (m *FetchResponse) GetSeries() []*Series { if m != nil { @@ -415,7 +449,7 @@ type Series struct { func (m *Series) Reset() { *m = Series{} } func (m *Series) String() string { return proto.CompactTextString(m) } func (*Series) ProtoMessage() {} -func (*Series) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{6} } +func (*Series) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{8} } type isSeries_Value interface { isSeries_Value() @@ -544,7 +578,7 @@ type SeriesMetadata struct { func (m *SeriesMetadata) Reset() { *m = SeriesMetadata{} } func (m *SeriesMetadata) String() string { return proto.CompactTextString(m) } func (*SeriesMetadata) ProtoMessage() {} -func (*SeriesMetadata) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{7} } +func (*SeriesMetadata) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{9} } func (m *SeriesMetadata) GetId() []byte { if m != nil { @@ -575,7 +609,7 @@ type DecompressedSeries struct { func (m *DecompressedSeries) Reset() { *m = DecompressedSeries{} } func (m *DecompressedSeries) String() string { return proto.CompactTextString(m) } func (*DecompressedSeries) ProtoMessage() {} -func (*DecompressedSeries) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{8} } +func (*DecompressedSeries) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{10} } func (m *DecompressedSeries) GetDatapoints() []*Datapoint { if m != nil { @@ -599,7 +633,7 @@ type Datapoint struct { func (m *Datapoint) Reset() { *m = Datapoint{} } func (m *Datapoint) String() string { return proto.CompactTextString(m) } func (*Datapoint) ProtoMessage() {} -func (*Datapoint) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{9} } +func (*Datapoint) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{11} } func (m *Datapoint) GetTimestamp() int64 { if m != nil { @@ -623,7 +657,7 @@ type Tag struct { func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} -func (*Tag) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{10} } +func (*Tag) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{12} } func (m *Tag) GetName() []byte { if m != nil { @@ -647,7 +681,7 @@ type M3CompressedSeries struct { func (m *M3CompressedSeries) Reset() { *m = M3CompressedSeries{} } func (m *M3CompressedSeries) String() string { return proto.CompactTextString(m) } func (*M3CompressedSeries) ProtoMessage() {} -func (*M3CompressedSeries) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{11} } +func (*M3CompressedSeries) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{13} } func (m *M3CompressedSeries) GetCompressedTags() []byte { if m != nil { @@ -670,7 +704,7 @@ type M3CompressedValuesReplica struct { func (m *M3CompressedValuesReplica) Reset() { *m = M3CompressedValuesReplica{} } func (m *M3CompressedValuesReplica) String() string { return proto.CompactTextString(m) } func (*M3CompressedValuesReplica) ProtoMessage() {} -func (*M3CompressedValuesReplica) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{12} } +func (*M3CompressedValuesReplica) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{14} } func (m *M3CompressedValuesReplica) GetSegments() []*M3Segments { if m != nil { @@ -687,7 +721,7 @@ type M3Segments struct { func (m *M3Segments) Reset() { *m = M3Segments{} } func (m *M3Segments) String() string { return proto.CompactTextString(m) } func (*M3Segments) ProtoMessage() {} -func (*M3Segments) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{13} } +func (*M3Segments) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{15} } func (m *M3Segments) GetMerged() *M3Segment { if m != nil { @@ -713,7 +747,7 @@ type M3Segment struct { func (m *M3Segment) Reset() { *m = M3Segment{} } func (m *M3Segment) String() string { return proto.CompactTextString(m) } func (*M3Segment) ProtoMessage() {} -func (*M3Segment) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{14} } +func (*M3Segment) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{16} } func (m *M3Segment) GetHead() []byte { if m != nil { @@ -752,7 +786,7 @@ type SearchRequest struct { func (m *SearchRequest) Reset() { *m = SearchRequest{} } func (m *SearchRequest) String() string { return proto.CompactTextString(m) } func (*SearchRequest) ProtoMessage() {} -func (*SearchRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{15} } +func (*SearchRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{17} } type isSearchRequest_Matchers interface { isSearchRequest_Matchers() @@ -843,7 +877,7 @@ type M3TagProperty struct { func (m *M3TagProperty) Reset() { *m = M3TagProperty{} } func (m *M3TagProperty) String() string { return proto.CompactTextString(m) } func (*M3TagProperty) ProtoMessage() {} -func (*M3TagProperty) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{16} } +func (*M3TagProperty) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{18} } func (m *M3TagProperty) GetId() []byte { if m != nil { @@ -866,7 +900,7 @@ type M3TagProperties struct { func (m *M3TagProperties) Reset() { *m = M3TagProperties{} } func (m *M3TagProperties) String() string { return proto.CompactTextString(m) } func (*M3TagProperties) ProtoMessage() {} -func (*M3TagProperties) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{17} } +func (*M3TagProperties) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{19} } func (m *M3TagProperties) GetProperties() []*M3TagProperty { if m != nil { @@ -883,7 +917,7 @@ type TagProperty struct { func (m *TagProperty) Reset() { *m = TagProperty{} } func (m *TagProperty) String() string { return proto.CompactTextString(m) } func (*TagProperty) ProtoMessage() {} -func (*TagProperty) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{18} } +func (*TagProperty) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{20} } func (m *TagProperty) GetKey() []byte { if m != nil { @@ -906,7 +940,7 @@ type TagProperties struct { func (m *TagProperties) Reset() { *m = TagProperties{} } func (m *TagProperties) String() string { return proto.CompactTextString(m) } func (*TagProperties) ProtoMessage() {} -func (*TagProperties) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{19} } +func (*TagProperties) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{21} } func (m *TagProperties) GetProperties() []*TagProperty { if m != nil { @@ -925,7 +959,7 @@ type SearchResponse struct { func (m *SearchResponse) Reset() { *m = SearchResponse{} } func (m *SearchResponse) String() string { return proto.CompactTextString(m) } func (*SearchResponse) ProtoMessage() {} -func (*SearchResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{20} } +func (*SearchResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{22} } type isSearchResponse_Value interface { isSearchResponse_Value() @@ -1048,7 +1082,7 @@ type CompleteTagsRequestOptions struct { func (m *CompleteTagsRequestOptions) Reset() { *m = CompleteTagsRequestOptions{} } func (m *CompleteTagsRequestOptions) String() string { return proto.CompactTextString(m) } func (*CompleteTagsRequestOptions) ProtoMessage() {} -func (*CompleteTagsRequestOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{21} } +func (*CompleteTagsRequestOptions) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{23} } func (m *CompleteTagsRequestOptions) GetType() CompleteTagsType { if m != nil { @@ -1088,7 +1122,7 @@ type CompleteTagsRequest struct { func (m *CompleteTagsRequest) Reset() { *m = CompleteTagsRequest{} } func (m *CompleteTagsRequest) String() string { return proto.CompactTextString(m) } func (*CompleteTagsRequest) ProtoMessage() {} -func (*CompleteTagsRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{22} } +func (*CompleteTagsRequest) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{24} } type isCompleteTagsRequest_Matchers interface { isCompleteTagsRequest_Matchers() @@ -1185,7 +1219,7 @@ type TagNames struct { func (m *TagNames) Reset() { *m = TagNames{} } func (m *TagNames) String() string { return proto.CompactTextString(m) } func (*TagNames) ProtoMessage() {} -func (*TagNames) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{23} } +func (*TagNames) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{25} } func (m *TagNames) GetNames() [][]byte { if m != nil { @@ -1202,7 +1236,7 @@ type TagValue struct { func (m *TagValue) Reset() { *m = TagValue{} } func (m *TagValue) String() string { return proto.CompactTextString(m) } func (*TagValue) ProtoMessage() {} -func (*TagValue) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{24} } +func (*TagValue) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{26} } func (m *TagValue) GetKey() []byte { if m != nil { @@ -1225,7 +1259,7 @@ type TagValues struct { func (m *TagValues) Reset() { *m = TagValues{} } func (m *TagValues) String() string { return proto.CompactTextString(m) } func (*TagValues) ProtoMessage() {} -func (*TagValues) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{25} } +func (*TagValues) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{27} } func (m *TagValues) GetValues() []*TagValue { if m != nil { @@ -1244,7 +1278,7 @@ type CompleteTagsResponse struct { func (m *CompleteTagsResponse) Reset() { *m = CompleteTagsResponse{} } func (m *CompleteTagsResponse) String() string { return proto.CompactTextString(m) } func (*CompleteTagsResponse) ProtoMessage() {} -func (*CompleteTagsResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{26} } +func (*CompleteTagsResponse) Descriptor() ([]byte, []int) { return fileDescriptorQuery, []int{28} } type isCompleteTagsResponse_Value interface { isCompleteTagsResponse_Value() @@ -1358,6 +1392,8 @@ func _CompleteTagsResponse_OneofSizer(msg proto.Message) (n int) { } func init() { + proto.RegisterType((*HealthRequest)(nil), "rpc.HealthRequest") + proto.RegisterType((*HealthResponse)(nil), "rpc.HealthResponse") proto.RegisterType((*FetchRequest)(nil), "rpc.FetchRequest") proto.RegisterType((*TagMatchers)(nil), "rpc.TagMatchers") proto.RegisterType((*TagMatcher)(nil), "rpc.TagMatcher") @@ -1401,6 +1437,7 @@ const _ = grpc.SupportPackageIsVersion4 // Client API for Query service type QueryClient interface { + Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (Query_FetchClient, error) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Query_SearchClient, error) CompleteTags(ctx context.Context, in *CompleteTagsRequest, opts ...grpc.CallOption) (Query_CompleteTagsClient, error) @@ -1414,6 +1451,15 @@ func NewQueryClient(cc *grpc.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) Health(ctx context.Context, in *HealthRequest, opts ...grpc.CallOption) (*HealthResponse, error) { + out := new(HealthResponse) + err := grpc.Invoke(ctx, "/rpc.Query/Health", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (Query_FetchClient, error) { stream, err := grpc.NewClientStream(ctx, &_Query_serviceDesc.Streams[0], c.cc, "/rpc.Query/Fetch", opts...) if err != nil { @@ -1513,6 +1559,7 @@ func (x *queryCompleteTagsClient) Recv() (*CompleteTagsResponse, error) { // Server API for Query service type QueryServer interface { + Health(context.Context, *HealthRequest) (*HealthResponse, error) Fetch(*FetchRequest, Query_FetchServer) error Search(*SearchRequest, Query_SearchServer) error CompleteTags(*CompleteTagsRequest, Query_CompleteTagsServer) error @@ -1522,6 +1569,24 @@ func RegisterQueryServer(s *grpc.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_Health_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HealthRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Health(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/rpc.Query/Health", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Health(ctx, req.(*HealthRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Fetch_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(FetchRequest) if err := stream.RecvMsg(m); err != nil { @@ -1588,7 +1653,12 @@ func (x *queryCompleteTagsServer) Send(m *CompleteTagsResponse) error { var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "rpc.Query", HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{}, + Methods: []grpc.MethodDesc{ + { + MethodName: "Health", + Handler: _Query_Health_Handler, + }, + }, Streams: []grpc.StreamDesc{ { StreamName: "Fetch", @@ -1609,6 +1679,53 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "github.com/m3db/m3/src/query/generated/proto/rpcpb/query.proto", } +func (m *HealthRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *HealthResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HealthResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.UptimeDuration) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintQuery(dAtA, i, uint64(len(m.UptimeDuration))) + i += copy(dAtA[i:], m.UptimeDuration) + } + if m.UptimeNanoseconds != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintQuery(dAtA, i, uint64(m.UptimeNanoseconds)) + } + return i, nil +} + func (m *FetchRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2630,6 +2747,25 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return offset + 1 } +func (m *HealthRequest) Size() (n int) { + var l int + _ = l + return n +} + +func (m *HealthResponse) Size() (n int) { + var l int + _ = l + l = len(m.UptimeDuration) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.UptimeNanoseconds != 0 { + n += 1 + sovQuery(uint64(m.UptimeNanoseconds)) + } + return n +} + func (m *FetchRequest) Size() (n int) { var l int _ = l @@ -3104,6 +3240,154 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *HealthRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HealthResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HealthResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HealthResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UptimeDuration", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UptimeDuration = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UptimeNanoseconds", wireType) + } + m.UptimeNanoseconds = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UptimeNanoseconds |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *FetchRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -6127,86 +6411,90 @@ func init() { } var fileDescriptorQuery = []byte{ - // 1289 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x72, 0xdb, 0x44, - 0x14, 0xb6, 0x2c, 0xc7, 0xb1, 0x8f, 0x9d, 0xd4, 0x9c, 0x06, 0xea, 0x84, 0x12, 0x32, 0x02, 0x4a, - 0x49, 0xc1, 0x2e, 0x4e, 0xf8, 0x29, 0x33, 0xfc, 0xb8, 0x8d, 0x9b, 0x74, 0x9a, 0x38, 0xe9, 0x5a, - 0x81, 0xc2, 0x30, 0x53, 0xd6, 0xf2, 0xd6, 0xd1, 0xc4, 0xb2, 0x54, 0x69, 0xcd, 0xe0, 0xbe, 0x00, - 0x17, 0xdc, 0x30, 0xdc, 0xf4, 0x09, 0x78, 0x03, 0x78, 0x07, 0x2e, 0x79, 0x04, 0xa6, 0xbc, 0x08, - 0xb3, 0xab, 0xd5, 0x9f, 0xed, 0x40, 0x87, 0x3b, 0x9d, 0xdf, 0x3d, 0x3f, 0xdf, 0x9e, 0x3d, 0x82, - 0xcf, 0x86, 0x36, 0x3f, 0x9b, 0xf4, 0x1b, 0x96, 0xeb, 0x34, 0x9d, 0x9d, 0x41, 0xbf, 0xe9, 0xec, - 0x34, 0x03, 0xdf, 0x6a, 0x3e, 0x99, 0x30, 0x7f, 0xda, 0x1c, 0xb2, 0x31, 0xf3, 0x29, 0x67, 0x83, - 0xa6, 0xe7, 0xbb, 0xdc, 0x6d, 0xfa, 0x9e, 0xe5, 0xf5, 0x43, 0x59, 0x43, 0x72, 0x50, 0xf7, 0x3d, - 0x6b, 0x63, 0xef, 0x02, 0x27, 0x0e, 0xe3, 0xbe, 0x6d, 0x05, 0x73, 0x6e, 0x3c, 0x77, 0x64, 0x5b, - 0x53, 0xaf, 0xaf, 0x3e, 0x42, 0x57, 0xc6, 0xaf, 0x1a, 0x54, 0xef, 0x32, 0x6e,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x2c, 0xc9, 0xbf, 0x8c, 0x7e, 0x51, 0xfe, 0x15, 0xec, 0xfc, 0x13, 0x00, 0x00, 0xff, - 0xff, 0x30, 0x9f, 0x37, 0x4b, 0xa2, 0x0c, 0x00, 0x00, + // 1352 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdb, 0x72, 0xdb, 0xc4, + 0x1b, 0xb7, 0x2c, 0xc7, 0xb1, 0x3f, 0x1f, 0xe2, 0x7e, 0xc9, 0xff, 0x5f, 0x27, 0x94, 0x90, 0x11, + 0x50, 0x42, 0x5a, 0xec, 0xd6, 0x09, 0x87, 0x32, 0xc3, 0xc1, 0x6d, 0xdc, 0xa4, 0xd3, 0xc4, 0x49, + 0xd7, 0x0a, 0x14, 0x86, 0x99, 0x22, 0xcb, 0x5b, 0x47, 0x13, 0xcb, 0x52, 0xa5, 0x35, 0x83, 0xfb, + 0x02, 0x5c, 0x70, 0xc3, 0x70, 0xd3, 0x27, 0xe0, 0x0d, 0x78, 0x08, 0x2e, 0x79, 0x04, 0xa6, 0xdc, + 0xf0, 0x18, 0xcc, 0xae, 0x56, 0x27, 0xdb, 0x81, 0x0e, 0x77, 0xda, 0xdf, 0x77, 0x3e, 0xec, 0xb7, + 0x9f, 0xe0, 0xd3, 0xa1, 0xc5, 0xce, 0x27, 0xfd, 0x86, 0xe9, 0xd8, 0x4d, 0x7b, 0x77, 0xd0, 0x6f, + 0xda, 0xbb, 0x4d, 0xdf, 0x33, 0x9b, 0xcf, 0x26, 0xd4, 0x9b, 0x36, 0x87, 0x74, 0x4c, 0x3d, 0x83, + 0xd1, 0x41, 0xd3, 0xf5, 0x1c, 0xe6, 0x34, 0x3d, 0xd7, 0x74, 0xfb, 0x01, 0xad, 0x21, 0x10, 0x54, + 0x3d, 0xd7, 0xdc, 0xd8, 0xbf, 0x44, 0x89, 0x4d, 0x99, 0x67, 0x99, 0xfe, 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xd8, 0xd7, 0x31, 0xb8, 0xa9, 0xa9, 0x6d, 0x7e, 0x63, 0x35, 0x85, 0xc9, 0xd2, 0xdc, + 0x82, 0x25, 0xb1, 0x0e, 0x61, 0x62, 0x07, 0x0e, 0x05, 0x30, 0x09, 0x05, 0xfc, 0xb7, 0x14, 0xdc, + 0xe5, 0x9b, 0x10, 0x1f, 0x16, 0xd2, 0x48, 0x6a, 0x32, 0x6f, 0xac, 0xa6, 0xb0, 0x48, 0xa8, 0x03, + 0xe5, 0x64, 0x44, 0x58, 0xbf, 0xac, 0xd7, 0x37, 0xd6, 0x17, 0x50, 0x42, 0x35, 0x77, 0xaf, 0xfe, + 0xf6, 0x72, 0x53, 0xf9, 0xfd, 0xe5, 0xa6, 0xf2, 0xc7, 0xcb, 0x4d, 0xe5, 0xa7, 0x3f, 0x37, 0x33, + 0x5f, 0x2f, 0x89, 0x3f, 0xa2, 0x7e, 0x5e, 0xfc, 0xc1, 0xec, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, + 0x71, 0x48, 0x17, 0xdd, 0x4e, 0x0d, 0x00, 0x00, } From 84ee32067034f2c2d5f9af0c7552569a988c4bb6 Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Wed, 7 Aug 2019 01:07:47 -0400 Subject: [PATCH 5/6] Add health endpoint --- src/query/tsdb/remote/server.go | 14 ++++++++++++++ src/query/tsdb/remote/server_test.go | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/query/tsdb/remote/server.go b/src/query/tsdb/remote/server.go index 1d92a3450a..b80a586e80 100644 --- a/src/query/tsdb/remote/server.go +++ b/src/query/tsdb/remote/server.go @@ -21,6 +21,7 @@ package remote import ( + "context" "sync" "time" @@ -42,6 +43,7 @@ const defaultBatch = 128 // TODO: add metrics type grpcServer struct { + createAt time.Time poolErr error batchSize int storage m3.Storage @@ -69,6 +71,7 @@ func NewGRPCServer( ) *grpc.Server { server := grpc.NewServer() grpcServer := &grpcServer{ + createAt: time.Now(), storage: store, queryContextOpts: queryContextOpts, poolWrapper: poolWrapper, @@ -79,6 +82,17 @@ func NewGRPCServer( return server } +func (s *grpcServer) Health( + ctx context.Context, + req *rpc.HealthRequest, +) (*rpc.HealthResponse, error) { + uptime := time.Since(s.createAt) + return &rpc.HealthResponse{ + UptimeDuration: uptime.String(), + UptimeNanoseconds: int64(uptime), + }, nil +} + func (s *grpcServer) waitForPools() (encoding.IteratorPools, error) { s.once.Do(func() { s.pools, s.poolErr = s.poolWrapper.WaitForIteratorPools(poolTimeout) diff --git a/src/query/tsdb/remote/server_test.go b/src/query/tsdb/remote/server_test.go index 9778eee67c..50a31a2af7 100644 --- a/src/query/tsdb/remote/server_test.go +++ b/src/query/tsdb/remote/server_test.go @@ -33,6 +33,7 @@ import ( "github.com/m3db/m3/src/dbnode/encoding" "github.com/m3db/m3/src/query/block" m3err "github.com/m3db/m3/src/query/errors" + rpc "github.com/m3db/m3/src/query/generated/proto/rpcpb" "github.com/m3db/m3/src/query/models" "github.com/m3db/m3/src/query/pools" "github.com/m3db/m3/src/query/storage" @@ -179,6 +180,30 @@ func TestRpc(t *testing.T) { checkFetch(ctx, t, client, read, readOpts) } +func TestRpcHealth(t *testing.T) { + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + ctx, _, _ := createCtxReadOpts(t) + store := newMockStorage(t, ctrl, mockStorageOptions{}) + listener := startServer(t, ctrl, store) + serverClient := buildClient(t, []string{listener.Addr().String()}) + defer func() { + assert.NoError(t, serverClient.Close()) + }() + + client, ok := serverClient.(*grpcClient) + require.True(t, ok) + + resp, err := client.client.Health(ctx, &rpc.HealthRequest{}) + require.NoError(t, err) + + uptime, err := time.ParseDuration(resp.UptimeDuration) + require.NoError(t, err) + assert.True(t, uptime > 0) + assert.Equal(t, uptime, time.Duration(resp.UptimeNanoseconds)) +} + func TestRpcMultipleRead(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() From 7b448a965d392b27e042004d361e89149c923e3e Mon Sep 17 00:00:00 2001 From: Rob Skillington Date: Wed, 11 Sep 2019 18:14:00 -0400 Subject: [PATCH 6/6] Fix tests --- src/query/server/server_test.go | 91 ++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/src/query/server/server_test.go b/src/query/server/server_test.go index d7fed52ec5..b8c628a2a4 100644 --- a/src/query/server/server_test.go +++ b/src/query/server/server_test.go @@ -21,6 +21,7 @@ package server import ( + "context" "fmt" "io/ioutil" "net" @@ -202,41 +203,6 @@ func waitForServerHealthy(t *testing.T, addr string) { maxWait.String()) } -type queryServer struct { - reads, searches, tagCompletes int - mu sync.Mutex -} - -func (s *queryServer) Fetch( - *rpc.FetchRequest, - rpc.Query_FetchServer, -) error { - s.mu.Lock() - defer s.mu.Unlock() - s.reads++ - return nil -} - -func (s *queryServer) Search( - *rpc.SearchRequest, - rpc.Query_SearchServer, -) error { - s.mu.Lock() - defer s.mu.Unlock() - s.searches++ - return nil -} - -func (s *queryServer) CompleteTags( - *rpc.CompleteTagsRequest, - rpc.Query_CompleteTagsServer, -) error { - s.mu.Lock() - defer s.mu.Unlock() - s.tagCompletes++ - return nil -} - func TestGRPCBackend(t *testing.T) { lis, err := net.Listen("tcp", "127.0.0.1:0") require.NoError(t, err) @@ -286,7 +252,7 @@ writeWorkerPoolPolicy: s := grpc.NewServer() defer s.GracefulStop() - qs := &queryServer{} + qs := newQueryServer() rpc.RegisterQueryServer(s, qs) go func() { s.Serve(lis) @@ -389,3 +355,56 @@ func TestNewPerQueryEnforcer(t *testing.T) { floatsEqual(float64(r.Cost), 11) require.NoError(t, r.Error) } + +var _ rpc.QueryServer = &queryServer{} + +type queryServer struct { + up time.Time + reads, searches, tagCompletes int + mu sync.Mutex +} + +func newQueryServer() *queryServer { + return &queryServer{up: time.Now()} +} + +func (s *queryServer) Health( + ctx context.Context, + req *rpc.HealthRequest, +) (*rpc.HealthResponse, error) { + up := time.Since(s.up) + return &rpc.HealthResponse{ + UptimeDuration: up.String(), + UptimeNanoseconds: int64(up), + }, nil +} + +func (s *queryServer) Fetch( + *rpc.FetchRequest, + rpc.Query_FetchServer, +) error { + s.mu.Lock() + defer s.mu.Unlock() + s.reads++ + return nil +} + +func (s *queryServer) Search( + *rpc.SearchRequest, + rpc.Query_SearchServer, +) error { + s.mu.Lock() + defer s.mu.Unlock() + s.searches++ + return nil +} + +func (s *queryServer) CompleteTags( + *rpc.CompleteTagsRequest, + rpc.Query_CompleteTagsServer, +) error { + s.mu.Lock() + defer s.mu.Unlock() + s.tagCompletes++ + return nil +}