1/* 2 * Copyright 2022 The gRPC Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto3"; 18 19package grpc.observabilitylog.v1; 20 21import "google/protobuf/duration.proto"; 22import "google/protobuf/timestamp.proto"; 23import "google/rpc/code.proto"; 24 25option java_multiple_files = true; 26option java_package = "io.grpc.observabilitylog.v1"; 27option java_outer_classname = "ObservabilityLogProto"; 28 29message GrpcLogRecord { 30 // List of event types 31 enum EventType { 32 EVENT_TYPE_UNKNOWN = 0; 33 // Header sent from client to server 34 CLIENT_HEADER = 1; 35 // Header sent from server to client 36 SERVER_HEADER = 2; 37 // Message sent from client to server 38 CLIENT_MESSAGE = 3; 39 // Message sent from server to client 40 SERVER_MESSAGE = 4; 41 // A signal that client is done sending 42 CLIENT_HALF_CLOSE = 5; 43 // Trailer indicates the end of the gRPC call 44 SERVER_TRAILER = 6; 45 // A signal that the rpc is canceled 46 CANCEL = 7; 47 } 48 49 // The entity that generates the log entry 50 enum EventLogger { 51 LOGGER_UNKNOWN = 0; 52 CLIENT = 1; 53 SERVER = 2; 54 } 55 56 // Uniquely identifies a call. 57 // Each call may have several log entries. They will all have the same call_id. 58 // Nothing is guaranteed about their value other than they are unique across 59 // different RPCs in the same gRPC process. 60 string call_id = 2; 61 62 // The entry sequence ID for this call. The first message has a value of 1, 63 // to disambiguate from an unset value. The purpose of this field is to 64 // detect missing entries in environments where durability or ordering is 65 // not guaranteed. 66 uint64 sequence_id = 3; 67 68 EventType type = 4; // one of the above EventType enum 69 EventLogger logger = 5; // one of the above EventLogger enum 70 71 // Payload for log entry. 72 // It can include a combination of {metadata, message, status based on type of 73 // the event event being logged and config options. 74 Payload payload = 6; 75 76 // true if message or metadata field is either truncated or omitted due 77 // to config options 78 bool payload_truncated = 7; 79 // Peer address information. On client side, peer is logged on server 80 // header event or trailer event (if trailer-only). On server side, peer 81 // is always logged on the client header event. 82 Address peer = 8; 83 84 // A single process may be used to run multiple virtual servers with 85 // different identities. 86 // The authority is the name of such a server identify. It is typically a 87 // portion of the URI in the form of <host> or <host>:<port>. 88 string authority = 10; 89 // the name of the service 90 string service_name = 11; 91 // the name of the RPC method 92 string method_name = 12; 93} 94 95message Payload { 96 // A list of metadata pairs 97 map<string, string> metadata = 1; 98 // the RPC timeout value 99 google.protobuf.Duration timeout = 2; 100 // The gRPC status code 101 google.rpc.Code status_code = 3; 102 // The gRPC status message 103 string status_message = 4; 104 // The value of the grpc-status-details-bin metadata key, if any. 105 // This is always an encoded google.rpc.Status message 106 bytes status_details = 5; 107 // Size of the message or metadata, depending on the event type, 108 // regardless of whether the full message or metadata is being logged 109 // (i.e. could be truncated or omitted). 110 uint32 message_length = 6; 111 // Used by message event 112 bytes message = 7; 113} 114 115// Address information 116message Address { 117 enum Type { 118 TYPE_UNKNOWN = 0; 119 IPV4 = 1; // in 1.2.3.4 form 120 IPV6 = 2; // IPv6 canonical form (RFC5952 section 4) 121 UNIX = 3; // UDS string 122 } 123 Type type = 1; 124 string address = 2; 125 // only for TYPE_IPV4 and TYPE_IPV6 126 uint32 ip_port = 3; 127} 128