Skip to content

Commit 2ec6378

Browse files
siddh34LorenzoTettamanti
authored andcommitted
CortexFlow[#143]: agent api
1 parent 4c68ba2 commit 2ec6378

17 files changed

Lines changed: 983 additions & 113 deletions

File tree

core/api/protos/agent.proto

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package agent;
33

44
import "google/protobuf/empty.proto";
55

6+
// Active connections
7+
68
message RequestActiveConnections{
79
optional string pod_ip = 2 ;
810
}
@@ -18,6 +20,96 @@ message ActiveConnectionResponse{
1820
repeated ConnectionEvent events = 2; // List of connection events
1921
}
2022

23+
// Network metrics
24+
25+
26+
27+
// Latency metrics request and response messages
28+
29+
message LatencyMetricsRequest {
30+
optional uint32 tgid = 1; // Filter by thread group ID
31+
optional string process_name = 2; // Filter by process name
32+
optional uint64 start_time = 3; // Start timestamp (microseconds)
33+
optional uint64 end_time = 4; // End timestamp (microseconds)
34+
}
35+
36+
message LatencyMetric {
37+
uint64 delta_us = 1; // Latency in microseconds
38+
uint64 timestamp_us = 2; // Event timestamp
39+
uint32 tgid = 3; // Thread group ID
40+
string process_name = 4; // Process name (comm)
41+
uint32 local_port = 5; // Local port
42+
uint32 remote_port = 6; // Remote port (big-endian)
43+
uint32 address_family = 7; // "IPv4" or "IPv6"
44+
string src_address_v4 = 8; // Source IP address
45+
string dst_address_v4 = 9; // Destination IP address
46+
string src_address_v6 = 10; // Source IPv6 address
47+
string dst_address_v6 = 11; // Destination IPv6 address
48+
}
49+
50+
message LatencyMetricsResponse {
51+
string status = 1;
52+
repeated LatencyMetric metrics = 2;
53+
uint32 total_count = 3;
54+
double average_latency_us = 4; // Average latency
55+
double min_latency_us = 5; // Minimum latency
56+
double max_latency_us = 6; // Maximum latency
57+
}
58+
59+
// Packet Loss Metrics
60+
61+
message PacketLossMetricsRequest {
62+
optional uint32 tgid = 1; // Filter by thread group ID
63+
optional uint64 start_time = 2; // Start timestamp
64+
optional uint64 end_time = 3; // End timestamp
65+
}
66+
67+
message PacketLossMetric {
68+
uint32 tgid = 1; // Thread group ID
69+
string process_name = 2; // Process name
70+
uint64 timestamp_us = 3; // Event timestamp
71+
uint32 total_packets_lost = 4; // Total packets lost
72+
uint32 total_packets_transmitted = 5; // Total packets transmitted
73+
double packet_loss_percentage = 6; // % of total packet loss
74+
uint64 total_data_loss_bytes = 7; // Total size of data loss
75+
uint64 total_data_transmitted_bytes = 8; // Total transmitted data
76+
double data_loss_ratio = 9; // Ratio between loss and transmitted
77+
}
78+
79+
message PacketLossMetricsResponse {
80+
string status = 1;
81+
repeated PacketLossMetric metrics = 2;
82+
uint32 total_connections = 3;
83+
}
84+
85+
// Dropped TCP Packets
86+
87+
message DroppedPacketsRequest {
88+
optional uint32 tgid = 1; // Filter by thread group ID
89+
optional uint64 start_time = 2; // Start timestamp
90+
optional uint64 end_time = 3; // End timestamp
91+
}
92+
93+
message DroppedPacketMetric {
94+
uint32 tgid = 1; // Thread group ID
95+
string process_name = 2; // Process name
96+
int32 sk_drops = 3; // Socket drops (from sk_drops field)
97+
int32 sk_err = 4; // Socket errors
98+
int32 sk_err_soft = 5; // Soft errors
99+
uint32 sk_backlog_len = 6; // Backlog length (congestion indicator)
100+
int32 sk_wmem_queued = 7; // Write memory queued
101+
int32 sk_rcvbuf = 8; // Receive buffer size
102+
uint32 sk_ack_backlog = 9; // ACK backlog
103+
uint64 timestamp_us = 10; // Event timestamp
104+
}
105+
106+
message DroppedPacketsResponse {
107+
string status = 1;
108+
repeated DroppedPacketMetric metrics = 2;
109+
uint32 total_drops = 3; // Total drops across all connections
110+
}
111+
112+
21113
//declare agent api
22114
service Agent{
23115

@@ -31,6 +123,12 @@ service Agent{
31123
// remove ip from blocklist endpoint
32124
rpc RmIpFromBlocklist(RmIpFromBlocklistRequest) returns (RmIpFromBlocklistResponse);
33125

126+
// metrics data
127+
rpc GetLatencyMetrics(LatencyMetricsRequest) returns (LatencyMetricsResponse);
128+
129+
rpc GetPacketLossMetrics(PacketLossMetricsRequest) returns (PacketLossMetricsResponse);
130+
131+
rpc GetDroppedPacketsMetrics(DroppedPacketsRequest) returns (DroppedPacketsResponse);
34132
}
35133

36134
message AddIpToBlocklistRequest{

0 commit comments

Comments
 (0)