Home | History | Annotate | Download | only in v1alpha
      1 // Copyright 2018 The gRPC Authors
      2 // All rights reserved.
      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 // Service exported by server reflection
     16 
     17 syntax = "proto3";
     18 
     19 package grpc.binarylog.v1alpha;
     20 
     21 import "google/protobuf/duration.proto";
     22 
     23 option java_multiple_files = true;
     24 option java_package = "io.grpc.binarylog.v1alpha";
     25 option java_outer_classname = "BinaryLogProto";
     26 
     27 // Log entry we store in binary logs
     28 message GrpcLogEntry {
     29   // Enumerates the type of logs
     30   enum Type {
     31     UNKNOWN_TYPE = 0;
     32     SEND_INITIAL_METADATA = 1;
     33     SEND_TRAILING_METADATA = 2;
     34     SEND_MESSAGE = 3;
     35     RECV_INITIAL_METADATA = 4;
     36     RECV_TRAILING_METADATA = 5;
     37     RECV_MESSAGE = 6;
     38   };
     39 
     40   // Enumerates the entity that generates the log entry
     41   enum Logger {
     42     UNKNOWN_LOGGER = 0;
     43     CLIENT = 1;
     44     SERVER = 2;
     45   }
     46 
     47   Type type = 1;      // One of the above Type enum
     48   Logger logger = 2;  // One of the above Logger enum
     49 
     50   // Uniquely identifies a call. Each call may have several log entries, they
     51   // will share the same call_id. 128 bits split into 2 64-bit parts.
     52   Uint128 call_id = 3;
     53 
     54   // The logger uses one of the following fields to record the payload,
     55   // according to the type of the log entry.
     56   oneof payload {
     57     // Used by {SEND,RECV}_INITIAL_METADATA and
     58     // {SEND,RECV}_TRAILING_METADATA. This contains only the metadata
     59     // from the application.
     60     Metadata metadata = 4;
     61     // Used by {SEND,RECV}_MESSAGE
     62     Message message = 5;
     63   }
     64 
     65   // Peer address information, will only be recorded in SEND_INITIAL_METADATA
     66   // and RECV_INITIAL_METADATA entries.
     67   Peer peer = 6;
     68 
     69   // true if payload does not represent the full message or metadata.
     70   bool truncated = 7;
     71 
     72   // The method name. Logged for the first entry:
     73   // RECV_INITIAL_METADATA for server side or
     74   // SEND_INITIAL_METADATA for client side.
     75   string method_name = 8;
     76 
     77   // status_code and status_message:
     78   // Only present for SEND_TRAILING_METADATA on server side or
     79   // RECV_TRAILING_METADATA on client side.
     80   uint32 status_code = 9;
     81 
     82   // An original status message before any transport specific
     83   // encoding.
     84   string status_message = 10;
     85 
     86   // The value of the 'grpc-status-details-bin' metadata key. If
     87   // present, this is always an encoded 'google.rpc.Status' message.
     88   bytes status_details = 11;
     89 
     90   // the RPC timeout
     91   google.protobuf.Duration timeout = 12;
     92 
     93   // The entry sequence id for this call. The first GrpcLogEntry has a
     94   // value of 1, to disambiguate from an unset value. The purpose of
     95   // this field is to detect missing entries in environments where
     96   // durability or ordering is not guaranteed.
     97   uint32 sequence_id_within_call = 13;
     98 };
     99 
    100 // Message payload, used by REQUEST and RESPONSE
    101 message Message {
    102   // This flag is currently used to indicate whether the payload is compressed,
    103   // it may contain other semantics in the future. Value of 1 indicates that the
    104   // binary octet sequence of Message is compressed using the mechanism declared
    105   // by the Message-Encoding header. A value of 0 indicates that no encoding of
    106   // Message bytes has occurred.
    107   uint32 flags = 1; // TODO(zpencer): this is changed because there is no uint8
    108   // Length of the message. It may not be the same as the length of the
    109   // data field, as the logging payload can be truncated or omitted.
    110   uint32 length = 2;
    111   // May be truncated or omitted.
    112   bytes data = 3;
    113 }
    114 
    115 // A list of metadata pairs, used in the payload of CLIENT_INIT_METADATA,
    116 // SERVER_INIT_METADATA and TRAILING_METADATA
    117 // Implementations may omit some entries to honor the header limits
    118 // of GRPC_BINARY_LOG_CONFIG.
    119 // 
    120 // Implementations will not log the following entries, and this is
    121 // not to be treated as a truncation:
    122 // - entries handled by grpc that are not user visible, such as those
    123 //   that begin with 'grpc-' or keys like 'lb-token'
    124 // - transport specific entries, including but not limited to:
    125 //   ':path', ':authority', 'content-encoding', 'user-agent', 'te', etc
    126 // - entries added for call credentials
    127 message Metadata {
    128   repeated MetadataEntry entry = 1;
    129 }
    130 
    131 // A metadata key value pair
    132 message MetadataEntry {
    133   bytes key = 1;
    134   bytes value = 2;
    135 }
    136 
    137 // Peer information
    138 message Peer {
    139   enum PeerType {
    140     UNKNOWN_PEERTYPE = 0;
    141     // address is the address in 1.2.3.4 form
    142     PEER_IPV4 = 1;
    143     // address the address in canonical form (RFC5952 section 4)
    144     // The scope is NOT included in the peer string.
    145     PEER_IPV6 = 2;
    146     // address is UDS string
    147     PEER_UNIX = 3;
    148   };
    149   PeerType peer_type = 1;
    150   bytes peer = 2; // will be removed: do not use
    151   string address = 3;
    152   // only for PEER_IPV4 and PEER_IPV6
    153   uint32 ip_port = 4;
    154 }
    155 
    156 // Used to record call_id.
    157 message Uint128 {
    158   fixed64 high = 1;
    159   fixed64 low = 2;
    160 };
    161