124 lines
3.2 KiB
Protocol Buffer
124 lines
3.2 KiB
Protocol Buffer
// Copyright 2023 Greptime Team
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
syntax = "proto3";
|
|
|
|
package greptime.v1.meta;
|
|
|
|
option go_package = "github.com/GreptimeTeam/greptime-proto/go/greptime/v1/meta";
|
|
|
|
import "greptime/v1/meta/common.proto";
|
|
|
|
service Heartbeat {
|
|
// Heartbeat, there may be many contents of the heartbeat, such as:
|
|
// 1. Metadata to be registered to meta server and discoverable by other
|
|
// nodes.
|
|
// 2. Some performance metrics, such as Load, CPU usage, etc.
|
|
// 3. The number of computing tasks being executed.
|
|
rpc Heartbeat(stream HeartbeatRequest) returns (stream HeartbeatResponse) {}
|
|
|
|
// Ask leader's endpoint.
|
|
rpc AskLeader(AskLeaderRequest) returns (AskLeaderResponse) {}
|
|
}
|
|
|
|
message HeartbeatRequest {
|
|
RequestHeader header = 1;
|
|
|
|
// Self peer
|
|
Peer peer = 2;
|
|
// Leader node
|
|
bool is_leader = 3;
|
|
// Actually reported time interval
|
|
TimeInterval report_interval = 4;
|
|
// Node stat
|
|
NodeStat node_stat = 5;
|
|
// Region stats on this node
|
|
repeated RegionStat region_stats = 6;
|
|
// Follower nodes and stats, empty on follower nodes
|
|
repeated ReplicaStat replica_stats = 7;
|
|
MailboxMessage mailbox_message = 8;
|
|
}
|
|
|
|
message NodeStat {
|
|
// The read capacity units during this period
|
|
int64 rcus = 1;
|
|
// The write capacity units during this period
|
|
int64 wcus = 2;
|
|
// How many tables on this node
|
|
int64 table_num = 3;
|
|
// How many regions on this node
|
|
int64 region_num = 4;
|
|
|
|
double cpu_usage = 5;
|
|
double load = 6;
|
|
// Read disk IO on this node
|
|
double read_io_rate = 7;
|
|
// Write disk IO on this node
|
|
double write_io_rate = 8;
|
|
|
|
// Others
|
|
map<string, string> attrs = 100;
|
|
}
|
|
|
|
message RegionStat {
|
|
uint64 region_id = 1;
|
|
TableName table_name = 2;
|
|
// The read capacity units during this period
|
|
int64 rcus = 3;
|
|
// The write capacity units during this period
|
|
int64 wcus = 4;
|
|
// Approximate bytes of this region
|
|
int64 approximate_bytes = 5;
|
|
// Approximate number of rows in this region
|
|
int64 approximate_rows = 6;
|
|
|
|
// Others
|
|
map<string, string> attrs = 100;
|
|
}
|
|
|
|
message ReplicaStat {
|
|
Peer peer = 1;
|
|
bool in_sync = 2;
|
|
bool is_learner = 3;
|
|
}
|
|
|
|
message HeartbeatResponse {
|
|
ResponseHeader header = 1;
|
|
|
|
MailboxMessage mailbox_message = 2;
|
|
}
|
|
|
|
message AskLeaderRequest { RequestHeader header = 1; }
|
|
|
|
message AskLeaderResponse {
|
|
ResponseHeader header = 1;
|
|
|
|
Peer leader = 2;
|
|
}
|
|
|
|
message MailboxMessage {
|
|
// The id is used to associate request and response.
|
|
uint64 id = 1;
|
|
// The following information plays a bigger role in making messages traceable
|
|
// and facilitating debugging.
|
|
string subject = 2;
|
|
string from = 3;
|
|
string to = 4;
|
|
// The unix timestamp in milliseconds.
|
|
int64 timestamp_millis = 5;
|
|
|
|
// The message body.
|
|
oneof payload { string json = 6; }
|
|
}
|