From c25bfdca69f9edf23e911217c47c3b484bc2c694 Mon Sep 17 00:00:00 2001 From: Lynn Date: Thu, 22 Jan 2026 20:16:09 +0800 Subject: [PATCH 1/3] *: support tidb topru --- go-tipb/topsql_agent.pb.go | 1197 +++++++++++++++++++++++++++++++----- proto/topsql_agent.proto | 34 +- 2 files changed, 1093 insertions(+), 138 deletions(-) diff --git a/go-tipb/topsql_agent.pb.go b/go-tipb/topsql_agent.pb.go index 7b135c5e..16eacfbe 100644 --- a/go-tipb/topsql_agent.pb.go +++ b/go-tipb/topsql_agent.pb.go @@ -5,6 +5,7 @@ package tipb import ( "context" + encoding_binary "encoding/binary" "fmt" "io" "math" @@ -29,6 +30,37 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type ReportInterval int32 + +const ( + ReportInterval_REPORT_INTERVAL_UNSPECIFIED ReportInterval = 0 + ReportInterval_REPORT_INTERVAL_15S ReportInterval = 15 + ReportInterval_REPORT_INTERVAL_30S ReportInterval = 30 + ReportInterval_REPORT_INTERVAL_60S ReportInterval = 60 +) + +var ReportInterval_name = map[int32]string{ + 0: "REPORT_INTERVAL_UNSPECIFIED", + 15: "REPORT_INTERVAL_15S", + 30: "REPORT_INTERVAL_30S", + 60: "REPORT_INTERVAL_60S", +} + +var ReportInterval_value = map[string]int32{ + "REPORT_INTERVAL_UNSPECIFIED": 0, + "REPORT_INTERVAL_15S": 15, + "REPORT_INTERVAL_30S": 30, + "REPORT_INTERVAL_60S": 60, +} + +func (x ReportInterval) String() string { + return proto.EnumName(ReportInterval_name, int32(x)) +} + +func (ReportInterval) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1b19f3a2fcd6965e, []int{0} +} + type TopSQLRecord struct { SqlDigest []byte `protobuf:"bytes,1,opt,name=sql_digest,json=sqlDigest,proto3" json:"sql_digest,omitempty"` PlanDigest []byte `protobuf:"bytes,2,opt,name=plan_digest,json=planDigest,proto3" json:"plan_digest,omitempty"` @@ -97,6 +129,152 @@ func (m *TopSQLRecord) GetKeyspaceName() []byte { return nil } +// TopRURecord represents RU statistics for a single (user, sql_digest, plan_digest) combination. +type TopRURecord struct { + KeyspaceName []byte `protobuf:"bytes,1,opt,name=keyspace_name,json=keyspaceName,proto3" json:"keyspace_name,omitempty"` + User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` + SqlDigest []byte `protobuf:"bytes,3,opt,name=sql_digest,json=sqlDigest,proto3" json:"sql_digest,omitempty"` + PlanDigest []byte `protobuf:"bytes,4,opt,name=plan_digest,json=planDigest,proto3" json:"plan_digest,omitempty"` + Items []*TopRURecordItem `protobuf:"bytes,5,rep,name=items,proto3" json:"items,omitempty"` +} + +func (m *TopRURecord) Reset() { *m = TopRURecord{} } +func (m *TopRURecord) String() string { return proto.CompactTextString(m) } +func (*TopRURecord) ProtoMessage() {} +func (*TopRURecord) Descriptor() ([]byte, []int) { + return fileDescriptor_1b19f3a2fcd6965e, []int{1} +} +func (m *TopRURecord) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TopRURecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TopRURecord.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TopRURecord) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopRURecord.Merge(m, src) +} +func (m *TopRURecord) XXX_Size() int { + return m.Size() +} +func (m *TopRURecord) XXX_DiscardUnknown() { + xxx_messageInfo_TopRURecord.DiscardUnknown(m) +} + +var xxx_messageInfo_TopRURecord proto.InternalMessageInfo + +func (m *TopRURecord) GetKeyspaceName() []byte { + if m != nil { + return m.KeyspaceName + } + return nil +} + +func (m *TopRURecord) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +func (m *TopRURecord) GetSqlDigest() []byte { + if m != nil { + return m.SqlDigest + } + return nil +} + +func (m *TopRURecord) GetPlanDigest() []byte { + if m != nil { + return m.PlanDigest + } + return nil +} + +func (m *TopRURecord) GetItems() []*TopRURecordItem { + if m != nil { + return m.Items + } + return nil +} + +// TopRURecordItem represents statistics within a single time bucket. +type TopRURecordItem struct { + TimestampSec uint64 `protobuf:"varint,1,opt,name=timestamp_sec,json=timestampSec,proto3" json:"timestamp_sec,omitempty"` + TotalRu float64 `protobuf:"fixed64,2,opt,name=total_ru,json=totalRu,proto3" json:"total_ru,omitempty"` + ExecCount uint64 `protobuf:"varint,3,opt,name=exec_count,json=execCount,proto3" json:"exec_count,omitempty"` + ExecDuration uint64 `protobuf:"varint,4,opt,name=exec_duration,json=execDuration,proto3" json:"exec_duration,omitempty"` +} + +func (m *TopRURecordItem) Reset() { *m = TopRURecordItem{} } +func (m *TopRURecordItem) String() string { return proto.CompactTextString(m) } +func (*TopRURecordItem) ProtoMessage() {} +func (*TopRURecordItem) Descriptor() ([]byte, []int) { + return fileDescriptor_1b19f3a2fcd6965e, []int{2} +} +func (m *TopRURecordItem) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TopRURecordItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TopRURecordItem.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TopRURecordItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopRURecordItem.Merge(m, src) +} +func (m *TopRURecordItem) XXX_Size() int { + return m.Size() +} +func (m *TopRURecordItem) XXX_DiscardUnknown() { + xxx_messageInfo_TopRURecordItem.DiscardUnknown(m) +} + +var xxx_messageInfo_TopRURecordItem proto.InternalMessageInfo + +func (m *TopRURecordItem) GetTimestampSec() uint64 { + if m != nil { + return m.TimestampSec + } + return 0 +} + +func (m *TopRURecordItem) GetTotalRu() float64 { + if m != nil { + return m.TotalRu + } + return 0 +} + +func (m *TopRURecordItem) GetExecCount() uint64 { + if m != nil { + return m.ExecCount + } + return 0 +} + +func (m *TopRURecordItem) GetExecDuration() uint64 { + if m != nil { + return m.ExecDuration + } + return 0 +} + type TopSQLRecordItem 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"` @@ -112,7 +290,7 @@ func (m *TopSQLRecordItem) Reset() { *m = TopSQLRecordItem{} } func (m *TopSQLRecordItem) String() string { return proto.CompactTextString(m) } func (*TopSQLRecordItem) ProtoMessage() {} func (*TopSQLRecordItem) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{1} + return fileDescriptor_1b19f3a2fcd6965e, []int{3} } func (m *TopSQLRecordItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -212,7 +390,7 @@ func (m *SQLMeta) Reset() { *m = SQLMeta{} } func (m *SQLMeta) String() string { return proto.CompactTextString(m) } func (*SQLMeta) ProtoMessage() {} func (*SQLMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{2} + return fileDescriptor_1b19f3a2fcd6965e, []int{4} } func (m *SQLMeta) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -289,7 +467,7 @@ func (m *PlanMeta) Reset() { *m = PlanMeta{} } func (m *PlanMeta) String() string { return proto.CompactTextString(m) } func (*PlanMeta) ProtoMessage() {} func (*PlanMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{3} + return fileDescriptor_1b19f3a2fcd6965e, []int{5} } func (m *PlanMeta) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -353,7 +531,7 @@ func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } func (m *EmptyResponse) String() string { return proto.CompactTextString(m) } func (*EmptyResponse) ProtoMessage() {} func (*EmptyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{4} + return fileDescriptor_1b19f3a2fcd6965e, []int{6} } func (m *EmptyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -383,13 +561,17 @@ func (m *EmptyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo type TopSQLSubRequest struct { + // enable_top_ru controls TopRU collection and reporting. + EnableTopRu bool `protobuf:"varint,1,opt,name=enable_top_ru,json=enableTopRu,proto3" json:"enable_top_ru,omitempty"` + // report_interval controls report interval, options: 15s/30s/60s. + ReportInterval ReportInterval `protobuf:"varint,2,opt,name=report_interval,json=reportInterval,proto3,enum=tipb.ReportInterval" json:"report_interval,omitempty"` } func (m *TopSQLSubRequest) Reset() { *m = TopSQLSubRequest{} } func (m *TopSQLSubRequest) String() string { return proto.CompactTextString(m) } func (*TopSQLSubRequest) ProtoMessage() {} func (*TopSQLSubRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{5} + return fileDescriptor_1b19f3a2fcd6965e, []int{7} } func (m *TopSQLSubRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -418,11 +600,26 @@ func (m *TopSQLSubRequest) XXX_DiscardUnknown() { var xxx_messageInfo_TopSQLSubRequest proto.InternalMessageInfo +func (m *TopSQLSubRequest) GetEnableTopRu() bool { + if m != nil { + return m.EnableTopRu + } + return false +} + +func (m *TopSQLSubRequest) GetReportInterval() ReportInterval { + if m != nil { + return m.ReportInterval + } + return ReportInterval_REPORT_INTERVAL_UNSPECIFIED +} + type TopSQLSubResponse struct { // Types that are valid to be assigned to RespOneof: // *TopSQLSubResponse_Record // *TopSQLSubResponse_SqlMeta // *TopSQLSubResponse_PlanMeta + // *TopSQLSubResponse_RuRecord RespOneof isTopSQLSubResponse_RespOneof `protobuf_oneof:"resp_oneof"` } @@ -430,7 +627,7 @@ func (m *TopSQLSubResponse) Reset() { *m = TopSQLSubResponse{} } func (m *TopSQLSubResponse) String() string { return proto.CompactTextString(m) } func (*TopSQLSubResponse) ProtoMessage() {} func (*TopSQLSubResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{6} + return fileDescriptor_1b19f3a2fcd6965e, []int{8} } func (m *TopSQLSubResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -474,10 +671,14 @@ type TopSQLSubResponse_SqlMeta struct { type TopSQLSubResponse_PlanMeta struct { PlanMeta *PlanMeta `protobuf:"bytes,3,opt,name=plan_meta,json=planMeta,proto3,oneof" json:"plan_meta,omitempty"` } +type TopSQLSubResponse_RuRecord struct { + RuRecord *TopRURecord `protobuf:"bytes,4,opt,name=ru_record,json=ruRecord,proto3,oneof" json:"ru_record,omitempty"` +} func (*TopSQLSubResponse_Record) isTopSQLSubResponse_RespOneof() {} func (*TopSQLSubResponse_SqlMeta) isTopSQLSubResponse_RespOneof() {} func (*TopSQLSubResponse_PlanMeta) isTopSQLSubResponse_RespOneof() {} +func (*TopSQLSubResponse_RuRecord) isTopSQLSubResponse_RespOneof() {} func (m *TopSQLSubResponse) GetRespOneof() isTopSQLSubResponse_RespOneof { if m != nil { @@ -507,17 +708,28 @@ func (m *TopSQLSubResponse) GetPlanMeta() *PlanMeta { return nil } +func (m *TopSQLSubResponse) GetRuRecord() *TopRURecord { + if x, ok := m.GetRespOneof().(*TopSQLSubResponse_RuRecord); ok { + return x.RuRecord + } + return nil +} + // XXX_OneofWrappers is for the internal use of the proto package. func (*TopSQLSubResponse) XXX_OneofWrappers() []interface{} { return []interface{}{ (*TopSQLSubResponse_Record)(nil), (*TopSQLSubResponse_SqlMeta)(nil), (*TopSQLSubResponse_PlanMeta)(nil), + (*TopSQLSubResponse_RuRecord)(nil), } } func init() { + proto.RegisterEnum("tipb.ReportInterval", ReportInterval_name, ReportInterval_value) proto.RegisterType((*TopSQLRecord)(nil), "tipb.TopSQLRecord") + proto.RegisterType((*TopRURecord)(nil), "tipb.TopRURecord") + proto.RegisterType((*TopRURecordItem)(nil), "tipb.TopRURecordItem") proto.RegisterType((*TopSQLRecordItem)(nil), "tipb.TopSQLRecordItem") proto.RegisterMapType((map[string]uint64)(nil), "tipb.TopSQLRecordItem.StmtKvExecCountEntry") proto.RegisterType((*SQLMeta)(nil), "tipb.SQLMeta") @@ -530,58 +742,72 @@ func init() { func init() { proto.RegisterFile("topsql_agent.proto", fileDescriptor_1b19f3a2fcd6965e) } var fileDescriptor_1b19f3a2fcd6965e = []byte{ - // 803 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x6f, 0x1b, 0x55, - 0x14, 0xf5, 0xd4, 0x4e, 0x62, 0x5f, 0xdb, 0x49, 0xfb, 0x92, 0xb4, 0x96, 0x25, 0x4c, 0x65, 0x04, - 0x44, 0x50, 0x5c, 0x70, 0x25, 0xa0, 0xac, 0xc0, 0x34, 0x52, 0x22, 0xda, 0x90, 0xbe, 0xe9, 0x82, - 0xdd, 0x68, 0x66, 0x7c, 0xb1, 0x46, 0x99, 0xf7, 0xe1, 0x79, 0x6f, 0x42, 0xcd, 0xaf, 0x60, 0xc9, - 0x82, 0x0d, 0x3b, 0xc4, 0x8e, 0x1f, 0x81, 0xc4, 0xb2, 0xcb, 0x2e, 0x51, 0x22, 0xf1, 0x3b, 0xd0, - 0xbb, 0x33, 0x4e, 0xc7, 0x49, 0xaa, 0x76, 0xf7, 0x7c, 0xee, 0x39, 0x67, 0xce, 0x7d, 0xf7, 0xce, - 0x18, 0x98, 0x55, 0xda, 0xcc, 0xd3, 0x20, 0x9c, 0xa1, 0xb4, 0x23, 0x9d, 0x29, 0xab, 0x58, 0xc3, - 0x26, 0x3a, 0xea, 0xef, 0xcc, 0xd4, 0x4c, 0x11, 0x70, 0xdf, 0x9d, 0x8a, 0x5a, 0x7f, 0x2b, 0xcb, - 0x8d, 0x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xbd, 0x90, 0xda, 0x9e, 0xc7, 0xbe, 0x80, 0x6e, 0xe1, 0xb1, 0xdc, 0xbe, 0xd5, 0xec, 0xaf, - 0x17, 0x3e, 0x84, 0xcd, 0x42, 0x78, 0xb1, 0x17, 0x97, 0x1a, 0x79, 0xad, 0x74, 0x7c, 0xbc, 0xfc, - 0xf0, 0x1e, 0xe7, 0x91, 0x9f, 0x47, 0xec, 0x6b, 0x68, 0xf9, 0x79, 0x64, 0xe2, 0x2c, 0x89, 0x90, - 0xad, 0x7c, 0x36, 0x5f, 0x4d, 0xaa, 0x7f, 0xe7, 0x0a, 0xbe, 0x74, 0xfc, 0xd4, 0x9b, 0x3c, 0x7c, - 0xf9, 0x47, 0xd3, 0xfb, 0xe7, 0x6c, 0xe0, 0xbd, 0x38, 0x1b, 0x78, 0xff, 0x9e, 0x0d, 0xbc, 0x5f, - 0xce, 0x07, 0xb5, 0x5f, 0xcf, 0x07, 0xb5, 0x17, 0xe7, 0x83, 0xda, 0xcb, 0xf3, 0x41, 0x0d, 0x76, - 0x63, 0x25, 0x46, 0x3a, 0x91, 0xb3, 0x38, 0xd4, 0x23, 0x9b, 0x4c, 0x23, 0xb2, 0x3b, 0xf6, 0xa2, - 0x75, 0xfa, 0x37, 0x78, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0xbf, 0x76, 0x3d, 0x50, - 0x06, 0x00, 0x00, + // 1038 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xc1, 0x6f, 0x1b, 0xc5, + 0x17, 0xf6, 0xc6, 0x4e, 0x62, 0x3f, 0xdb, 0xb1, 0x33, 0x49, 0x9a, 0xfc, 0xf2, 0x13, 0x6e, 0x65, + 0x04, 0x44, 0x6d, 0x71, 0x53, 0x47, 0x14, 0x8a, 0x40, 0x6a, 0xd3, 0x18, 0xc5, 0x22, 0x75, 0x9d, + 0xd9, 0x14, 0x71, 0x5b, 0xad, 0xd7, 0x43, 0xb4, 0xca, 0xee, 0xce, 0x7a, 0x67, 0x26, 0x10, 0xc4, + 0x9d, 0x2b, 0x17, 0x24, 0x0e, 0x5c, 0xb8, 0x71, 0x45, 0xfc, 0x13, 0x1c, 0x7b, 0xec, 0x81, 0x03, + 0x4a, 0x24, 0xfe, 0x0e, 0x34, 0x6f, 0x77, 0x5d, 0xdb, 0xeb, 0xa8, 0xb9, 0xed, 0x7e, 0xef, 0xfb, + 0xde, 0x7c, 0xef, 0xbd, 0x79, 0x5e, 0x03, 0x91, 0x3c, 0x14, 0x23, 0xcf, 0xb2, 0x4f, 0x59, 0x20, + 0x5b, 0x61, 0xc4, 0x25, 0x27, 0x05, 0xe9, 0x86, 0x83, 0xed, 0xf5, 0x53, 0x7e, 0xca, 0x11, 0x78, + 0xa0, 0x9f, 0xe2, 0xd8, 0x76, 0x2d, 0x52, 0x42, 0xe2, 0x63, 0x0c, 0x34, 0x7f, 0x33, 0xa0, 0x72, + 0xc2, 0x43, 0xf3, 0xf8, 0x88, 0x32, 0x87, 0x47, 0x43, 0xf2, 0x0e, 0x80, 0x4e, 0x38, 0x74, 0x4f, + 0x99, 0x90, 0x5b, 0xc6, 0x1d, 0x63, 0xa7, 0x42, 0x4b, 0x62, 0xe4, 0x1d, 0x20, 0x40, 0x6e, 0x43, + 0x39, 0xf4, 0xec, 0x20, 0x8d, 0x2f, 0x60, 0x1c, 0x34, 0x94, 0x10, 0xee, 0xc3, 0xa2, 0x2b, 0x99, + 0x2f, 0xb6, 0xf2, 0x77, 0xf2, 0x3b, 0xe5, 0xf6, 0xad, 0x96, 0x76, 0xd3, 0x9a, 0x3c, 0xa2, 0x2b, + 0x99, 0x4f, 0x63, 0x12, 0x79, 0x17, 0xaa, 0x67, 0xec, 0x42, 0x84, 0xb6, 0xc3, 0xac, 0xc0, 0xf6, + 0xd9, 0x56, 0x01, 0x13, 0x56, 0x52, 0xb0, 0x67, 0xfb, 0x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0x99, 0xc1, 0xd3, 0x8c, 0xbb, 0xc6, 0xfe, 0xe3, 0xd7, 0xbf, 0x17, 0x8d, 0xbf, 0x2e, + 0x1b, 0xc6, 0xab, 0xcb, 0x86, 0xf1, 0xcf, 0x65, 0xc3, 0xf8, 0xe9, 0xaa, 0x91, 0xfb, 0xe5, 0xaa, + 0x91, 0x7b, 0x75, 0xd5, 0xc8, 0xbd, 0xbe, 0x6a, 0xe4, 0x60, 0xc3, 0xe1, 0x7e, 0x2b, 0x74, 0x83, + 0x53, 0xc7, 0x0e, 0x5b, 0xd2, 0x1d, 0x0e, 0x30, 0x5d, 0xdf, 0x18, 0x2c, 0xe1, 0x1f, 0x96, 0xbd, + 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf7, 0xb5, 0xff, 0xc2, 0xf3, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -604,6 +830,8 @@ type TopSQLAgentClient interface { // ReportPlanMeta reports plan meta to the agent. // The agent should deal with plan meta similarly to SQL meta. ReportPlanMeta(ctx context.Context, opts ...grpc.CallOption) (TopSQLAgent_ReportPlanMetaClient, error) + // ReportTopRURecords is called periodically to save the in-memory TopRU records. + ReportTopRURecords(ctx context.Context, opts ...grpc.CallOption) (TopSQLAgent_ReportTopRURecordsClient, error) } type topSQLAgentClient struct { @@ -716,6 +944,40 @@ func (x *topSQLAgentReportPlanMetaClient) CloseAndRecv() (*EmptyResponse, error) return m, nil } +func (c *topSQLAgentClient) ReportTopRURecords(ctx context.Context, opts ...grpc.CallOption) (TopSQLAgent_ReportTopRURecordsClient, error) { + stream, err := c.cc.NewStream(ctx, &_TopSQLAgent_serviceDesc.Streams[3], "/tipb.TopSQLAgent/ReportTopRURecords", opts...) + if err != nil { + return nil, err + } + x := &topSQLAgentReportTopRURecordsClient{stream} + return x, nil +} + +type TopSQLAgent_ReportTopRURecordsClient interface { + Send(*TopRURecord) error + CloseAndRecv() (*EmptyResponse, error) + grpc.ClientStream +} + +type topSQLAgentReportTopRURecordsClient struct { + grpc.ClientStream +} + +func (x *topSQLAgentReportTopRURecordsClient) Send(m *TopRURecord) error { + return x.ClientStream.SendMsg(m) +} + +func (x *topSQLAgentReportTopRURecordsClient) CloseAndRecv() (*EmptyResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(EmptyResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // TopSQLAgentServer is the server API for TopSQLAgent service. type TopSQLAgentServer interface { // ReportTopSQLRecords is called periodically (e.g. per minute) to save the in-memory TopSQL records @@ -726,6 +988,8 @@ type TopSQLAgentServer interface { // ReportPlanMeta reports plan meta to the agent. // The agent should deal with plan meta similarly to SQL meta. ReportPlanMeta(TopSQLAgent_ReportPlanMetaServer) error + // ReportTopRURecords is called periodically to save the in-memory TopRU records. + ReportTopRURecords(TopSQLAgent_ReportTopRURecordsServer) error } // UnimplementedTopSQLAgentServer can be embedded to have forward compatible implementations. @@ -741,6 +1005,9 @@ func (*UnimplementedTopSQLAgentServer) ReportSQLMeta(srv TopSQLAgent_ReportSQLMe func (*UnimplementedTopSQLAgentServer) ReportPlanMeta(srv TopSQLAgent_ReportPlanMetaServer) error { return status.Errorf(codes.Unimplemented, "method ReportPlanMeta not implemented") } +func (*UnimplementedTopSQLAgentServer) ReportTopRURecords(srv TopSQLAgent_ReportTopRURecordsServer) error { + return status.Errorf(codes.Unimplemented, "method ReportTopRURecords not implemented") +} func RegisterTopSQLAgentServer(s *grpc.Server, srv TopSQLAgentServer) { s.RegisterService(&_TopSQLAgent_serviceDesc, srv) @@ -824,6 +1091,32 @@ func (x *topSQLAgentReportPlanMetaServer) Recv() (*PlanMeta, error) { return m, nil } +func _TopSQLAgent_ReportTopRURecords_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TopSQLAgentServer).ReportTopRURecords(&topSQLAgentReportTopRURecordsServer{stream}) +} + +type TopSQLAgent_ReportTopRURecordsServer interface { + SendAndClose(*EmptyResponse) error + Recv() (*TopRURecord, error) + grpc.ServerStream +} + +type topSQLAgentReportTopRURecordsServer struct { + grpc.ServerStream +} + +func (x *topSQLAgentReportTopRURecordsServer) SendAndClose(m *EmptyResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *topSQLAgentReportTopRURecordsServer) Recv() (*TopRURecord, error) { + m := new(TopRURecord) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + var _TopSQLAgent_serviceDesc = grpc.ServiceDesc{ ServiceName: "tipb.TopSQLAgent", HandlerType: (*TopSQLAgentServer)(nil), @@ -844,6 +1137,11 @@ var _TopSQLAgent_serviceDesc = grpc.ServiceDesc{ Handler: _TopSQLAgent_ReportPlanMeta_Handler, ClientStreams: true, }, + { + StreamName: "ReportTopRURecords", + Handler: _TopSQLAgent_ReportTopRURecords_Handler, + ClientStreams: true, + }, }, Metadata: "topsql_agent.proto", } @@ -1009,7 +1307,7 @@ func (m *TopSQLRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *TopSQLRecordItem) Marshal() (dAtA []byte, err error) { +func (m *TopRURecord) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1019,72 +1317,62 @@ func (m *TopSQLRecordItem) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TopSQLRecordItem) MarshalTo(dAtA []byte) (int, error) { +func (m *TopRURecord) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TopSQLRecordItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TopRURecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.StmtNetworkOutBytes != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtNetworkOutBytes)) - i-- - dAtA[i] = 0x40 - } - if m.StmtNetworkInBytes != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtNetworkInBytes)) - i-- - dAtA[i] = 0x38 - } - if m.StmtDurationCount != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtDurationCount)) - i-- - dAtA[i] = 0x30 - } - if m.StmtDurationSumNs != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtDurationSumNs)) - i-- - dAtA[i] = 0x28 - } - if len(m.StmtKvExecCount) > 0 { - for k := range m.StmtKvExecCount { - v := m.StmtKvExecCount[k] - baseI := i - i = encodeVarintTopsqlAgent(dAtA, i, uint64(v)) - i-- - dAtA[i] = 0x10 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintTopsqlAgent(dAtA, i, uint64(baseI-i)) + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTopsqlAgent(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } } - if m.StmtExecCount != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtExecCount)) + if len(m.PlanDigest) > 0 { + i -= len(m.PlanDigest) + copy(dAtA[i:], m.PlanDigest) + i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(m.PlanDigest))) i-- - dAtA[i] = 0x18 + dAtA[i] = 0x22 } - if m.CpuTimeMs != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.CpuTimeMs)) + if len(m.SqlDigest) > 0 { + i -= len(m.SqlDigest) + copy(dAtA[i:], m.SqlDigest) + i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(m.SqlDigest))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x1a } - if m.TimestampSec != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.TimestampSec)) + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(m.User))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0x12 + } + if len(m.KeyspaceName) > 0 { + i -= len(m.KeyspaceName) + copy(dAtA[i:], m.KeyspaceName) + i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(m.KeyspaceName))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *SQLMeta) Marshal() (dAtA []byte, err error) { +func (m *TopRURecordItem) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1094,17 +1382,136 @@ func (m *SQLMeta) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SQLMeta) MarshalTo(dAtA []byte) (int, error) { +func (m *TopRURecordItem) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SQLMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TopRURecordItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.KeyspaceName) > 0 { + if m.ExecDuration != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ExecDuration)) + i-- + dAtA[i] = 0x20 + } + if m.ExecCount != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ExecCount)) + i-- + dAtA[i] = 0x18 + } + if m.TotalRu != 0 { + i -= 8 + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.TotalRu)))) + i-- + dAtA[i] = 0x11 + } + if m.TimestampSec != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.TimestampSec)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TopSQLRecordItem) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopSQLRecordItem) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopSQLRecordItem) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StmtNetworkOutBytes != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtNetworkOutBytes)) + i-- + dAtA[i] = 0x40 + } + if m.StmtNetworkInBytes != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtNetworkInBytes)) + i-- + dAtA[i] = 0x38 + } + if m.StmtDurationCount != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtDurationCount)) + i-- + dAtA[i] = 0x30 + } + if m.StmtDurationSumNs != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtDurationSumNs)) + i-- + dAtA[i] = 0x28 + } + if len(m.StmtKvExecCount) > 0 { + for k := range m.StmtKvExecCount { + v := m.StmtKvExecCount[k] + baseI := i + i = encodeVarintTopsqlAgent(dAtA, i, uint64(v)) + i-- + dAtA[i] = 0x10 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintTopsqlAgent(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if m.StmtExecCount != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.StmtExecCount)) + i-- + dAtA[i] = 0x18 + } + if m.CpuTimeMs != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.CpuTimeMs)) + i-- + dAtA[i] = 0x10 + } + if m.TimestampSec != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.TimestampSec)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SQLMeta) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SQLMeta) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SQLMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.KeyspaceName) > 0 { i -= len(m.KeyspaceName) copy(dAtA[i:], m.KeyspaceName) i = encodeVarintTopsqlAgent(dAtA, i, uint64(len(m.KeyspaceName))) @@ -1232,6 +1639,21 @@ func (m *TopSQLSubRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ReportInterval != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ReportInterval)) + i-- + dAtA[i] = 0x10 + } + if m.EnableTopRu { + i-- + if m.EnableTopRu { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -1330,6 +1752,27 @@ func (m *TopSQLSubResponse_PlanMeta) MarshalToSizedBuffer(dAtA []byte) (int, err } return len(dAtA) - i, nil } +func (m *TopSQLSubResponse_RuRecord) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopSQLSubResponse_RuRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.RuRecord != nil { + { + size, err := m.RuRecord.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTopsqlAgent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} func encodeVarintTopsqlAgent(dAtA []byte, offset int, v uint64) int { offset -= sovTopsqlAgent(v) base := offset @@ -1368,6 +1811,58 @@ func (m *TopSQLRecord) Size() (n int) { return n } +func (m *TopRURecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.KeyspaceName) + if l > 0 { + n += 1 + l + sovTopsqlAgent(uint64(l)) + } + l = len(m.User) + if l > 0 { + n += 1 + l + sovTopsqlAgent(uint64(l)) + } + l = len(m.SqlDigest) + if l > 0 { + n += 1 + l + sovTopsqlAgent(uint64(l)) + } + l = len(m.PlanDigest) + if l > 0 { + n += 1 + l + sovTopsqlAgent(uint64(l)) + } + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovTopsqlAgent(uint64(l)) + } + } + return n +} + +func (m *TopRURecordItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TimestampSec != 0 { + n += 1 + sovTopsqlAgent(uint64(m.TimestampSec)) + } + if m.TotalRu != 0 { + n += 9 + } + if m.ExecCount != 0 { + n += 1 + sovTopsqlAgent(uint64(m.ExecCount)) + } + if m.ExecDuration != 0 { + n += 1 + sovTopsqlAgent(uint64(m.ExecDuration)) + } + return n +} + func (m *TopSQLRecordItem) Size() (n int) { if m == nil { return 0 @@ -1470,6 +1965,12 @@ func (m *TopSQLSubRequest) Size() (n int) { } var l int _ = l + if m.EnableTopRu { + n += 2 + } + if m.ReportInterval != 0 { + n += 1 + sovTopsqlAgent(uint64(m.ReportInterval)) + } return n } @@ -1519,16 +2020,214 @@ func (m *TopSQLSubResponse_PlanMeta) Size() (n int) { l = m.PlanMeta.Size() n += 1 + l + sovTopsqlAgent(uint64(l)) } - return n -} + return n +} +func (m *TopSQLSubResponse_RuRecord) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RuRecord != nil { + l = m.RuRecord.Size() + n += 1 + l + sovTopsqlAgent(uint64(l)) + } + return n +} + +func sovTopsqlAgent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTopsqlAgent(x uint64) (n int) { + return sovTopsqlAgent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *TopSQLRecord) 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 ErrIntOverflowTopsqlAgent + } + 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: TopSQLRecord: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopSQLRecord: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SqlDigest", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SqlDigest = append(m.SqlDigest[:0], dAtA[iNdEx:postIndex]...) + if m.SqlDigest == nil { + m.SqlDigest = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PlanDigest", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PlanDigest = append(m.PlanDigest[:0], dAtA[iNdEx:postIndex]...) + if m.PlanDigest == nil { + m.PlanDigest = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &TopSQLRecordItem{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyspaceName", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyspaceName = append(m.KeyspaceName[:0], dAtA[iNdEx:postIndex]...) + if m.KeyspaceName == nil { + m.KeyspaceName = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopsqlAgent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func sovTopsqlAgent(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTopsqlAgent(x uint64) (n int) { - return sovTopsqlAgent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *TopSQLRecord) Unmarshal(dAtA []byte) error { +func (m *TopRURecord) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1551,13 +2250,79 @@ func (m *TopSQLRecord) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TopSQLRecord: wiretype end group for non-group") + return fmt.Errorf("proto: TopRURecord: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TopSQLRecord: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TopRURecord: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyspaceName", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyspaceName = append(m.KeyspaceName[:0], dAtA[iNdEx:postIndex]...) + if m.KeyspaceName == nil { + m.KeyspaceName = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + 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 ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SqlDigest", wireType) } @@ -1591,7 +2356,7 @@ func (m *TopSQLRecord) Unmarshal(dAtA []byte) error { m.SqlDigest = []byte{} } iNdEx = postIndex - case 2: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PlanDigest", wireType) } @@ -1625,7 +2390,7 @@ func (m *TopSQLRecord) Unmarshal(dAtA []byte) error { m.PlanDigest = []byte{} } iNdEx = postIndex - case 3: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } @@ -1654,16 +2419,66 @@ func (m *TopSQLRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, &TopSQLRecordItem{}) + m.Items = append(m.Items, &TopRURecordItem{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyspaceName", wireType) + default: + iNdEx = preIndex + skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) + if err != nil { + return err } - var byteLen int + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopsqlAgent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TopRURecordItem) 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 ErrIntOverflowTopsqlAgent + } + 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: TopRURecordItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopRURecordItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimestampSec", wireType) + } + m.TimestampSec = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTopsqlAgent @@ -1673,26 +2488,60 @@ func (m *TopSQLRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.TimestampSec |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTopsqlAgent - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTopsqlAgent + case 2: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalRu", wireType) } - if postIndex > l { + var v uint64 + if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } - m.KeyspaceName = append(m.KeyspaceName[:0], dAtA[iNdEx:postIndex]...) - if m.KeyspaceName == nil { - m.KeyspaceName = []byte{} + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + m.TotalRu = float64(math.Float64frombits(v)) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecCount", wireType) + } + m.ExecCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecDuration", wireType) + } + m.ExecDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) @@ -2441,6 +3290,45 @@ func (m *TopSQLSubRequest) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: TopSQLSubRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EnableTopRu", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.EnableTopRu = bool(v != 0) + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReportInterval", wireType) + } + m.ReportInterval = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReportInterval |= ReportInterval(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) @@ -2596,6 +3484,41 @@ func (m *TopSQLSubResponse) Unmarshal(dAtA []byte) error { } m.RespOneof = &TopSQLSubResponse_PlanMeta{v} iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RuRecord", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TopRURecord{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.RespOneof = &TopSQLSubResponse_RuRecord{v} + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) diff --git a/proto/topsql_agent.proto b/proto/topsql_agent.proto index 96dd3711..1f863972 100644 --- a/proto/topsql_agent.proto +++ b/proto/topsql_agent.proto @@ -26,6 +26,8 @@ service TopSQLAgent { // ReportPlanMeta reports plan meta to the agent. // The agent should deal with plan meta similarly to SQL meta. rpc ReportPlanMeta(stream PlanMeta) returns (EmptyResponse) {} + // ReportTopRURecords is called periodically to save the in-memory TopRU records. + rpc ReportTopRURecords(stream TopRURecord) returns (EmptyResponse) {} } message TopSQLRecord { @@ -35,6 +37,23 @@ message TopSQLRecord { bytes keyspace_name = 4; } +// TopRURecord represents RU statistics for a single (user, sql_digest, plan_digest) combination. +message TopRURecord { + bytes keyspace_name = 1; + string user = 2; + bytes sql_digest = 3; + bytes plan_digest = 4; + repeated TopRURecordItem items = 5; +} + +// TopRURecordItem represents statistics within a single time bucket. +message TopRURecordItem { + uint64 timestamp_sec = 1; // timestamp in second + double total_ru = 2; // cumulative RU consumption (RRU + WRU) + uint64 exec_count = 3; // execution count + uint64 exec_duration = 4; // cumulative execution time (nanoseconds) +} + message TopSQLRecordItem { uint64 timestamp_sec = 1; // timestamp in second uint32 cpu_time_ms = 2; // this value can be greater than 1000 when counting concurrent running SQL queries @@ -86,12 +105,25 @@ service TopSQLPubSub { rpc Subscribe(TopSQLSubRequest) returns (stream TopSQLSubResponse) {} } -message TopSQLSubRequest {} +enum ReportInterval { + REPORT_INTERVAL_UNSPECIFIED = 0; + REPORT_INTERVAL_15S = 15; + REPORT_INTERVAL_30S = 30; + REPORT_INTERVAL_60S = 60; +} + +message TopSQLSubRequest { + // enable_top_ru controls TopRU collection and reporting. + bool enable_top_ru = 1; + // report_interval controls report interval, options: 15s/30s/60s. + ReportInterval report_interval = 2; +} message TopSQLSubResponse { oneof resp_oneof { TopSQLRecord record = 1; SQLMeta sql_meta = 2; PlanMeta plan_meta = 3; + TopRURecord ru_record = 4; } } From 6d4573fbc071dfa2ba6ebb55e132e19a34ce7696 Mon Sep 17 00:00:00 2001 From: Lynn Date: Mon, 2 Feb 2026 13:24:49 +0800 Subject: [PATCH 2/3] *: add CollectorType --- go-tipb/topsql_agent.pb.go | 490 +++++++++++++++++++++++++++++-------- proto/topsql_agent.proto | 28 ++- 2 files changed, 410 insertions(+), 108 deletions(-) diff --git a/go-tipb/topsql_agent.pb.go b/go-tipb/topsql_agent.pb.go index 16eacfbe..af0d3925 100644 --- a/go-tipb/topsql_agent.pb.go +++ b/go-tipb/topsql_agent.pb.go @@ -30,6 +30,34 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type CollectorType int32 + +const ( + CollectorType_COLLECTOR_TYPE_UNSPECIFIED CollectorType = 0 + CollectorType_COLLECTOR_TYPE_TOPSQL CollectorType = 1 + CollectorType_COLLECTOR_TYPE_TOPRU CollectorType = 2 +) + +var CollectorType_name = map[int32]string{ + 0: "COLLECTOR_TYPE_UNSPECIFIED", + 1: "COLLECTOR_TYPE_TOPSQL", + 2: "COLLECTOR_TYPE_TOPRU", +} + +var CollectorType_value = map[string]int32{ + "COLLECTOR_TYPE_UNSPECIFIED": 0, + "COLLECTOR_TYPE_TOPSQL": 1, + "COLLECTOR_TYPE_TOPRU": 2, +} + +func (x CollectorType) String() string { + return proto.EnumName(CollectorType_name, int32(x)) +} + +func (CollectorType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_1b19f3a2fcd6965e, []int{0} +} + type ReportInterval int32 const ( @@ -58,7 +86,7 @@ func (x ReportInterval) String() string { } func (ReportInterval) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{0} + return fileDescriptor_1b19f3a2fcd6965e, []int{1} } type TopSQLRecord struct { @@ -560,18 +588,70 @@ func (m *EmptyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo +// TopRU-only options +type TopRUConfig struct { + // allowed: 15/30/60; server validates and applies default if 0 + ReportIntervalSeconds ReportInterval `protobuf:"varint,1,opt,name=report_interval_seconds,json=reportIntervalSeconds,proto3,enum=tipb.ReportInterval" json:"report_interval_seconds,omitempty"` +} + +func (m *TopRUConfig) Reset() { *m = TopRUConfig{} } +func (m *TopRUConfig) String() string { return proto.CompactTextString(m) } +func (*TopRUConfig) ProtoMessage() {} +func (*TopRUConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_1b19f3a2fcd6965e, []int{7} +} +func (m *TopRUConfig) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TopRUConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TopRUConfig.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TopRUConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TopRUConfig.Merge(m, src) +} +func (m *TopRUConfig) XXX_Size() int { + return m.Size() +} +func (m *TopRUConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TopRUConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_TopRUConfig proto.InternalMessageInfo + +func (m *TopRUConfig) GetReportIntervalSeconds() ReportInterval { + if m != nil { + return m.ReportIntervalSeconds + } + return ReportInterval_REPORT_INTERVAL_UNSPECIFIED +} + type TopSQLSubRequest struct { - // enable_top_ru controls TopRU collection and reporting. - EnableTopRu bool `protobuf:"varint,1,opt,name=enable_top_ru,json=enableTopRu,proto3" json:"enable_top_ru,omitempty"` - // report_interval controls report interval, options: 15s/30s/60s. - ReportInterval ReportInterval `protobuf:"varint,2,opt,name=report_interval,json=reportInterval,proto3,enum=tipb.ReportInterval" json:"report_interval,omitempty"` + // Semantics: + // - collectors empty => default enable TOPSQL + // - collectors non-empty => authoritative (only those enabled) + // Examples: + // - TOPSQL only: collectors=[TOPSQL] (or empty) + // - TOPRU only: collectors=[TOPRU] + // - both: collectors=[TOPSQL, TOPRU] + Collectors []CollectorType `protobuf:"varint,1,rep,packed,name=collectors,proto3,enum=tipb.CollectorType" json:"collectors,omitempty"` + // Only used when COLLECTOR_TYPE_TOPRU is present in collectors. + Topru *TopRUConfig `protobuf:"bytes,2,opt,name=topru,proto3" json:"topru,omitempty"` } func (m *TopSQLSubRequest) Reset() { *m = TopSQLSubRequest{} } func (m *TopSQLSubRequest) String() string { return proto.CompactTextString(m) } func (*TopSQLSubRequest) ProtoMessage() {} func (*TopSQLSubRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{7} + return fileDescriptor_1b19f3a2fcd6965e, []int{8} } func (m *TopSQLSubRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -600,18 +680,18 @@ func (m *TopSQLSubRequest) XXX_DiscardUnknown() { var xxx_messageInfo_TopSQLSubRequest proto.InternalMessageInfo -func (m *TopSQLSubRequest) GetEnableTopRu() bool { +func (m *TopSQLSubRequest) GetCollectors() []CollectorType { if m != nil { - return m.EnableTopRu + return m.Collectors } - return false + return nil } -func (m *TopSQLSubRequest) GetReportInterval() ReportInterval { +func (m *TopSQLSubRequest) GetTopru() *TopRUConfig { if m != nil { - return m.ReportInterval + return m.Topru } - return ReportInterval_REPORT_INTERVAL_UNSPECIFIED + return nil } type TopSQLSubResponse struct { @@ -627,7 +707,7 @@ func (m *TopSQLSubResponse) Reset() { *m = TopSQLSubResponse{} } func (m *TopSQLSubResponse) String() string { return proto.CompactTextString(m) } func (*TopSQLSubResponse) ProtoMessage() {} func (*TopSQLSubResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1b19f3a2fcd6965e, []int{8} + return fileDescriptor_1b19f3a2fcd6965e, []int{9} } func (m *TopSQLSubResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -726,6 +806,7 @@ func (*TopSQLSubResponse) XXX_OneofWrappers() []interface{} { } func init() { + proto.RegisterEnum("tipb.CollectorType", CollectorType_name, CollectorType_value) proto.RegisterEnum("tipb.ReportInterval", ReportInterval_name, ReportInterval_value) proto.RegisterType((*TopSQLRecord)(nil), "tipb.TopSQLRecord") proto.RegisterType((*TopRURecord)(nil), "tipb.TopRURecord") @@ -735,6 +816,7 @@ func init() { proto.RegisterType((*SQLMeta)(nil), "tipb.SQLMeta") proto.RegisterType((*PlanMeta)(nil), "tipb.PlanMeta") proto.RegisterType((*EmptyResponse)(nil), "tipb.EmptyResponse") + proto.RegisterType((*TopRUConfig)(nil), "tipb.TopRUConfig") proto.RegisterType((*TopSQLSubRequest)(nil), "tipb.TopSQLSubRequest") proto.RegisterType((*TopSQLSubResponse)(nil), "tipb.TopSQLSubResponse") } @@ -742,72 +824,77 @@ func init() { func init() { proto.RegisterFile("topsql_agent.proto", fileDescriptor_1b19f3a2fcd6965e) } var fileDescriptor_1b19f3a2fcd6965e = []byte{ - // 1038 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xc1, 0x6f, 0x1b, 0xc5, - 0x17, 0xf6, 0xc6, 0x4e, 0x62, 0x3f, 0xdb, 0xb1, 0x33, 0x49, 0x9a, 0xfc, 0xf2, 0x13, 0x6e, 0x65, - 0x04, 0x44, 0x6d, 0x71, 0x53, 0x47, 0x14, 0x8a, 0x40, 0x6a, 0xd3, 0x18, 0xc5, 0x22, 0x75, 0x9d, - 0xd9, 0x14, 0x71, 0x5b, 0xad, 0xd7, 0x43, 0xb4, 0xca, 0xee, 0xce, 0x7a, 0x67, 0x26, 0x10, 0xc4, - 0x9d, 0x2b, 0x17, 0x24, 0x0e, 0x5c, 0xb8, 0x71, 0x45, 0xfc, 0x13, 0x1c, 0x7b, 0xec, 0x81, 0x03, - 0x4a, 0x24, 0xfe, 0x0e, 0x34, 0x6f, 0x77, 0x5d, 0xdb, 0xeb, 0xa8, 0xb9, 0xed, 0x7e, 0xef, 0xfb, - 0xde, 0x7c, 0xef, 0xbd, 0x79, 0x5e, 0x03, 0x91, 0x3c, 0x14, 0x23, 0xcf, 0xb2, 0x4f, 0x59, 0x20, - 0x5b, 0x61, 0xc4, 0x25, 0x27, 0x05, 0xe9, 0x86, 0x83, 0xed, 0xf5, 0x53, 0x7e, 0xca, 0x11, 0x78, - 0xa0, 0x9f, 0xe2, 0xd8, 0x76, 0x2d, 0x52, 0x42, 0xe2, 0x63, 0x0c, 0x34, 0x7f, 0x33, 0xa0, 0x72, - 0xc2, 0x43, 0xf3, 0xf8, 0x88, 0x32, 0x87, 0x47, 0x43, 0xf2, 0x0e, 0x80, 0x4e, 0x38, 0x74, 0x4f, - 0x99, 0x90, 0x5b, 0xc6, 0x1d, 0x63, 0xa7, 0x42, 0x4b, 0x62, 0xe4, 0x1d, 0x20, 0x40, 0x6e, 0x43, - 0x39, 0xf4, 0xec, 0x20, 0x8d, 0x2f, 0x60, 0x1c, 0x34, 0x94, 0x10, 0xee, 0xc3, 0xa2, 0x2b, 0x99, - 0x2f, 0xb6, 0xf2, 0x77, 0xf2, 0x3b, 0xe5, 0xf6, 0xad, 0x96, 0x76, 0xd3, 0x9a, 0x3c, 0xa2, 0x2b, - 0x99, 0x4f, 0x63, 0x12, 0x79, 0x17, 0xaa, 0x67, 0xec,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 0x40, 0xc9, 0x54, 0x03, 0xe1, 0x44, 0xee, 0x80, 0x91, 0xa9, 0x2f, 0xfb, 0x9b, 0xeb, - 0xbf, 0xbd, 0x99, 0xc1, 0xd3, 0x8c, 0xbb, 0xc6, 0xfe, 0xe3, 0xd7, 0xbf, 0x17, 0x8d, 0xbf, 0x2e, - 0x1b, 0xc6, 0xab, 0xcb, 0x86, 0xf1, 0xcf, 0x65, 0xc3, 0xf8, 0xe9, 0xaa, 0x91, 0xfb, 0xe5, 0xaa, - 0x91, 0x7b, 0x75, 0xd5, 0xc8, 0xbd, 0xbe, 0x6a, 0xe4, 0x60, 0xc3, 0xe1, 0x7e, 0x2b, 0x74, 0x83, - 0x53, 0xc7, 0x0e, 0x5b, 0xd2, 0x1d, 0x0e, 0x30, 0x5d, 0xdf, 0x18, 0x2c, 0xe1, 0x1f, 0x96, 0xbd, - 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf7, 0xb5, 0xff, 0xc2, 0xf3, 0x08, 0x00, 0x00, + // 1119 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xf7, 0xc6, 0x4e, 0x62, 0x3f, 0xdb, 0xb1, 0x33, 0xb1, 0x9b, 0xd4, 0x5f, 0x7d, 0xdd, 0xca, + 0x08, 0x1a, 0xa5, 0xc5, 0x4d, 0x1d, 0x51, 0x28, 0xe2, 0xd0, 0xc6, 0x31, 0x8a, 0x85, 0xeb, 0x38, + 0xb3, 0x0e, 0x02, 0x71, 0x58, 0xad, 0xd7, 0x53, 0x6b, 0x95, 0xdd, 0x9d, 0xf5, 0xce, 0x6c, 0xc0, + 0x88, 0x3b, 0x57, 0x2e, 0x48, 0x1c, 0xb8, 0x70, 0xe3, 0x8a, 0xf8, 0x27, 0x38, 0xf6, 0xd8, 0x03, + 0x07, 0x94, 0x48, 0xfc, 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0x32, 0xd6, 0x96, 0x1d, 0xd2, 0xd2, 0xa1, 0x1a, + 0x9a, 0xfb, 0x8b, 0x7e, 0xb7, 0xd2, 0x5c, 0x82, 0x62, 0xc7, 0x76, 0xf9, 0x0c, 0x13, 0xe6, 0x52, + 0x87, 0x91, 0xc6, 0x37, 0xe1, 0x9f, 0xa9, 0x4d, 0x9d, 0x57, 0xe6, 0x04, 0xf5, 0x60, 0xdb, 0x23, + 0x2e, 0xf5, 0x78, 0x50, 0xa4, 0x0b, 0x51, 0x24, 0x62, 0x50, 0x67, 0xcc, 0x64, 0x4a, 0x1b, 0xad, + 0x4a, 0x30, 0xde, 0x58, 0x92, 0xba, 0x21, 0x07, 0x57, 0xbd, 0x85, 0x6f, 0x35, 0x70, 0x69, 0xb8, + 0xd1, 0xa2, 0xaa, 0xfe, 0x08, 0x93, 0xa9, 0x2f, 0xea, 0x70, 0x00, 0x60, 0x50, 0xcb, 0x22, 0x06, + 0xa7, 0x9e, 0x08, 0x9a, 0xde, 0xdd, 0x68, 0x6d, 0x05, 0x41, 0xdb, 0x11, 0x3e, 0x9c, 0xb9, 0x04, + 0xc7, 0x68, 0xe8, 0x01, 0xac, 0x72, 0xea, 0x86, 0xbf, 0x93, 0x7c, 0x6b, 0x33, 0xf6, 0xdf, 0x0a, + 0x84, 0xe3, 0xc0, 0xde, 0xf8, 0x5b, 0x81, 0xcd, 0xd8, 0x95, 0x41, 0x92, 0xe8, 0x11, 0xac, 0x79, + 0x72, 0x13, 0x65, 0x12, 0xf9, 0x16, 0x4a, 0xee, 0xe8, 0x71, 0x0a, 0x87, 0x1c, 0xb4, 0x07, 0x59, + 0x31, 0x6a, 0x36, 0xe1, 0x7a, 0x78, 0x5f, 0x31, 0xe0, 0x87, 0xb3, 0x78, 0x9c, 0xc2, 0xeb, 0x6c, + 0x6a, 0xc9, 0xb6, 0x7f, 0x08, 0x39, 0xd9, 0x76, 0x49, 0x4e, 0x4b, 0xf2, 0x46, 0x40, 0x8e, 0x26, +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x14, 0xf3, 0x45, 0x5f, 0x6a, 0xef, 0xcd, 0xae, 0xcf, 0x01, 0xcd, 0x75, + 0x47, 0xad, 0x65, 0x28, 0xd9, 0xee, 0x1b, 0x23, 0xb4, 0x06, 0xd1, 0xcb, 0x66, 0xe0, 0x8f, 0x54, + 0x7f, 0x84, 0x9e, 0x43, 0x4e, 0xf5, 0x47, 0xcc, 0xf0, 0xcc, 0x11, 0x41, 0x0b, 0xef, 0x92, 0xb7, + 0xfb, 0x55, 0xdb, 0x4e, 0xe0, 0x51, 0xc4, 0x7d, 0xe5, 0xf0, 0xd9, 0x9b, 0xdf, 0xb3, 0xca, 0x5f, + 0x97, 0x75, 0xe5, 0xf5, 0x65, 0x5d, 0xf9, 0xe7, 0xb2, 0xae, 0xfc, 0x74, 0x55, 0x4f, 0xfd, 0x72, + 0x55, 0x4f, 0xbd, 0xbe, 0xaa, 0xa7, 0xde, 0x5c, 0xd5, 0x53, 0x50, 0x35, 0xa8, 0xdd, 0x74, 0x4d, + 0x67, 0x62, 0xe8, 0x6e, 0x93, 0x9b, 0xe3, 0x91, 0x0c, 0x37, 0x50, 0x46, 0x6b, 0xf2, 0xb9, 0x75, + 0xf0, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0xfa, 0x06, 0x9f, 0xb1, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1619,6 +1706,34 @@ func (m *EmptyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *TopRUConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopRUConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopRUConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ReportIntervalSeconds != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ReportIntervalSeconds)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *TopSQLSubRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1639,20 +1754,35 @@ func (m *TopSQLSubRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ReportInterval != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ReportInterval)) + if m.Topru != nil { + { + size, err := m.Topru.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTopsqlAgent(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if m.EnableTopRu { - i-- - if m.EnableTopRu { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(m.Collectors) > 0 { + dAtA3 := make([]byte, len(m.Collectors)*10) + var j2 int + for _, num := range m.Collectors { + for num >= 1<<7 { + dAtA3[j2] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j2++ + } + dAtA3[j2] = uint8(num) + j2++ } + i -= j2 + copy(dAtA[i:], dAtA3[:j2]) + i = encodeVarintTopsqlAgent(dAtA, i, uint64(j2)) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1959,17 +2089,34 @@ func (m *EmptyResponse) Size() (n int) { return n } +func (m *TopRUConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ReportIntervalSeconds != 0 { + n += 1 + sovTopsqlAgent(uint64(m.ReportIntervalSeconds)) + } + return n +} + func (m *TopSQLSubRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.EnableTopRu { - n += 2 + if len(m.Collectors) > 0 { + l = 0 + for _, e := range m.Collectors { + l += sovTopsqlAgent(uint64(e)) + } + n += 1 + sovTopsqlAgent(uint64(l)) + l } - if m.ReportInterval != 0 { - n += 1 + sovTopsqlAgent(uint64(m.ReportInterval)) + if m.Topru != nil { + l = m.Topru.Size() + n += 1 + l + sovTopsqlAgent(uint64(l)) } return n } @@ -3261,7 +3408,7 @@ func (m *EmptyResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *TopSQLSubRequest) Unmarshal(dAtA []byte) error { +func (m *TopRUConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3284,17 +3431,17 @@ func (m *TopSQLSubRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TopSQLSubRequest: wiretype end group for non-group") + return fmt.Errorf("proto: TopRUConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TopSQLSubRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TopRUConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EnableTopRu", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReportIntervalSeconds", wireType) } - var v int + m.ReportIntervalSeconds = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTopsqlAgent @@ -3304,17 +3451,135 @@ func (m *TopSQLSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.ReportIntervalSeconds |= ReportInterval(b&0x7F) << shift if b < 0x80 { break } } - m.EnableTopRu = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTopsqlAgent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TopSQLSubRequest) 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 ErrIntOverflowTopsqlAgent + } + 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: TopSQLSubRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopSQLSubRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v CollectorType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= CollectorType(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Collectors = append(m.Collectors, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + if elementCount != 0 && len(m.Collectors) == 0 { + m.Collectors = make([]CollectorType, 0, elementCount) + } + for iNdEx < postIndex { + var v CollectorType + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTopsqlAgent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= CollectorType(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Collectors = append(m.Collectors, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Collectors", wireType) + } case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReportInterval", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topru", wireType) } - m.ReportInterval = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTopsqlAgent @@ -3324,11 +3589,28 @@ func (m *TopSQLSubRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReportInterval |= ReportInterval(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthTopsqlAgent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTopsqlAgent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Topru == nil { + m.Topru = &TopRUConfig{} + } + if err := m.Topru.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTopsqlAgent(dAtA[iNdEx:]) diff --git a/proto/topsql_agent.proto b/proto/topsql_agent.proto index 1f863972..1a707d74 100644 --- a/proto/topsql_agent.proto +++ b/proto/topsql_agent.proto @@ -105,6 +105,13 @@ service TopSQLPubSub { rpc Subscribe(TopSQLSubRequest) returns (stream TopSQLSubResponse) {} } +enum CollectorType { + COLLECTOR_TYPE_UNSPECIFIED = 0; // For compatibility when this variable is not present. Defaults to COLLECTOR_TYPE_TOPSQL. + COLLECTOR_TYPE_TOPSQL = 1; + COLLECTOR_TYPE_TOPRU = 2; + // future: COLLECTOR_TYPE_XXX = 3; +} + enum ReportInterval { REPORT_INTERVAL_UNSPECIFIED = 0; REPORT_INTERVAL_15S = 15; @@ -112,11 +119,24 @@ enum ReportInterval { REPORT_INTERVAL_60S = 60; } +// TopRU-only options +message TopRUConfig { + // allowed: 15/30/60; server validates and applies default if 0 + ReportInterval report_interval_seconds = 1; +} + message TopSQLSubRequest { - // enable_top_ru controls TopRU collection and reporting. - bool enable_top_ru = 1; - // report_interval controls report interval, options: 15s/30s/60s. - ReportInterval report_interval = 2; + // Semantics: + // - collectors empty => default enable TOPSQL + // - collectors non-empty => authoritative (only those enabled) + // Examples: + // - TOPSQL only: collectors=[TOPSQL] (or empty) + // - TOPRU only: collectors=[TOPRU] + // - both: collectors=[TOPSQL, TOPRU] + repeated CollectorType collectors = 1; + + // Only used when COLLECTOR_TYPE_TOPRU is present in collectors. + TopRUConfig topru = 2; } message TopSQLSubResponse { From 7652bfed53c0778e8eccef51a3e63ddd28112c83 Mon Sep 17 00:00:00 2001 From: Lynn Date: Tue, 10 Feb 2026 18:09:43 +0800 Subject: [PATCH 3/3] *: rename ReportInterval to ItemInterval --- go-tipb/topsql_agent.pb.go | 202 ++++++++++++++++++------------------- proto/topsql_agent.proto | 12 +-- scripts/proto.lock | 133 +++++++++++++++++++++++- 3 files changed, 238 insertions(+), 109 deletions(-) diff --git a/go-tipb/topsql_agent.pb.go b/go-tipb/topsql_agent.pb.go index af0d3925..14960381 100644 --- a/go-tipb/topsql_agent.pb.go +++ b/go-tipb/topsql_agent.pb.go @@ -58,34 +58,34 @@ func (CollectorType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_1b19f3a2fcd6965e, []int{0} } -type ReportInterval int32 +type ItemInterval int32 const ( - ReportInterval_REPORT_INTERVAL_UNSPECIFIED ReportInterval = 0 - ReportInterval_REPORT_INTERVAL_15S ReportInterval = 15 - ReportInterval_REPORT_INTERVAL_30S ReportInterval = 30 - ReportInterval_REPORT_INTERVAL_60S ReportInterval = 60 + ItemInterval_ITEM_INTERVAL_UNSPECIFIED ItemInterval = 0 + ItemInterval_ITEM_INTERVAL_15S ItemInterval = 15 + ItemInterval_ITEM_INTERVAL_30S ItemInterval = 30 + ItemInterval_ITEM_INTERVAL_60S ItemInterval = 60 ) -var ReportInterval_name = map[int32]string{ - 0: "REPORT_INTERVAL_UNSPECIFIED", - 15: "REPORT_INTERVAL_15S", - 30: "REPORT_INTERVAL_30S", - 60: "REPORT_INTERVAL_60S", +var ItemInterval_name = map[int32]string{ + 0: "ITEM_INTERVAL_UNSPECIFIED", + 15: "ITEM_INTERVAL_15S", + 30: "ITEM_INTERVAL_30S", + 60: "ITEM_INTERVAL_60S", } -var ReportInterval_value = map[string]int32{ - "REPORT_INTERVAL_UNSPECIFIED": 0, - "REPORT_INTERVAL_15S": 15, - "REPORT_INTERVAL_30S": 30, - "REPORT_INTERVAL_60S": 60, +var ItemInterval_value = map[string]int32{ + "ITEM_INTERVAL_UNSPECIFIED": 0, + "ITEM_INTERVAL_15S": 15, + "ITEM_INTERVAL_30S": 30, + "ITEM_INTERVAL_60S": 60, } -func (x ReportInterval) String() string { - return proto.EnumName(ReportInterval_name, int32(x)) +func (x ItemInterval) String() string { + return proto.EnumName(ItemInterval_name, int32(x)) } -func (ReportInterval) EnumDescriptor() ([]byte, []int) { +func (ItemInterval) EnumDescriptor() ([]byte, []int) { return fileDescriptor_1b19f3a2fcd6965e, []int{1} } @@ -591,7 +591,7 @@ var xxx_messageInfo_EmptyResponse proto.InternalMessageInfo // TopRU-only options type TopRUConfig struct { // allowed: 15/30/60; server validates and applies default if 0 - ReportIntervalSeconds ReportInterval `protobuf:"varint,1,opt,name=report_interval_seconds,json=reportIntervalSeconds,proto3,enum=tipb.ReportInterval" json:"report_interval_seconds,omitempty"` + ItemIntervalSeconds ItemInterval `protobuf:"varint,1,opt,name=item_interval_seconds,json=itemIntervalSeconds,proto3,enum=tipb.ItemInterval" json:"item_interval_seconds,omitempty"` } func (m *TopRUConfig) Reset() { *m = TopRUConfig{} } @@ -627,11 +627,11 @@ func (m *TopRUConfig) XXX_DiscardUnknown() { var xxx_messageInfo_TopRUConfig proto.InternalMessageInfo -func (m *TopRUConfig) GetReportIntervalSeconds() ReportInterval { +func (m *TopRUConfig) GetItemIntervalSeconds() ItemInterval { if m != nil { - return m.ReportIntervalSeconds + return m.ItemIntervalSeconds } - return ReportInterval_REPORT_INTERVAL_UNSPECIFIED + return ItemInterval_ITEM_INTERVAL_UNSPECIFIED } type TopSQLSubRequest struct { @@ -807,7 +807,7 @@ func (*TopSQLSubResponse) XXX_OneofWrappers() []interface{} { func init() { proto.RegisterEnum("tipb.CollectorType", CollectorType_name, CollectorType_value) - proto.RegisterEnum("tipb.ReportInterval", ReportInterval_name, ReportInterval_value) + proto.RegisterEnum("tipb.ItemInterval", ItemInterval_name, ItemInterval_value) proto.RegisterType((*TopSQLRecord)(nil), "tipb.TopSQLRecord") proto.RegisterType((*TopRURecord)(nil), "tipb.TopRURecord") proto.RegisterType((*TopRURecordItem)(nil), "tipb.TopRURecordItem") @@ -824,77 +824,77 @@ func init() { func init() { proto.RegisterFile("topsql_agent.proto", fileDescriptor_1b19f3a2fcd6965e) } var fileDescriptor_1b19f3a2fcd6965e = []byte{ - // 1119 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xcf, 0x6f, 0x1b, 0xc5, - 0x17, 0xf7, 0xc6, 0x4e, 0x62, 0x3f, 0xdb, 0xb1, 0x33, 0xb1, 0x9b, 0xd4, 0x5f, 0x7d, 0xdd, 0xca, - 0x08, 0x1a, 0xa5, 0xc5, 0x4d, 0x1d, 0x51, 0x28, 0xe2, 0xd0, 0xc6, 0x31, 0x8a, 0x85, 0xeb, 0x38, - 0xb3, 0x0e, 0x02, 0x71, 0x58, 0xad, 0xd7, 0x53, 0x6b, 0x95, 0xdd, 0x9d, 0xf5, 0xce, 0x6c, 0xc0, - 0x88, 0x3b, 0x57, 0x2e, 0x48, 0x1c, 0xb8, 0x70, 0xe3, 0x8a, 0xf8, 0x27, 0x38, 0xf6, 0xd8, 0x03, - 0x07, 0x94, 0x48, 0xfc, 0x1d, 0x68, 0x66, 0x77, 0xdd, 0xb5, 0x37, 0x51, 0x73, 0x9b, 0xfd, 0xbc, - 0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e, 0xb7, 0xd2, 0x5c, 0x82, 0x62, 0xc7, 0x76, 0xf9, 0x0c, 0x13, 0xe6, 0x52, - 0x87, 0x91, 0xc6, 0x37, 0xe1, 0x9f, 0xa9, 0x4d, 0x9d, 0x57, 0xe6, 0x04, 0xf5, 0x60, 0xdb, 0x23, - 0x2e, 0xf5, 0x78, 0x50, 0xa4, 0x0b, 0x51, 0x24, 0x62, 0x50, 0x67, 0xcc, 0x64, 0x4a, 0x1b, 0xad, - 0x4a, 0x30, 0xde, 0x58, 0x92, 0xba, 0x21, 0x07, 0x57, 0xbd, 0x85, 0x6f, 0x35, 0x70, 0x69, 0xb8, - 0xd1, 0xa2, 0xaa, 0xfe, 0x08, 0x93, 0xa9, 0x2f, 0xea, 0x70, 0x00, 0x60, 0x50, 0xcb, 0x22, 0x06, - 0xa7, 0x9e, 0x08, 0x9a, 0xde, 0xdd, 0x68, 0x6d, 0x05, 0x41, 0xdb, 0x11, 0x3e, 0x9c, 0xb9, 0x04, - 0xc7, 0x68, 0xe8, 0x01, 0xac, 0x72, 0xea, 0x86, 0xbf, 0x93, 0x7c, 0x6b, 0x33, 0xf6, 0xdf, 0x0a, - 0x84, 0xe3, 0xc0, 0xde, 0xf8, 0x5b, 0x81, 0xcd, 0xd8, 0x95, 0x41, 0x92, 0xe8, 0x11, 0xac, 0x79, - 0x72, 0x13, 0x65, 0x12, 0xf9, 0x16, 0x4a, 0xee, 0xe8, 0x71, 0x0a, 0x87, 0x1c, 0xb4, 0x07, 0x59, - 0x31, 0x6a, 0x36, 0xe1, 0x7a, 0x78, 0x5f, 0x31, 0xe0, 0x87, 0xb3, 0x78, 0x9c, 0xc2, 0xeb, 0x6c, - 0x6a, 0xc9, 0xb6, 0x7f, 0x08, 0x39, 0xd9, 0x76, 0x49, 0x4e, 0x4b, 0xf2, 0x46, 0x40, 0x8e, 0x26, - 0xe3, 0x38, 0x85, 0xb3, 0x6e, 0x34, 0x25, 0xfb, 0x90, 0xf3, 0x7c, 0x2d, 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47, 0xad, 0x65, 0x28, 0xd9, 0xee, 0x1b, 0x23, 0xb4, 0x06, 0xd1, 0xcb, 0x66, 0xe0, 0x8f, 0x54, - 0x7f, 0x84, 0x9e, 0x43, 0x4e, 0xf5, 0x47, 0xcc, 0xf0, 0xcc, 0x11, 0x41, 0x0b, 0xef, 0x92, 0xb7, - 0xfb, 0x55, 0xdb, 0x4e, 0xe0, 0x51, 0xc4, 0x7d, 0xe5, 0xf0, 0xd9, 0x9b, 0xdf, 0xb3, 0xca, 0x5f, - 0x97, 0x75, 0xe5, 0xf5, 0x65, 0x5d, 0xf9, 0xe7, 0xb2, 0xae, 0xfc, 0x74, 0x55, 0x4f, 0xfd, 0x72, - 0x55, 0x4f, 0xbd, 0xbe, 0xaa, 0xa7, 0xde, 0x5c, 0xd5, 0x53, 0x50, 0x35, 0xa8, 0xdd, 0x74, 0x4d, - 0x67, 0x62, 0xe8, 0x6e, 0x93, 0x9b, 0xe3, 0x91, 0x0c, 0x37, 0x50, 0x46, 0x6b, 0xf2, 0xb9, 0x75, - 0xf0, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0xfa, 0x06, 0x9f, 0xb1, 0x09, 0x00, 0x00, + // 1116 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x41, 0x6f, 0xdb, 0x46, + 0x13, 0x15, 0x2d, 0xd9, 0x96, 0x46, 0x92, 0x25, 0xaf, 0xad, 0xc4, 0x16, 0x10, 0x7d, 0x81, 0x3e, + 0xb4, 0x31, 0x9c, 0x54, 0x71, 0x64, 0x34, 0x6d, 0x8a, 0x1e, 0x12, 0xc9, 0x0a, 0x2c, 0x54, 0x96, + 0xe5, 0xa5, 0x5c, 0xb4, 0x27, 0x82, 0xa2, 0x36, 0x02, 0x61, 0x92, 0x4b, 0x71, 0x97, 0x6e, 0xd5, + 0x3f, 0xd0, 0x6b, 0x2f, 0x05,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, 0x6a, 0x44, 0x9f, 0x8f, 0xc5, 0x3e, 0xde, 0x9e, 0xf8, 0x02, 0x36, + 0x82, 0xc4, 0xf9, 0x62, 0x2f, 0x35, 0xf5, 0xf6, 0xd4, 0x97, 0x80, 0xe6, 0xba, 0xa3, 0x86, 0x32, + 0x94, 0x6c, 0xf2, 0xad, 0x15, 0x9a, 0x83, 0xe8, 0x4f, 0x66, 0xe0, 0x8f, 0x54, 0x7f, 0x84, 0x5e, + 0x42, 0x4e, 0xf5, 0x47, 0xcc, 0xf0, 0xcc, 0x11, 0x41, 0x0b, 0xff, 0x21, 0xef, 0xb7, 0xaa, 0x7a, + 0x3f, 0x81, 0x47, 0x15, 0x0f, 0x94, 0xd6, 0x8b, 0x77, 0xbf, 0x67, 0x95, 0xbf, 0xae, 0x6a, 0xca, + 0xdb, 0xab, 0x9a, 0xf2, 0xcf, 0x55, 0x4d, 0xf9, 0xe9, 0xba, 0x96, 0xfa, 0xe5, 0xba, 0x96, 0x7a, + 0x7b, 0x5d, 0x4b, 0xbd, 0xbb, 0xae, 0xa5, 0xa0, 0x62, 0x50, 0xbb, 0xe1, 0x9a, 0xce, 0xc4, 0xd0, + 0xdd, 0x06, 0x37, 0xc7, 0x23, 0x59, 0x6e, 0xa0, 0x8c, 0xd6, 0xe4, 0xef, 0xd5, 0xe1, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x3d, 0xfa, 0x34, 0x53, 0xa1, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1726,8 +1726,8 @@ func (m *TopRUConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ReportIntervalSeconds != 0 { - i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ReportIntervalSeconds)) + if m.ItemIntervalSeconds != 0 { + i = encodeVarintTopsqlAgent(dAtA, i, uint64(m.ItemIntervalSeconds)) i-- dAtA[i] = 0x8 } @@ -2095,8 +2095,8 @@ func (m *TopRUConfig) Size() (n int) { } var l int _ = l - if m.ReportIntervalSeconds != 0 { - n += 1 + sovTopsqlAgent(uint64(m.ReportIntervalSeconds)) + if m.ItemIntervalSeconds != 0 { + n += 1 + sovTopsqlAgent(uint64(m.ItemIntervalSeconds)) } return n } @@ -3439,9 +3439,9 @@ func (m *TopRUConfig) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReportIntervalSeconds", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ItemIntervalSeconds", wireType) } - m.ReportIntervalSeconds = 0 + m.ItemIntervalSeconds = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTopsqlAgent @@ -3451,7 +3451,7 @@ func (m *TopRUConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReportIntervalSeconds |= ReportInterval(b&0x7F) << shift + m.ItemIntervalSeconds |= ItemInterval(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/topsql_agent.proto b/proto/topsql_agent.proto index 1a707d74..44e4a320 100644 --- a/proto/topsql_agent.proto +++ b/proto/topsql_agent.proto @@ -112,17 +112,17 @@ enum CollectorType { // future: COLLECTOR_TYPE_XXX = 3; } -enum ReportInterval { - REPORT_INTERVAL_UNSPECIFIED = 0; - REPORT_INTERVAL_15S = 15; - REPORT_INTERVAL_30S = 30; - REPORT_INTERVAL_60S = 60; +enum ItemInterval { + ITEM_INTERVAL_UNSPECIFIED = 0; + ITEM_INTERVAL_15S = 15; + ITEM_INTERVAL_30S = 30; + ITEM_INTERVAL_60S = 60; } // TopRU-only options message TopRUConfig { // allowed: 15/30/60; server validates and applies default if 0 - ReportInterval report_interval_seconds = 1; + ItemInterval item_interval_seconds = 1; } message TopSQLSubRequest { diff --git a/scripts/proto.lock b/scripts/proto.lock index 13221eba..f0d22ba3 100644 --- a/scripts/proto.lock +++ b/scripts/proto.lock @@ -8367,6 +8367,44 @@ { "protopath": "topsql_agent.proto", "def": { + "enums": [ + { + "name": "CollectorType", + "enum_fields": [ + { + "name": "COLLECTOR_TYPE_UNSPECIFIED" + }, + { + "name": "COLLECTOR_TYPE_TOPSQL", + "integer": 1 + }, + { + "name": "COLLECTOR_TYPE_TOPRU", + "integer": 2 + } + ] + }, + { + "name": "ItemInterval", + "enum_fields": [ + { + "name": "ITEM_INTERVAL_UNSPECIFIED" + }, + { + "name": "ITEM_INTERVAL_15S", + "integer": 15 + }, + { + "name": "ITEM_INTERVAL_30S", + "integer": 30 + }, + { + "name": "ITEM_INTERVAL_60S", + "integer": 60 + } + ] + } + ], "messages": [ { "name": "TopSQLRecord", @@ -8394,6 +8432,62 @@ } ] }, + { + "name": "TopRURecord", + "fields": [ + { + "id": 1, + "name": "keyspace_name", + "type": "bytes" + }, + { + "id": 2, + "name": "user", + "type": "string" + }, + { + "id": 3, + "name": "sql_digest", + "type": "bytes" + }, + { + "id": 4, + "name": "plan_digest", + "type": "bytes" + }, + { + "id": 5, + "name": "items", + "type": "TopRURecordItem", + "is_repeated": true + } + ] + }, + { + "name": "TopRURecordItem", + "fields": [ + { + "id": 1, + "name": "timestamp_sec", + "type": "uint64" + }, + { + "id": 2, + "name": "total_ru", + "type": "double" + }, + { + "id": 3, + "name": "exec_count", + "type": "uint64" + }, + { + "id": 4, + "name": "exec_duration", + "type": "uint64" + } + ] + }, { "name": "TopSQLRecordItem", "fields": [ @@ -8498,7 +8592,30 @@ "name": "EmptyResponse" }, { - "name": "TopSQLSubRequest" + "name": "TopRUConfig", + "fields": [ + { + "id": 1, + "name": "item_interval_seconds", + "type": "ItemInterval" + } + ] + }, + { + "name": "TopSQLSubRequest", + "fields": [ + { + "id": 1, + "name": "collectors", + "type": "CollectorType", + "is_repeated": true + }, + { + "id": 2, + "name": "topru", + "type": "TopRUConfig" + } + ] }, { "name": "TopSQLSubResponse", @@ -8520,6 +8637,12 @@ "name": "plan_meta", "type": "PlanMeta", "oneof_parent": "resp_oneof" + }, + { + "id": 4, + "name": "ru_record", + "type": "TopRURecord", + "oneof_parent": "resp_oneof" } ] } @@ -8545,6 +8668,12 @@ "in_type": "PlanMeta", "out_type": "EmptyResponse", "in_streamed": true + }, + { + "name": "ReportTopRURecords", + "in_type": "TopRURecord", + "out_type": "EmptyResponse", + "in_streamed": true } ] }, @@ -8700,4 +8829,4 @@ } } ] -} \ No newline at end of file +}