实现集群看板

This commit is contained in:
GoEdgeLab
2021-07-05 11:37:10 +08:00
parent d4db125f9b
commit 78b9afba98
11 changed files with 2357 additions and 138 deletions

View File

@@ -12,4 +12,4 @@ message ServerDailyStat {
int64 countRequests = 6;
int64 countCachedRequests = 7;
int64 createdAt = 4;
}
}

View File

@@ -0,0 +1,11 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
// 统计看板
message ServerStatBoard {
int64 id = 1;
string name = 2;
bool isOn = 3;
}

View File

@@ -0,0 +1,13 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_metric_chart.proto";
// 统计看板条目
message ServerStatBoardChart {
int64 id = 1;
MetricChart metricChart = 30;
}

View File

@@ -24,6 +24,17 @@ service ServerDailyStatService {
// 上传统计
message UploadServerDailyStatsRequest {
repeated ServerDailyStat stats = 1;
repeated DomainStat domainStats = 2;
message DomainStat {
int64 serverId = 1;
string domain = 2;
int64 bytes = 3;
int64 cachedBytes = 4;
int64 countRequests = 5;
int64 countCachedRequests = 6;
int64 createdAt = 7;
}
}
// 按小时读取统计数据

View File

@@ -0,0 +1,77 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_server_stat_board.proto";
import "models/model_message_node_value.proto";
// 统计看板
service ServerStatBoardService {
// 读取所有看板
rpc findAllEnabledServerStatBoards (FindAllEnabledServerStatBoardsRequest) returns (FindAllEnabledServerStatBoardsResponse);
// 组合集群看板数据
rpc composeServerStatNodeClusterBoard (ComposeServerStatNodeClusterBoardRequest) returns (ComposeServerStatNodeClusterBoardResponse);
}
// 读取所有看板
message FindAllEnabledServerStatBoardsRequest {
int64 nodeClusterId = 1;
}
message FindAllEnabledServerStatBoardsResponse {
repeated ServerStatBoard serverStatBoards = 1;
}
// 组合集群看板数据
message ComposeServerStatNodeClusterBoardRequest {
int64 nodeClusterId = 1;
}
message ComposeServerStatNodeClusterBoardResponse {
int64 countActiveNodes = 1;
int64 countInactiveNodes = 2;
int64 countServers = 3;
int64 countUsers = 4;
repeated DailyTrafficStat dailyTrafficStats = 30;
repeated HourlyTrafficStat hourlyTrafficStats = 31;
repeated NodeStat topNodeStats = 32;
repeated DomainStat topDomainStats = 33;
repeated NodeValue cpuNodeValues = 34;
repeated NodeValue memoryNodeValues = 35;
repeated NodeValue loadNodeValues = 36;
message DailyTrafficStat {
string day = 1;
int64 bytes = 2;
int64 cachedBytes = 3;
int64 countRequests = 4;
int64 countCachedRequests = 5;
}
message HourlyTrafficStat {
string hour = 1;
int64 bytes = 2;
int64 cachedBytes = 3;
int64 countRequests = 4;
int64 countCachedRequests = 5;
}
message NodeStat {
int64 nodeId = 1;
string nodeName = 2;
int64 countRequests = 3;
int64 bytes = 4;
}
message DomainStat {
int64 serverId = 1;
string domain = 2;
int64 countRequests = 3;
int64 bytes = 4;
}
}

View File

@@ -0,0 +1,40 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/rpc_messages.proto";
import "models/model_server_stat_board_chart.proto";
// 统计看板条目
service ServerStatBoardChartService {
// 添加图表
rpc enableServerStatBoardChart (EnableServerStatBoardChartRequest) returns (RPCSuccess);
// 取消图表
rpc disableServerStatBoardChart (DisableServerStatBoardChartRequest) returns (RPCSuccess);
// 读取看板中的图表
rpc findAllEnabledServerStatBoardCharts (FindAllEnabledServerStatBoardChartsRequest) returns (FindAllEnabledServerStatBoardChartsResponse);
}
// 添加图表
message EnableServerStatBoardChartRequest {
int64 serverStatBoardId = 1;
int64 metricChartId = 2;
}
// 取消图表
message DisableServerStatBoardChartRequest {
int64 serverStatBoardId = 1;
int64 metricChartId = 2;
}
// 读取看板中的图表
message FindAllEnabledServerStatBoardChartsRequest {
int64 serverStatBoardId = 1;
}
message FindAllEnabledServerStatBoardChartsResponse {
repeated ServerStatBoardChart serverStatBoardCharts = 1;
}