From c6f9126ae2e005e778263c65f9cd5d6dce7b029b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 3 Apr 2024 08:15:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8A=82=E7=82=B9=E4=B8=8A=E4=BC=A0=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E6=95=B0=E6=8D=AE=E6=97=B6=E5=8F=AA=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E7=9A=84=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/rpc.json | 2 +- pkg/rpc/pb/service_metric_stat.pb.go | 87 +++++++++++++----------- pkg/rpc/protos/service_metric_stat.proto | 15 ++-- 3 files changed, 57 insertions(+), 47 deletions(-) diff --git a/build/rpc.json b/build/rpc.json index 7d0447b..a22c0cb 100644 --- a/build/rpc.json +++ b/build/rpc.json @@ -23599,7 +23599,7 @@ }, { "name": "UploadMetricStatsRequest", - "code": "message UploadMetricStatsRequest {\n\tint64 serverId = 1;\n\tstring time = 2;\n\tint64 count = 3;\n\tfloat total = 4;\n\tint32 version = 5;\n\tint64 itemId = 6;\n\trepeated UploadingMetricStat metricStats = 7;\n}", + "code": "message UploadMetricStatsRequest {\n\tint64 serverId = 1; // 网站ID\n\tstring time = 2; // 时间\n\tint64 count = 3; // 数量\n\tfloat total = 4; // 总数\n\tint32 version = 5; // 版本号\n\tint64 itemId = 6; // 指标ID\n\trepeated UploadingMetricStat metricStats = 7; // 指标统计数据\n\trepeated string keepKeys = 8; // 需要保留的指标值\n}", "doc": "上传统计数据" }, { diff --git a/pkg/rpc/pb/service_metric_stat.pb.go b/pkg/rpc/pb/service_metric_stat.pb.go index 08ea117..baf1ddb 100644 --- a/pkg/rpc/pb/service_metric_stat.pb.go +++ b/pkg/rpc/pb/service_metric_stat.pb.go @@ -26,13 +26,14 @@ type UploadMetricStatsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"` - Time string `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"` - Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` - Total float32 `protobuf:"fixed32,4,opt,name=total,proto3" json:"total,omitempty"` - Version int32 `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"` - ItemId int64 `protobuf:"varint,6,opt,name=itemId,proto3" json:"itemId,omitempty"` - MetricStats []*UploadingMetricStat `protobuf:"bytes,7,rep,name=metricStats,proto3" json:"metricStats,omitempty"` + ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"` // 网站ID + Time string `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"` // 时间 + Count int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` // 数量 + Total float32 `protobuf:"fixed32,4,opt,name=total,proto3" json:"total,omitempty"` // 总数 + Version int32 `protobuf:"varint,5,opt,name=version,proto3" json:"version,omitempty"` // 版本号 + ItemId int64 `protobuf:"varint,6,opt,name=itemId,proto3" json:"itemId,omitempty"` // 指标ID + MetricStats []*UploadingMetricStat `protobuf:"bytes,7,rep,name=metricStats,proto3" json:"metricStats,omitempty"` // 指标统计数据 + KeepKeys []string `protobuf:"bytes,8,rep,name=keepKeys,proto3" json:"keepKeys,omitempty"` // 需要保留的指标值 } func (x *UploadMetricStatsRequest) Reset() { @@ -116,6 +117,13 @@ func (x *UploadMetricStatsRequest) GetMetricStats() []*UploadingMetricStat { return nil } +func (x *UploadMetricStatsRequest) GetKeepKeys() []string { + if x != nil { + return x.KeepKeys + } + return nil +} + // 计算指标数据数量 type CountMetricStatsRequest struct { state protoimpl.MessageState @@ -283,7 +291,7 @@ var file_service_metric_stat_proto_rawDesc = []byte{ 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x01, 0x0a, 0x18, 0x55, + 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x01, 0x0a, 0x18, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, @@ -298,38 +306,39 @@ var file_service_metric_stat_proto_rawDesc = []byte{ 0x74, 0x61, 0x74, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, - 0x22, 0x3d, 0x0a, 0x17, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x22, - 0x68, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, - 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0c, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x4b, 0x0a, 0x17, 0x4c, 0x69, 0x73, - 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, - 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x32, 0xe9, 0x01, 0x0a, 0x11, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x53, 0x74, 0x61, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x11, - 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, - 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, - 0x45, 0x0a, 0x10, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, - 0x61, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x4c, + 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x65, 0x70, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x08, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x65, 0x70, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x3d, 0x0a, 0x17, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x22, 0x68, 0x0a, 0x16, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49, + 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x4b, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x30, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x53, 0x74, 0x61, 0x74, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x32, 0xe9, 0x01, 0x0a, 0x11, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x11, 0x75, 0x70, 0x6c, 0x6f, + 0x61, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x2e, + 0x70, 0x62, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, + 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, + 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x10, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, + 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, + 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/rpc/protos/service_metric_stat.proto b/pkg/rpc/protos/service_metric_stat.proto index 1c9867a..2213211 100644 --- a/pkg/rpc/protos/service_metric_stat.proto +++ b/pkg/rpc/protos/service_metric_stat.proto @@ -19,13 +19,14 @@ service MetricStatService { // 上传统计数据 message UploadMetricStatsRequest { - int64 serverId = 1; - string time = 2; - int64 count = 3; - float total = 4; - int32 version = 5; - int64 itemId = 6; - repeated UploadingMetricStat metricStats = 7; + int64 serverId = 1; // 网站ID + string time = 2; // 时间 + int64 count = 3; // 数量 + float total = 4; // 总数 + int32 version = 5; // 版本号 + int64 itemId = 6; // 指标ID + repeated UploadingMetricStat metricStats = 7; // 指标统计数据 + repeated string keepKeys = 8; // 需要保留的指标值 } // 计算指标数据数量