From 90198d1c1baaba1e4a801af2b4fe50a5afd2e4e2 Mon Sep 17 00:00:00 2001 From: nolouch Date: Thu, 19 Sep 2024 16:03:52 +0800 Subject: [PATCH] *: add region id in resource usage record Signed-off-by: nolouch --- .../resource_usage_agent.pb.go | 92 +++++++++++++------ proto/resource_usage_agent.proto | 1 + scripts/proto.lock | 5 + 3 files changed, 70 insertions(+), 28 deletions(-) diff --git a/pkg/resource_usage_agent/resource_usage_agent.pb.go b/pkg/resource_usage_agent/resource_usage_agent.pb.go index 7512e4f15..5f30d94c2 100644 --- a/pkg/resource_usage_agent/resource_usage_agent.pb.go +++ b/pkg/resource_usage_agent/resource_usage_agent.pb.go @@ -185,6 +185,7 @@ func (*ResourceUsageRecord) XXX_OneofWrappers() []interface{} { type GroupTagRecord struct { ResourceGroupTag []byte `protobuf:"bytes,1,opt,name=resource_group_tag,json=resourceGroupTag,proto3" json:"resource_group_tag,omitempty"` Items []*GroupTagRecordItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + RegionId uint64 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -237,6 +238,13 @@ func (m *GroupTagRecord) GetItems() []*GroupTagRecordItem { return nil } +func (m *GroupTagRecord) GetRegionId() uint64 { + if m != nil { + return m.RegionId + } + return 0 +} + type GroupTagRecordItem struct { TimestampSec uint64 `protobuf:"varint,1,opt,name=timestamp_sec,json=timestampSec,proto3" json:"timestamp_sec,omitempty"` CpuTimeMs uint32 `protobuf:"varint,2,opt,name=cpu_time_ms,json=cpuTimeMs,proto3" json:"cpu_time_ms,omitempty"` @@ -319,34 +327,35 @@ func init() { func init() { proto.RegisterFile("resource_usage_agent.proto", fileDescriptor_14aca67aa7bfb0f2) } var fileDescriptor_14aca67aa7bfb0f2 = []byte{ - // 432 bytes of a gzipped FileDescriptorProto - 0x1f, 0x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64, 0x81, - 0xf4, 0xc9, 0xd5, 0xd9, 0x97, 0x56, 0x2b, 0xba, 0x7e, 0xd5, 0xa4, 0xf7, 0x8c, 0x1c, 0x3d, 0xfc, - 0xfd, 0x63, 0x8b, 0xfc, 0x5c, 0xc6, 0xe4, 0xd7, 0x32, 0x26, 0x7f, 0x96, 0x31, 0xf9, 0xfe, 0x37, - 0xee, 0xc1, 0xae, 0x32, 0x62, 0xea, 0xe4, 0xfc, 0x6c, 0x3a, 0x3f, 0x0b, 0xcb, 0x5c, 0xf4, 0xc3, - 0xe7, 0xf9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0xb8, 0xf4, 0x12, 0x2e, 0x03, 0x00, 0x00, + // 448 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xdd, 0x6a, 0x13, 0x41, + 0x14, 0xce, 0xd8, 0x18, 0x9a, 0x93, 0xa4, 0x2d, 0x63, 0xd1, 0xb8, 0xe2, 0x12, 0xb6, 0x22, 0x2b, + 0x68, 0x94, 0x78, 0x5f, 0xb0, 0x20, 0x5a, 0xa4, 0x20, 0x93, 0x7a, 0x27, 0x0c, 0xfb, 0x73, 0x1c, + 0x86, 0xb0, 0x3b, 0xeb, 0xfc, 0x54, 0x72, 0xed, 0x33, 0x08, 0x82, 0x2f, 0xe0, 0xa3, 0x78, 0xe9, + 0xa5, 0x97, 0x12, 0x5f, 0x44, 0x76, 0x36, 0x29, 0xa4, 0x2e, 0xd2, 0xab, 0x3d, 0x7c, 0x3f, 0xfb, + 0x7d, 0xbb, 0xe7, 0x40, 0xa0, 0xd1, 0x28, 0xa7, 0x33, 0xe4, 0xce, 0x24, 0x02, 0x79, 0x22, 0xb0, + 0xb4, 0xd3, 0x4a, 0x2b, 0xab, 0xe8, 0x61, 0x1b, 0x17, 0x1c, 0x0a, 0x25, 0x94, 0x17, 0x3c, 0xad, + 0xa7,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 0x89, 0x47, 0xac, 0x9f, 0x55, 0xee, 0x5c, 0x16, 0x78, + 0xb6, 0x0e, 0x4e, 0x72, 0xbe, 0xc0, 0xa5, 0xf1, 0xc1, 0xa3, 0x3a, 0x38, 0xc9, 0xdf, 0xe0, 0xd2, + 0xd0, 0xfb, 0x00, 0x9f, 0xb4, 0xb4, 0xd8, 0xb0, 0xdd, 0xc6, 0xeb, 0x91, 0x9a, 0x9e, 0x69, 0xa0, + 0x5b, 0xcb, 0x79, 0x51, 0x7f, 0x24, 0x7d, 0x0f, 0x3d, 0x86, 0x95, 0xd2, 0x96, 0x3e, 0x6a, 0xff, + 0x0b, 0x2d, 0x0b, 0x0d, 0x8e, 0xda, 0xa5, 0xdb, 0xc7, 0xd0, 0x89, 0xc9, 0xec, 0x33, 0x81, 0xdb, + 0x57, 0xaf, 0xe7, 0xad, 0x4b, 0xe7, 0x2e, 0xa5, 0x12, 0xfa, 0x73, 0x97, 0x9a, 0x4c, 0xcb, 0x14, + 0xe9, 0x93, 0xff, 0x67, 0x5f, 0x39, 0xbc, 0xe0, 0xfa, 0x55, 0xa3, 0xce, 0x33, 0x72, 0xf2, 0xf0, + 0xd7, 0xf7, 0x5d, 0xf2, 0x63, 0x15, 0x92, 0x9f, 0xab, 0x90, 0xfc, 0x5e, 0x85, 0xe4, 0xeb, 0x9f, + 0xb0, 0x03, 0x07, 0x4a, 0x8b, 0xa9, 0x95, 0x8b, 0x8b, 0xe9, 0xe2, 0xc2, 0x9f, 0x7a, 0xda, 0xf3, + 0x8f, 0xe7, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf5, 0xdc, 0x03, 0x07, 0x4c, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -705,6 +714,11 @@ func (m *GroupTagRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.RegionId != 0 { + i = encodeVarintResourceUsageAgent(dAtA, i, uint64(m.RegionId)) + i-- + dAtA[i] = 0x18 + } if len(m.Items) > 0 { for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { @@ -854,6 +868,9 @@ func (m *GroupTagRecord) Size() (n int) { n += 1 + l + sovResourceUsageAgent(uint64(l)) } } + if m.RegionId != 0 { + n += 1 + sovResourceUsageAgent(uint64(m.RegionId)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1175,6 +1192,25 @@ func (m *GroupTagRecord) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegionId", wireType) + } + m.RegionId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowResourceUsageAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RegionId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipResourceUsageAgent(dAtA[iNdEx:]) diff --git a/proto/resource_usage_agent.proto b/proto/resource_usage_agent.proto index 4250ec259..5ea2cc535 100644 --- a/proto/resource_usage_agent.proto +++ b/proto/resource_usage_agent.proto @@ -40,6 +40,7 @@ message ResourceUsageRecord { message GroupTagRecord { bytes resource_group_tag = 1; repeated GroupTagRecordItem items = 2; + uint64 region_id = 3; } message GroupTagRecordItem { diff --git a/scripts/proto.lock b/scripts/proto.lock index 3b3ab532f..0d5633286 100644 --- a/scripts/proto.lock +++ b/scripts/proto.lock @@ -19978,6 +19978,11 @@ "name": "items", "type": "GroupTagRecordItem", "is_repeated": true + }, + { + "id": 3, + "name": "region_id", + "type": "uint64" } ] },