syntax = "proto3"; package protobuf; option go_package = "github.com/accuknox/SentryFlow/protobuf/golang"; message ClientInfo { string hostName = 1; string IPAddress = 2; } message APILog { option deprecated = true; uint64 id = 1; string timeStamp = 2; string srcNamespace = 11; string srcName = 12; map srcLabel = 13; string srcType = 21; string srcIP = 22; string srcPort = 23; string dstNamespace = 31; string dstName = 32; map dstLabel = 33; string dstType = 41; string dstIP = 42; string dstPort = 43; string protocol = 51; string method = 52; string path = 53; int32 responseCode = 54; } // APIEvent represents an event related to an API call, including metadata, // source and destination workloads, and network information. message APIEvent { Metadata metadata = 1; Workload source = 3; Workload destination = 4; Request request = 5; Response response = 6; string protocol = 7; // End-to-end observed latency in milliseconds. uint32 latency_ms = 8; } message Metadata { uint32 context_id = 1; uint64 timestamp = 2; string istio_version = 3 [deprecated = true]; string mesh_id = 4; // The name of the Kubernetes node where the workload is running. If the workload // is not running in a Kubernetes environment, this field will be empty. string node_name = 5; // Name of receiver (e.g., Istio, nginx). string receiver_name = 6; // Version of receiver (e.g., 1.26.2). string receiver_version = 7; } // Workload represents a generic entity that can be either a Kubernetes or // non-Kubernetes resource. It serves as a source or destination for access // within a system. message Workload { // The name of the workload. string name = 1; // The namespace in which the workload is deployed. This field is only applicable // for Kubernetes workloads. string namespace = 2; // The IP address of the workload. string ip = 3; // The port number used by the workload. int32 port = 4; // K8s labels for policy matching. map labels = 5; // Workload kind: "Pod", "Service", or "External". string kind = 6; } // Request represents an incoming HTTP request. message Request { map headers = 1; string body = 2; // HTTP method (GET, POST, etc.) or gRPC method name. string method = 3; // URL path or gRPC full method path (e.g. /pkg.Svc/Method). string path = 4; // gRPC service name (e.g. "helloworld.Greeter") string grpc_service = 5; // gRPC method name (e.g. "SayHello") string grpc_method = 6; // Content-Type header value (e.g. "application/grpc") string content_type = 7; } // Response represents an outgoing HTTP response. message Response { map headers = 1; string body = 2; uint64 backend_latency_in_nanos = 3; // HTTP status code or gRPC status code. int32 status_code = 4; // gRPC status code (0=OK, 1=CANCELLED, 2=UNKNOWN, etc.) int32 grpc_status_code = 5; // Human-readable gRPC error message from grpc-message trailer. string grpc_status_message = 6; } message APIMetrics { map perAPICounts = 1; // @todo: add some more metrics here } message MetricValue { map value = 1; } message EnvoyMetrics { string timeStamp = 1; string namespace = 11; string name = 12; string IPAddress = 13; map labels = 14; map metrics = 21; } service SentryFlow { rpc GetAPILog(ClientInfo) returns (stream APILog) { option deprecated = true; } rpc GetAPIEvent(ClientInfo) returns (stream APIEvent); rpc SendAPIEvent(APIEvent) returns(APIEvent); rpc GetAPIMetrics(ClientInfo) returns (stream APIMetrics); rpc GetEnvoyMetrics(ClientInfo) returns (stream EnvoyMetrics); } // ═══════════════════════════════════════════════════════════════════════════ // KubeArmor API Observer — extension types // ═══════════════════════════════════════════════════════════════════════════ // APIEventFilter controls which events are streamed to a subscriber. message APIEventFilter { string namespace = 1; string pod_name = 2; repeated string protocols = 3; repeated string methods = 4; repeated string status_patterns = 5; int64 min_duration_ms = 6; } // MetricsRequest is the input for GetAPIMetrics. message MetricsRequest {} // APIObserverMetrics provides aggregated API observability statistics. message APIObserverMetrics { string timestamp = 1; uint64 total_events = 2; map events_by_protocol = 3; map events_by_status = 4; repeated EndpointMetric top_endpoints = 5; map avg_latency_by_endpoint = 6; double error_rate = 7; } // EndpointMetric captures per-endpoint statistics. message EndpointMetric { string method = 1; string path = 2; uint64 request_count = 3; double avg_latency_ms = 4; double p95_latency_ms = 5; double p99_latency_ms = 6; } // APIObserverService provides KubeArmor-specific API event streaming. service APIObserverService { rpc GetAPIEvents(APIEventFilter) returns (stream APIEvent); rpc GetAPIMetrics(MetricsRequest) returns (APIObserverMetrics); }