2020-12-11 21:39:17 +08:00
|
|
|
|
syntax = "proto3";
|
|
|
|
|
|
option go_package = "./pb";
|
|
|
|
|
|
|
|
|
|
|
|
package pb;
|
|
|
|
|
|
|
2021-01-25 16:41:30 +08:00
|
|
|
|
import "models/model_server_daily_stat.proto";
|
|
|
|
|
|
import "models/rpc_messages.proto";
|
2020-12-11 21:39:17 +08:00
|
|
|
|
|
|
|
|
|
|
// 服务统计相关服务
|
|
|
|
|
|
service ServerDailyStatService {
|
|
|
|
|
|
// 上传统计
|
|
|
|
|
|
rpc uploadServerDailyStats (UploadServerDailyStatsRequest) returns (RPCSuccess);
|
2021-06-08 11:18:39 +08:00
|
|
|
|
|
|
|
|
|
|
// 按小时读取统计数据
|
2021-06-08 15:09:58 +08:00
|
|
|
|
rpc findLatestServerHourlyStats (FindLatestServerHourlyStatsRequest) returns (FindLatestServerHourlyStatsResponse);
|
|
|
|
|
|
|
2022-09-24 18:36:34 +08:00
|
|
|
|
// 按分钟读取统计数据,并返回秒级平均流量
|
2021-06-08 15:09:58 +08:00
|
|
|
|
rpc findLatestServerMinutelyStats (FindLatestServerMinutelyStatsRequest) returns (FindLatestServerMinutelyStatsResponse);
|
|
|
|
|
|
|
2022-09-24 18:36:34 +08:00
|
|
|
|
// 读取某天的5分钟间隔流量
|
|
|
|
|
|
rpc findServer5MinutelyStatsWithDay(FindServer5MinutelyStatsWithDayRequest) returns (FindServer5MinutelyStatsWithDayResponse);
|
|
|
|
|
|
|
2022-10-03 19:26:47 +08:00
|
|
|
|
// 读取最近N日的统计数据
|
2021-06-08 15:09:58 +08:00
|
|
|
|
rpc findLatestServerDailyStats (FindLatestServerDailyStatsRequest) returns (FindLatestServerDailyStatsResponse);
|
2022-04-15 12:14:42 +08:00
|
|
|
|
|
2022-10-03 19:26:47 +08:00
|
|
|
|
// 读取日期段内的流量数据
|
|
|
|
|
|
rpc findServerDailyStatsBetweenDays (FindServerDailyStatsBetweenDaysRequest) returns (FindServerDailyStatsBetweenDaysResponse);
|
|
|
|
|
|
|
2022-06-18 14:25:33 +08:00
|
|
|
|
// 查找单个服务当前时刻(N分钟内)统计数据
|
2022-04-15 12:14:42 +08:00
|
|
|
|
rpc sumCurrentServerDailyStats(SumCurrentServerDailyStatsRequest) returns (SumCurrentServerDailyStatsResponse);
|
2022-06-18 14:25:33 +08:00
|
|
|
|
|
|
|
|
|
|
// 计算单个服务的日统计
|
|
|
|
|
|
rpc sumServerDailyStats(SumServerDailyStatsRequest) returns (SumServerDailyStatsResponse);
|
|
|
|
|
|
|
|
|
|
|
|
// 计算单个服务的月统计
|
|
|
|
|
|
rpc sumServerMonthlyStats(SumServerMonthlyStatsRequest) returns (SumServerMonthlyStatsResponse);
|
2020-12-11 21:39:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 上传统计
|
|
|
|
|
|
message UploadServerDailyStatsRequest {
|
|
|
|
|
|
repeated ServerDailyStat stats = 1;
|
2021-07-05 11:37:10 +08:00
|
|
|
|
repeated DomainStat domainStats = 2;
|
|
|
|
|
|
|
|
|
|
|
|
message DomainStat {
|
|
|
|
|
|
int64 serverId = 1;
|
|
|
|
|
|
string domain = 2;
|
|
|
|
|
|
int64 bytes = 3;
|
|
|
|
|
|
int64 cachedBytes = 4;
|
|
|
|
|
|
int64 countRequests = 5;
|
|
|
|
|
|
int64 countCachedRequests = 6;
|
2021-07-13 15:49:34 +08:00
|
|
|
|
int64 countAttackRequests = 8;
|
|
|
|
|
|
int64 attackBytes = 9;
|
2021-07-05 11:37:10 +08:00
|
|
|
|
int64 createdAt = 7;
|
|
|
|
|
|
}
|
2020-12-11 21:39:17 +08:00
|
|
|
|
}
|
2021-06-08 11:18:39 +08:00
|
|
|
|
|
|
|
|
|
|
// 按小时读取统计数据
|
2021-06-08 15:09:58 +08:00
|
|
|
|
message FindLatestServerHourlyStatsRequest {
|
2021-06-08 11:18:39 +08:00
|
|
|
|
int64 serverId = 1;
|
2022-09-24 18:55:25 +08:00
|
|
|
|
int32 hours = 2; // 小时数
|
2021-06-08 11:18:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-06-08 15:09:58 +08:00
|
|
|
|
message FindLatestServerHourlyStatsResponse {
|
2021-06-08 11:18:39 +08:00
|
|
|
|
repeated HourlyStat stats = 1;
|
|
|
|
|
|
|
|
|
|
|
|
message HourlyStat {
|
|
|
|
|
|
string hour = 1;
|
|
|
|
|
|
int64 bytes = 2;
|
|
|
|
|
|
int64 cachedBytes = 3;
|
|
|
|
|
|
int64 countRequests = 4;
|
|
|
|
|
|
int64 countCachedRequests = 5;
|
|
|
|
|
|
}
|
2021-06-08 15:09:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 按分钟读取统计数据
|
|
|
|
|
|
message FindLatestServerMinutelyStatsRequest {
|
|
|
|
|
|
int64 serverId = 1;
|
2022-09-24 18:55:25 +08:00
|
|
|
|
int32 minutes = 2; // 分钟数
|
2021-06-08 15:09:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message FindLatestServerMinutelyStatsResponse {
|
|
|
|
|
|
repeated MinutelyStat stats = 1;
|
|
|
|
|
|
|
|
|
|
|
|
message MinutelyStat {
|
|
|
|
|
|
string minute = 1;
|
|
|
|
|
|
int64 bytes = 2;
|
|
|
|
|
|
int64 cachedBytes = 3;
|
|
|
|
|
|
int64 countRequests = 4;
|
|
|
|
|
|
int64 countCachedRequests = 5;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-24 18:36:34 +08:00
|
|
|
|
// 读取某天的5分钟间隔流量
|
|
|
|
|
|
message FindServer5MinutelyStatsWithDayRequest {
|
|
|
|
|
|
int64 serverId = 1;
|
2022-09-24 18:55:25 +08:00
|
|
|
|
string day = 2; // 必需,格式:YYYYMMDD
|
|
|
|
|
|
string timeFrom = 3; // 可选,开始时间,格式:HHIISS,比如 130000
|
|
|
|
|
|
string timeTo = 4; // 可选,结束时间,格式:HHIISS,比如 130459
|
2022-09-24 18:36:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message FindServer5MinutelyStatsWithDayResponse {
|
|
|
|
|
|
repeated Stat stats = 1;
|
|
|
|
|
|
|
|
|
|
|
|
message Stat {
|
|
|
|
|
|
string day = 1;
|
|
|
|
|
|
string timeFrom = 2;
|
|
|
|
|
|
string timeTo = 3;
|
|
|
|
|
|
int64 bytes = 4;
|
|
|
|
|
|
int64 cachedBytes = 5;
|
|
|
|
|
|
int64 countRequests = 6;
|
|
|
|
|
|
int64 countCachedRequests = 7;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-03 19:26:47 +08:00
|
|
|
|
// 读取最近N日的统计数据
|
2021-06-08 15:09:58 +08:00
|
|
|
|
message FindLatestServerDailyStatsRequest {
|
|
|
|
|
|
int64 serverId = 1;
|
2022-10-14 16:17:18 +08:00
|
|
|
|
int64 nodeRegionId = 3; // 区域ID,可选
|
2022-09-24 18:55:25 +08:00
|
|
|
|
int32 days = 2; // 天数
|
2021-06-08 15:09:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message FindLatestServerDailyStatsResponse {
|
|
|
|
|
|
repeated DailyStat stats = 1;
|
|
|
|
|
|
|
|
|
|
|
|
message DailyStat {
|
|
|
|
|
|
string day = 1;
|
|
|
|
|
|
int64 bytes = 2;
|
|
|
|
|
|
int64 cachedBytes = 3;
|
|
|
|
|
|
int64 countRequests = 4;
|
|
|
|
|
|
int64 countCachedRequests = 5;
|
|
|
|
|
|
}
|
2022-04-15 12:14:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-03 19:26:47 +08:00
|
|
|
|
// 读取日期段内的流量数据
|
|
|
|
|
|
message FindServerDailyStatsBetweenDaysRequest {
|
|
|
|
|
|
int64 userId = 1; // 用户ID,和服务ID二选一
|
|
|
|
|
|
int64 serverId = 2; // 服务ID,和用户ID二选一
|
|
|
|
|
|
string dayFrom = 3; // 开始日期 YYYYMMDD
|
|
|
|
|
|
string dayTo = 4; // 结束日期 YYYYMMDD
|
2022-10-14 16:17:18 +08:00
|
|
|
|
int64 nodeRegionId = 5; // 区域ID
|
2022-10-03 19:26:47 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message FindServerDailyStatsBetweenDaysResponse {
|
|
|
|
|
|
repeated Stat stats = 1;
|
|
|
|
|
|
|
|
|
|
|
|
message Stat {
|
|
|
|
|
|
string day = 1;
|
|
|
|
|
|
string timeFrom = 2;
|
|
|
|
|
|
string timeTo = 3;
|
|
|
|
|
|
string timeAt = 4;
|
|
|
|
|
|
int64 bytes = 5;
|
|
|
|
|
|
int64 cachedBytes = 6;
|
|
|
|
|
|
int64 countRequests = 7;
|
|
|
|
|
|
int64 countCachedRequests = 8;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-18 14:25:33 +08:00
|
|
|
|
// 查找单个服务当前时刻(N分钟内)统计数据
|
2022-04-15 12:14:42 +08:00
|
|
|
|
message SumCurrentServerDailyStatsRequest {
|
|
|
|
|
|
int64 serverId = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message SumCurrentServerDailyStatsResponse {
|
|
|
|
|
|
ServerDailyStat serverDailyStat = 1;
|
2022-06-18 14:25:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算单个服务的日统计
|
|
|
|
|
|
message SumServerDailyStatsRequest {
|
2022-10-03 19:26:47 +08:00
|
|
|
|
int64 userId = 3;
|
2022-06-18 14:25:33 +08:00
|
|
|
|
int64 serverId = 1;
|
2022-10-14 16:17:18 +08:00
|
|
|
|
int64 nodeRegionId = 6;
|
2022-10-14 10:03:49 +08:00
|
|
|
|
|
2022-06-18 14:25:33 +08:00
|
|
|
|
string day = 2; // YYYYMMDD
|
2022-10-03 19:26:47 +08:00
|
|
|
|
|
|
|
|
|
|
string dayFrom = 4; // day 和 dayFrom+dayTo 二选一, YYYYMMDD
|
|
|
|
|
|
string dayTo = 5; // day 和 dayFrom+dayTo 二选一,YYYYMMDD
|
2022-06-18 14:25:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message SumServerDailyStatsResponse {
|
|
|
|
|
|
ServerDailyStat serverDailyStat = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算单个服务的月统计
|
|
|
|
|
|
message SumServerMonthlyStatsRequest {
|
|
|
|
|
|
int64 serverId = 1;
|
|
|
|
|
|
string month = 2; // YYYYMM
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
message SumServerMonthlyStatsResponse {
|
|
|
|
|
|
ServerDailyStat serverMonthlyStat = 1;
|
2021-06-08 11:18:39 +08:00
|
|
|
|
}
|