From 0e4cb28864e987feabead1e9f2e1f7abbc22e5b9 Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Wed, 9 Aug 2023 20:33:15 +0000 Subject: [PATCH] Add SDK name and version on task metadata (#306) --- proto/api | 2 +- sdk/v1/task_complete_metadata.pb.go | 166 ++++++++++++++++++++++++---- 2 files changed, 146 insertions(+), 22 deletions(-) diff --git a/proto/api b/proto/api index 30fa0860..f229641c 160000 --- a/proto/api +++ b/proto/api @@ -1 +1 @@ -Subproject commit 30fa08601909e4c0544ef73134ea494104c4dbda +Subproject commit f229641c576b421ac16b4ac73f35f1bf083c6572 diff --git a/sdk/v1/task_complete_metadata.pb.go b/sdk/v1/task_complete_metadata.pb.go index ddb33128..148d8a54 100644 --- a/sdk/v1/task_complete_metadata.pb.go +++ b/sdk/v1/task_complete_metadata.pb.go @@ -75,6 +75,17 @@ type WorkflowTaskCompletedMetadata struct { // (-- api-linter: core::0141::forbidden-types=disabled // aip.dev/not-precedent: These really shouldn't have negative values. --) LangUsedFlags []uint32 `protobuf:"varint,2,rep,packed,name=lang_used_flags,json=langUsedFlags,proto3" json:"lang_used_flags,omitempty"` + // Name of the SDK that processed the task. This is usually something like "temporal-go" and is + // usually the same as client-name gRPC header. This should only be set if its value changed + // since the last time recorded on the workflow (or be set on the first task). + // + // (-- api-linter: core::0122::name-suffix=disabled + // aip.dev/not-precedent: We're ok with a name suffix here. --) + SdkName string `protobuf:"bytes,3,opt,name=sdk_name,json=sdkName,proto3" json:"sdk_name,omitempty"` + // Version of the SDK that processed the task. This is usually something like "1.20.0" and is + // usually the same as client-version gRPC header. This should only be set if its value changed + // since the last time recorded on the workflow (or be set on the first task). + SdkVersion string `protobuf:"bytes,4,opt,name=sdk_version,json=sdkVersion,proto3" json:"sdk_version,omitempty"` } func (m *WorkflowTaskCompletedMetadata) Reset() { *m = WorkflowTaskCompletedMetadata{} } @@ -123,6 +134,20 @@ func (m *WorkflowTaskCompletedMetadata) GetLangUsedFlags() []uint32 { return nil } +func (m *WorkflowTaskCompletedMetadata) GetSdkName() string { + if m != nil { + return m.SdkName + } + return "" +} + +func (m *WorkflowTaskCompletedMetadata) GetSdkVersion() string { + if m != nil { + return m.SdkVersion + } + return "" +} + func init() { proto.RegisterType((*WorkflowTaskCompletedMetadata)(nil), "temporal.api.sdk.v1.WorkflowTaskCompletedMetadata") } @@ -132,26 +157,29 @@ func init() { } var fileDescriptor_4c87c329f13a1874 = []byte{ - // 295 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4a, 0x03, 0x31, - 0x1c, 0x87, 0x93, 0x0a, 0x0e, 0x07, 0x45, 0xa8, 0x28, 0x75, 0xe8, 0x1f, 0x71, 0x10, 0xa7, 0x9c, - 0x87, 0x5b, 0x9c, 0x5a, 0xc1, 0x4d, 0x28, 0xb6, 0x56, 0x70, 0x39, 0x62, 0x93, 0x96, 0x90, 0x3b, - 0x13, 0x2e, 0xb1, 0xae, 0x3e, 0x82, 0x8f, 0x21, 0xbe, 0x82, 0x2f, 0xe0, 0x78, 0x63, 0x47, 0x2f, - 0xb7, 0x88, 0x53, 0x1f, 0x41, 0x4e, 0xaf, 0x7a, 0x83, 0xeb, 0x97, 0xef, 0x83, 0x5f, 0xfe, 0xc1, - 0xb1, 0x13, 0xa9, 0xd1, 0x19, 0x4b, 0x42, 0x66, 0x64, 0x68, 0xb9, 0x0a, 0x17, 0x51, 0xe8, 0x98, - 0x55, 0xf1, 0x54, 0xa7, 0x26, 0x11, 0x4e, 0xc4, 0xa9, 0x70, 0x8c, 0x33, 0xc7, 0x88, 0xc9, 0xb4, - 0xd3, 0x9d, 0xed, 0x75, 0x41, 0x98, 0x91, 0xc4, 0x72, 0x45, 0x16, 0xd1, 0x81, 0x0e, 0x7a, 0xd7, - 0x3a, 0x53, 0xb3, 0x44, 0x3f, 0x8c, 0x99, 0x55, 0x67, 0x75, 0xcb, 0x2f, 0xea, 0xb6, 0x73, 0x18, - 0x6c, 0x4d, 0x75, 0x26, 0xe2, 0x7b, 0x2b, 0x78, 0x3c, 0x4b, 0xd8, 0xdc, 0x76, 0xf1, 0xfe, 0xc6, - 0x51, 0xfb, 0xb2, 0x5d, 0xe1, 0x2b, 0x2b, 0xf8, 0x79, 0x05, 0x2b, 0x2f, 0x61, 0x77, 0xf3, 0xa6, - 0xd7, 0xfa, 0xf1, 0x2a, 0xfc, 0xeb, 0x0d, 0x5e, 0x71, 0x5e, 0x00, 0x5a, 0x16, 0x80, 0x56, 0x05, - 0xe0, 0x47, 0x0f, 0xf8, 0xd9, 0x03, 0x7e, 0xf3, 0x80, 0x73, 0x0f, 0xf8, 0xdd, 0x03, 0xfe, 0xf0, - 0x80, 0x56, 0x1e, 0xf0, 0x53, 0x09, 0x28, 0x2f, 0x01, 0x2d, 0x4b, 0x40, 0xc1, 0xae, 0xd4, 0xe4, - 0x9f, 0xfd, 0x83, 0xbd, 0xe6, 0xea, 0xf5, 0xe8, 0x61, 0xf5, 0xdf, 0x21, 0xbe, 0xe9, 0xcd, 0x1b, - 0x91, 0xd4, 0x8d, 0x4b, 0x9d, 0x5a, 0xae, 0x5e, 0x5a, 0x3b, 0xe3, 0xfa, 0x51, 0x6a, 0xd2, 0x37, - 0x92, 0x8c, 0xb8, 0x22, 0x93, 0xe8, 0xb3, 0xd5, 0xfd, 0xe3, 0x94, 0xf6, 0x8d, 0xa4, 0x74, 0xc4, - 0x15, 0xa5, 0x93, 0xe8, 0x76, 0xf3, 0xfb, 0x94, 0x27, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, - 0x42, 0x65, 0x68, 0x7e, 0x01, 0x00, 0x00, + // 341 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbf, 0x4e, 0x2a, 0x41, + 0x14, 0xc6, 0x77, 0xe0, 0xe6, 0xde, 0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x35, 0x8d, 0x79, + 0xf9, 0x08, 0xef, 0x66, 0xd1, 0x98, 0x27, 0x46, 0xa8, 0x91, 0xfb, 0x67, 0x99, 0x62, 0xc3, 0x64, + 0x6f, 0x45, 0x9a, 0xef, 0x68, 0x32, 0x03, 0x67, 0x3a, 0x03, 0x67, 0x31, 0x03, 0xf4, 0x64, 0x01, + 0xbd, 0x58, 0x40, 0x1f, 0x16, 0xd0, 0xc4, 0x02, 0xfa, 0xb4, 0x80, 0xbe, 0x2c, 0x38, 0x0b, 0x0b, + 0xe8, 0x79, 0x0e, 0xce, 0x64, 0x0e, 0xce, 0x74, 0x0e, 0x0e, 0x3e, 0x14, 0x8a, 0xfc, 0x32, 0xbe, + 0x59, 0xc9, 0x2f, 0xde, 0x0c, 0x6e, 0x65, 0xc7, 0x6a, 0xa1, 0xbb, 0xea, 0x30, 0x27, 0x09, 0x95, + 0x3b, 0xf3, 0xb9, 0x61, 0xf2, 0xb5, 0x70, 0xd0, 0x5d, 0x87, 0x42, 0x91, 0x86, 0x16, 0xa4, 0xc3, + 0x24, 0xe9, 0xf9, 0xdf, 0x05, 0x77, 0xcb, 0x83, 0xa0, 0xa1, 0x45, 0x10, 0x74, 0x98, 0x0c, 0x82, + 0x9e, 0x7f, 0xff, 0x77, 0xf9, 0x87, 0xb3, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x67, 0xe7, + 0x35, 0xbb, 0x01, 0x00, 0x00, } func (this *WorkflowTaskCompletedMetadata) Equal(that interface{}) bool { @@ -189,16 +217,24 @@ func (this *WorkflowTaskCompletedMetadata) Equal(that interface{}) bool { return false } } + if this.SdkName != that1.SdkName { + return false + } + if this.SdkVersion != that1.SdkVersion { + return false + } return true } func (this *WorkflowTaskCompletedMetadata) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 6) + s := make([]string, 0, 8) s = append(s, "&sdk.WorkflowTaskCompletedMetadata{") s = append(s, "CoreUsedFlags: "+fmt.Sprintf("%#v", this.CoreUsedFlags)+",\n") s = append(s, "LangUsedFlags: "+fmt.Sprintf("%#v", this.LangUsedFlags)+",\n") + s = append(s, "SdkName: "+fmt.Sprintf("%#v", this.SdkName)+",\n") + s = append(s, "SdkVersion: "+fmt.Sprintf("%#v", this.SdkVersion)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -230,6 +266,20 @@ func (m *WorkflowTaskCompletedMetadata) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.SdkVersion) > 0 { + i -= len(m.SdkVersion) + copy(dAtA[i:], m.SdkVersion) + i = encodeVarintTaskCompleteMetadata(dAtA, i, uint64(len(m.SdkVersion))) + i-- + dAtA[i] = 0x22 + } + if len(m.SdkName) > 0 { + i -= len(m.SdkName) + copy(dAtA[i:], m.SdkName) + i = encodeVarintTaskCompleteMetadata(dAtA, i, uint64(len(m.SdkName))) + i-- + dAtA[i] = 0x1a + } if len(m.LangUsedFlags) > 0 { dAtA2 := make([]byte, len(m.LangUsedFlags)*10) var j1 int @@ -300,6 +350,14 @@ func (m *WorkflowTaskCompletedMetadata) Size() (n int) { } n += 1 + sovTaskCompleteMetadata(uint64(l)) + l } + l = len(m.SdkName) + if l > 0 { + n += 1 + l + sovTaskCompleteMetadata(uint64(l)) + } + l = len(m.SdkVersion) + if l > 0 { + n += 1 + l + sovTaskCompleteMetadata(uint64(l)) + } return n } @@ -316,6 +374,8 @@ func (this *WorkflowTaskCompletedMetadata) String() string { s := strings.Join([]string{`&WorkflowTaskCompletedMetadata{`, `CoreUsedFlags:` + fmt.Sprintf("%v", this.CoreUsedFlags) + `,`, `LangUsedFlags:` + fmt.Sprintf("%v", this.LangUsedFlags) + `,`, + `SdkName:` + fmt.Sprintf("%v", this.SdkName) + `,`, + `SdkVersion:` + fmt.Sprintf("%v", this.SdkVersion) + `,`, `}`, }, "") return s @@ -509,6 +569,70 @@ func (m *WorkflowTaskCompletedMetadata) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field LangUsedFlags", wireType) } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SdkName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTaskCompleteMetadata + } + 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 ErrInvalidLengthTaskCompleteMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTaskCompleteMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SdkName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SdkVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTaskCompleteMetadata + } + 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 ErrInvalidLengthTaskCompleteMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTaskCompleteMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SdkVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTaskCompleteMetadata(dAtA[iNdEx:])