mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			104 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			104 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
syntax = "proto3";
 | 
						||
option go_package = "./pb";
 | 
						||
 | 
						||
package pb;
 | 
						||
 | 
						||
import "models/rpc_messages.proto";
 | 
						||
import "models/model_server_bandwidth_stat.proto";
 | 
						||
 | 
						||
// 服务带宽统计服务
 | 
						||
service ServerBandwidthStatService {
 | 
						||
	// 上传带宽统计
 | 
						||
	rpc uploadServerBandwidthStats(UploadServerBandwidthStatsRequest) returns (RPCSuccess);
 | 
						||
 | 
						||
	// 获取服务的峰值带宽
 | 
						||
	rpc findServerBandwidthStats(FindServerBandwidthStatsRequest) returns (FindServerBandwidthStatsResponse);
 | 
						||
 | 
						||
	// 获取最近N小时峰值带宽
 | 
						||
	rpc findHourlyServerBandwidthStats(FindHourlyServerBandwidthStatsRequest) returns (FindHourlyServerBandwidthStatsResponse);
 | 
						||
 | 
						||
	// 获取最近N天峰值带宽
 | 
						||
	rpc findDailyServerBandwidthStats(FindDailyServerBandwidthStatsRequest) returns (FindDailyServerBandwidthStatsResponse);
 | 
						||
 | 
						||
	// 读取日期段内的带宽数据
 | 
						||
	rpc findDailyServerBandwidthStatsBetweenDays (FindDailyServerBandwidthStatsBetweenDaysRequest) returns (FindDailyServerBandwidthStatsBetweenDaysResponse);
 | 
						||
}
 | 
						||
 | 
						||
// 上传带宽统计
 | 
						||
message UploadServerBandwidthStatsRequest {
 | 
						||
	repeated ServerBandwidthStat serverBandwidthStats = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 获取服务的峰值带宽
 | 
						||
message FindServerBandwidthStatsRequest {
 | 
						||
	int64 serverId = 1; // 服务ID
 | 
						||
	string month = 2; // YYYYMM,month和day二选一
 | 
						||
	string day = 3; // YYYYMMDD
 | 
						||
	string algo = 4; // 带宽算法,目前支持secondly和avg
 | 
						||
}
 | 
						||
 | 
						||
message FindServerBandwidthStatsResponse {
 | 
						||
	repeated ServerBandwidthStat serverBandwidthStats = 1;
 | 
						||
}
 | 
						||
 | 
						||
// 获取最近N小时峰值带宽
 | 
						||
message FindHourlyServerBandwidthStatsRequest {
 | 
						||
	int64 serverId = 1;
 | 
						||
	int32 hours = 2;
 | 
						||
	string algo = 3; // 带宽算法,目前支持secondly和avg
 | 
						||
}
 | 
						||
 | 
						||
message FindHourlyServerBandwidthStatsResponse {
 | 
						||
	repeated Stat stats = 1;
 | 
						||
	int32 percentile = 2; // 百分位
 | 
						||
	Stat nthStat = 3; // 百分位统计数据
 | 
						||
 | 
						||
	message Stat {
 | 
						||
		string day = 1;
 | 
						||
		int32 hour = 2;
 | 
						||
		int64 bytes = 3; // 峰值字节/秒
 | 
						||
		int64 bits = 4; // 峰值比特/秒
 | 
						||
	}
 | 
						||
}
 | 
						||
 | 
						||
// 获取最近N天峰值带宽
 | 
						||
message FindDailyServerBandwidthStatsRequest {
 | 
						||
	int64 serverId = 1;
 | 
						||
	int32 days = 2;
 | 
						||
	string algo = 3; // 带宽算法,目前支持secondly和avg
 | 
						||
}
 | 
						||
 | 
						||
message FindDailyServerBandwidthStatsResponse {
 | 
						||
	repeated Stat stats = 1;
 | 
						||
	int32 percentile = 2; // 百分位
 | 
						||
	Stat nthStat = 3; // 百分位统计数据
 | 
						||
 | 
						||
	message Stat {
 | 
						||
		string day = 1;
 | 
						||
		int64 bytes = 3; // 峰值字节/秒
 | 
						||
		int64 bits = 4; // 峰值比特/秒
 | 
						||
	}
 | 
						||
}
 | 
						||
 | 
						||
// 读取日期段内的带宽数据
 | 
						||
message FindDailyServerBandwidthStatsBetweenDaysRequest {
 | 
						||
	int64 userId = 1; // 用户ID,和服务ID二选一
 | 
						||
	int64 serverId = 2; // 服务ID,和用户ID二选一
 | 
						||
	string dayFrom = 3; // 开始日期 YYYYMMDD
 | 
						||
	string dayTo = 4; // 结束日期 YYYYMMDD
 | 
						||
	int32 percentile = 5; // 可选项,百分位(nth)带宽位置,0-100之间
 | 
						||
	int64 nodeRegionId = 6; // 区域ID,可选项(目前只有用户整体统计支持区域ID)
 | 
						||
	string algo = 7; // 带宽算法,目前支持secondly和avg
 | 
						||
}
 | 
						||
 | 
						||
message FindDailyServerBandwidthStatsBetweenDaysResponse {
 | 
						||
	repeated Stat stats = 1;
 | 
						||
	Stat nthStat = 2;
 | 
						||
 | 
						||
	message Stat {
 | 
						||
		string day = 1;
 | 
						||
		string timeAt = 2;
 | 
						||
		int64 bytes = 3; // 峰值字节/秒
 | 
						||
		int64 bits = 4; // 峰值比特/秒
 | 
						||
	}
 | 
						||
} |