aboutsummaryrefslogtreecommitdiff
path: root/services/src/main/proto/io/grpc/binarylog.proto
blob: e8c91945cbf4400471e5515e88176457b6052a84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright 2016 The gRPC Authors
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Service exported by server reflection

syntax = "proto3";

package grpc.binarylog.v1alpha;

option java_multiple_files = true;
option java_package = "io.grpc.binarylog";
option java_outer_classname = "BinaryLogProto";

// Log entry we store in binary logs
message GrpcLogEntry {
  // Enumerates the type of logs
  enum Type {
    UNKNOWN_TYPE = 0; // TODO(zpencer): upstream this
    SEND_INITIAL_METADATA = 1;
    SEND_TRAILING_METADATA = 2;
    SEND_MESSAGE = 3;
    RECV_INITIAL_METADATA = 4;
    RECV_TRAILING_METADATA = 5;
    RECV_MESSAGE = 6;
  };

  // Enumerates the entity that generates the log entry
  enum Logger {
    UNKNOWN_LOGGER = 0; // TODO(zpencer): upstream this
    CLIENT = 1;
    SERVER = 2;
  }

  Type type = 1;      // One of the above Type enum
  Logger logger = 2;  // One of the above Logger enum

  // Uniquely identifies a call. Each call may have several log entries, they
  // will share the same call_id. 128 bits split into 2 64-bit parts.
  Uint128 call_id = 3;

  // The logger uses one of the following fields to record the payload,
  // according to the type of the log entry.
  oneof payload {
    // Used by CLIENT_INIT_METADATA, SERVER_INIT_METADATA and TRAILING_METADATA
    Metadata metadata = 4;
    // Used by REQUEST and RESPONSE
    Message message = 5;
  }

  // Peer address information, will only be recorded in SEND_INITIAL_METADATA
  // and RECV_INITIAL_METADATA entries.
  Peer peer = 6;
};

// Message payload, used by REQUEST and RESPONSE
message Message {
  // This flag is currently used to indicate whether the payload is compressed,
  // it may contain other semantics in the future. Value of 1 indicates that the
  // binary octet sequence of Message is compressed using the mechanism declared
  // by the Message-Encoding header. A value of 0 indicates that no encoding of
  // Message bytes has occurred.
  uint32 flags = 1; // TODO(zpencer): this is changed because there is no uint8
  // Length of the message. It may not be the same as the length of the
  // data field, as the logging payload can be truncated or omitted.
  uint32 length = 2;
  // Binary payload, post compression (depends on the flags field), may be
  // truncated or omitted.
  bytes data = 3;
}

// A list of metadata pairs, used in the payload of CLIENT_INIT_METADATA,
// SERVER_INIT_METADATA and TRAILING_METADATA
// Implementations may omit some entries to honor the header limits
// of GRPC_BINARY_LOG_CONFIG. Implementations can choose which entries are logged.
message Metadata {
  repeated MetadataEntry entry = 1;
}

// A metadata key value pair
message MetadataEntry {
  bytes key = 1; // TODO(zpencer): upstream this
  bytes value = 2;
}

// Peer information
message Peer {
  enum PeerType {
    UNKNOWN_PEERTYPE = 0; // TODO(zpencer): upstream this
    PEER_IPV4 = 1;  // peer is struct sockaddr_in
    PEER_IPV6 = 2;  // peer is struct sockaddr_in6
    PEER_UNIX = 3;  // peer is struct sockaddr_un
  };
  PeerType peer_type = 1;
  bytes peer = 2;  // value depends on peer_type
}

// Used to record call_id.
message Uint128 {
  fixed64 high = 1;
  fixed64 low = 2;
};