增加API方法调用耗时统计

This commit is contained in:
GoEdgeLab
2022-01-19 16:54:03 +08:00
parent 354a39da5b
commit 5d06c34fd7
8 changed files with 910 additions and 85 deletions

View File

@@ -0,0 +1,30 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_api_method_stat.proto";
import "models/rpc_messages.proto";
// API方法统计服务
service APIMethodStatService {
// 查找某天的统计
rpc findAPIMethodStatsWithDay(FindAPIMethodStatsWithDayRequest) returns (FindAPIMethodStatsWithDayResponse);
// 检查是否有统计数据
rpc countAPIMethodStatsWithDay(CountAPIMethodStatsWithDayRequest) returns (RPCCountResponse);
}
// 查找某天的统计
message FindAPIMethodStatsWithDayRequest {
string day = 1; // YYYYMMDD
}
message FindAPIMethodStatsWithDayResponse {
repeated APIMethodStat apiMethodStats = 1;
}
// 检查是否有统计数据
message CountAPIMethodStatsWithDayRequest {
string day = 1; // YYYYMMDD
}

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_api_node.proto";
message APIMethodStat {
int64 id = 1;
int64 apiNodeId = 2;
string method = 3;
string tag = 4;
float costMs = 5;
float peekMs = 6;
int64 countCalls = 7;
APINode apiNode = 30;
}

View File

@@ -19,4 +19,6 @@ message APINode {
bytes accessAddrsJSON = 10;
repeated string accessAddrs = 11;
bytes statusJSON = 12;
bool debug = 30;
}

View File

@@ -38,6 +38,9 @@ service APINodeService {
// 计算使用某个SSL证书的API节点数量
rpc countAllEnabledAPINodesWithSSLCertId (CountAllEnabledAPINodesWithSSLCertIdRequest) returns (RPCCountResponse);
// 修改调试模式状态
rpc debugAPINode(DebugAPINodeRequest) returns (RPCSuccess);
}
// 创建API节点
@@ -135,3 +138,8 @@ message FindCurrentAPINodeResponse {
message CountAllEnabledAPINodesWithSSLCertIdRequest {
int64 sslCertId = 1;
}
// 修改调试模式状态
message DebugAPINodeRequest {
bool debug = 1;
}