From 5e15f8f8f21f22163db0e9a2e589a51fda5900f8 Mon Sep 17 00:00:00 2001 From: Mahad Zaryab <43658574+mahadzaryab1@users.noreply.github.com> Date: Mon, 17 Feb 2025 09:49:55 -0500 Subject: [PATCH] [remote-storage][v2] Add IDL for dependency storage (#6738) ## Which problem is this PR solving? - Towards #6629 ## Description of the changes - This PR adds the IDL for the dependency reader for the v2 remote storage API ## How was this change tested? - CI ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: Mahad Zaryab --- .../storage/v2/grpc/dependency_storage.proto | 45 +++ proto-gen/storage/v2/dependency_storage.pb.go | 298 ++++++++++++++++++ scripts/makefiles/Protobuf.mk | 1 + 3 files changed, 344 insertions(+) create mode 100644 internal/storage/v2/grpc/dependency_storage.proto create mode 100644 proto-gen/storage/v2/dependency_storage.pb.go diff --git a/internal/storage/v2/grpc/dependency_storage.proto b/internal/storage/v2/grpc/dependency_storage.proto new file mode 100644 index 00000000000..2a2326590f2 --- /dev/null +++ b/internal/storage/v2/grpc/dependency_storage.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package jaeger.storage.v2; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "storage"; + +message GetDependenciesRequest { + // start_time is the start of the time interval to search for the dependencies. + google.protobuf.Timestamp start_time = 1 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false + ]; + // end_time is the end of the time interval to search for the dependencies. + google.protobuf.Timestamp end_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false + ]; +} + +// Dependency represents a relationship between two services. +message Dependency { + // parent is the name of the caller service. + string parent = 1; + + // child is the name of the service being called. + string child = 2; + + // call_count is the number of times the parent service called the child service. + uint64 call_count = 3; + + // source contains the origin from where the dependency was extracted. + string source = 4; +} + +message GetDependenciesResponse { + repeated Dependency dependencies = 1 [(gogoproto.nullable) = false]; +} + +service DependencyReader { + // GetDependencies loads service dependencies from storage. + rpc GetDependencies(GetDependenciesRequest) returns (GetDependenciesResponse); +} diff --git a/proto-gen/storage/v2/dependency_storage.pb.go b/proto-gen/storage/v2/dependency_storage.pb.go new file mode 100644 index 00000000000..24c7498faf9 --- /dev/null +++ b/proto-gen/storage/v2/dependency_storage.pb.go @@ -0,0 +1,298 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dependency_storage.proto + +package storage + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type GetDependenciesRequest struct { + // start_time is the start of the time interval to search for the dependencies. + StartTime time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time"` + // end_time is the end of the time interval to search for the dependencies. + EndTime time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDependenciesRequest) Reset() { *m = GetDependenciesRequest{} } +func (m *GetDependenciesRequest) String() string { return proto.CompactTextString(m) } +func (*GetDependenciesRequest) ProtoMessage() {} +func (*GetDependenciesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_17393f3b58692e2b, []int{0} +} +func (m *GetDependenciesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDependenciesRequest.Unmarshal(m, b) +} +func (m *GetDependenciesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDependenciesRequest.Marshal(b, m, deterministic) +} +func (m *GetDependenciesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDependenciesRequest.Merge(m, src) +} +func (m *GetDependenciesRequest) XXX_Size() int { + return xxx_messageInfo_GetDependenciesRequest.Size(m) +} +func (m *GetDependenciesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_GetDependenciesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDependenciesRequest proto.InternalMessageInfo + +func (m *GetDependenciesRequest) GetStartTime() time.Time { + if m != nil { + return m.StartTime + } + return time.Time{} +} + +func (m *GetDependenciesRequest) GetEndTime() time.Time { + if m != nil { + return m.EndTime + } + return time.Time{} +} + +// Dependency represents a relationship between two services. +type Dependency struct { + // parent is the name of the caller service. + Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"` + // child is the name of the service being called. + Child string `protobuf:"bytes,2,opt,name=child,proto3" json:"child,omitempty"` + // call_count is the number of times the parent service called the child service. + CallCount uint64 `protobuf:"varint,3,opt,name=call_count,json=callCount,proto3" json:"call_count,omitempty"` + // source contains the origin from where the dependency was extracted. + Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Dependency) Reset() { *m = Dependency{} } +func (m *Dependency) String() string { return proto.CompactTextString(m) } +func (*Dependency) ProtoMessage() {} +func (*Dependency) Descriptor() ([]byte, []int) { + return fileDescriptor_17393f3b58692e2b, []int{1} +} +func (m *Dependency) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Dependency.Unmarshal(m, b) +} +func (m *Dependency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Dependency.Marshal(b, m, deterministic) +} +func (m *Dependency) XXX_Merge(src proto.Message) { + xxx_messageInfo_Dependency.Merge(m, src) +} +func (m *Dependency) XXX_Size() int { + return xxx_messageInfo_Dependency.Size(m) +} +func (m *Dependency) XXX_DiscardUnknown() { + xxx_messageInfo_Dependency.DiscardUnknown(m) +} + +var xxx_messageInfo_Dependency proto.InternalMessageInfo + +func (m *Dependency) GetParent() string { + if m != nil { + return m.Parent + } + return "" +} + +func (m *Dependency) GetChild() string { + if m != nil { + return m.Child + } + return "" +} + +func (m *Dependency) GetCallCount() uint64 { + if m != nil { + return m.CallCount + } + return 0 +} + +func (m *Dependency) GetSource() string { + if m != nil { + return m.Source + } + return "" +} + +type GetDependenciesResponse struct { + Dependencies []Dependency `protobuf:"bytes,1,rep,name=dependencies,proto3" json:"dependencies"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetDependenciesResponse) Reset() { *m = GetDependenciesResponse{} } +func (m *GetDependenciesResponse) String() string { return proto.CompactTextString(m) } +func (*GetDependenciesResponse) ProtoMessage() {} +func (*GetDependenciesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_17393f3b58692e2b, []int{2} +} +func (m *GetDependenciesResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetDependenciesResponse.Unmarshal(m, b) +} +func (m *GetDependenciesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetDependenciesResponse.Marshal(b, m, deterministic) +} +func (m *GetDependenciesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetDependenciesResponse.Merge(m, src) +} +func (m *GetDependenciesResponse) XXX_Size() int { + return xxx_messageInfo_GetDependenciesResponse.Size(m) +} +func (m *GetDependenciesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GetDependenciesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GetDependenciesResponse proto.InternalMessageInfo + +func (m *GetDependenciesResponse) GetDependencies() []Dependency { + if m != nil { + return m.Dependencies + } + return nil +} + +func init() { + proto.RegisterType((*GetDependenciesRequest)(nil), "jaeger.storage.v2.GetDependenciesRequest") + proto.RegisterType((*Dependency)(nil), "jaeger.storage.v2.Dependency") + proto.RegisterType((*GetDependenciesResponse)(nil), "jaeger.storage.v2.GetDependenciesResponse") +} + +func init() { proto.RegisterFile("dependency_storage.proto", fileDescriptor_17393f3b58692e2b) } + +var fileDescriptor_17393f3b58692e2b = []byte{ + // 342 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xc1, 0x4e, 0xea, 0x40, + 0x14, 0x86, 0x6f, 0x2f, 0x5c, 0xa0, 0x87, 0x9b, 0xdc, 0xeb, 0x84, 0x60, 0xd3, 0x84, 0x40, 0x58, + 0xa1, 0x8b, 0x92, 0xd4, 0x07, 0x30, 0x01, 0x13, 0xf6, 0x13, 0x57, 0x6e, 0xc8, 0xd0, 0x39, 0x16, + 0x4c, 0x99, 0x29, 0x33, 0x53, 0x13, 0x12, 0x1f, 0xc2, 0x27, 0xf0, 0x79, 0x7c, 0x0a, 0x7d, 0x15, + 0x33, 0x1d, 0x2a, 0x2a, 0x2c, 0x74, 0xd7, 0xff, 0x9f, 0xff, 0x7c, 0xe7, 0x9c, 0x1e, 0x08, 0x38, + 0xe6, 0x28, 0x38, 0x8a, 0x64, 0x3b, 0xd7, 0x46, 0x2a, 0x96, 0x62, 0x94, 0x2b, 0x69, 0x24, 0x39, + 0xb9, 0x63, 0x98, 0xa2, 0x8a, 0x2a, 0xf7, 0x3e, 0x0e, 0x3b, 0xa9, 0x4c, 0x65, 0xf9, 0x3a, 0xb6, + 0x5f, 0x2e, 0x18, 0xf6, 0x53, 0x29, 0xd3, 0x0c, 0xc7, 0xa5, 0x5a, 0x14, 0xb7, 0x63, 0xb3, 0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x7c, 0xfc, 0x5c, 0xe1, 0xf9, 0x77, 0xa2, 0x6e, 0x8d, 0x89, 0x7f, + 0xd3, 0xdc, 0xa5, 0x16, 0x8d, 0xf2, 0x0c, 0x17, 0x6f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x23, + 0x6a, 0x89, 0x6d, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// DependencyReaderClient is the client API for DependencyReader service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type DependencyReaderClient interface { + // GetDependencies loads service dependencies from storage. + GetDependencies(ctx context.Context, in *GetDependenciesRequest, opts ...grpc.CallOption) (*GetDependenciesResponse, error) +} + +type dependencyReaderClient struct { + cc *grpc.ClientConn +} + +func NewDependencyReaderClient(cc *grpc.ClientConn) DependencyReaderClient { + return &dependencyReaderClient{cc} +} + +func (c *dependencyReaderClient) GetDependencies(ctx context.Context, in *GetDependenciesRequest, opts ...grpc.CallOption) (*GetDependenciesResponse, error) { + out := new(GetDependenciesResponse) + err := c.cc.Invoke(ctx, "/jaeger.storage.v2.DependencyReader/GetDependencies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DependencyReaderServer is the server API for DependencyReader service. +type DependencyReaderServer interface { + // GetDependencies loads service dependencies from storage. + GetDependencies(context.Context, *GetDependenciesRequest) (*GetDependenciesResponse, error) +} + +// UnimplementedDependencyReaderServer can be embedded to have forward compatible implementations. +type UnimplementedDependencyReaderServer struct { +} + +func (*UnimplementedDependencyReaderServer) GetDependencies(ctx context.Context, req *GetDependenciesRequest) (*GetDependenciesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDependencies not implemented") +} + +func RegisterDependencyReaderServer(s *grpc.Server, srv DependencyReaderServer) { + s.RegisterService(&_DependencyReader_serviceDesc, srv) +} + +func _DependencyReader_GetDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDependenciesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependencyReaderServer).GetDependencies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.storage.v2.DependencyReader/GetDependencies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependencyReaderServer).GetDependencies(ctx, req.(*GetDependenciesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _DependencyReader_serviceDesc = grpc.ServiceDesc{ + ServiceName: "jaeger.storage.v2.DependencyReader", + HandlerType: (*DependencyReaderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDependencies", + Handler: _DependencyReader_GetDependencies_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "dependency_storage.proto", +} diff --git a/scripts/makefiles/Protobuf.mk b/scripts/makefiles/Protobuf.mk index 579e89c02fa..e55f1812e63 100644 --- a/scripts/makefiles/Protobuf.mk +++ b/scripts/makefiles/Protobuf.mk @@ -112,6 +112,7 @@ proto-storage-v1: .PHONY: proto-storage-v2 proto-storage-v2: $(call proto_compile, proto-gen/storage/v2, internal/storage/v2/grpc/trace_storage.proto, -Iinternal/storage/v2/grpc/) + $(call proto_compile, proto-gen/storage/v2, internal/storage/v2/grpc/dependency_storage.proto, -Iinternal/storage/v2/grpc/) .PHONY: proto-hotrod proto-hotrod: