1 // Copyright 2016 gRPC authors.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
18 option go_package = "google.golang.org/grpc/grpclb/grpc_lb_v1/messages";
21 // Signed seconds of the span of time. Must be from -315,576,000,000
22 // to +315,576,000,000 inclusive.
25 // Signed fractions of a second at nanosecond resolution of the span
26 // of time. Durations less than one second are represented with a 0
27 // `seconds` field and a positive or negative `nanos` field. For durations
28 // of one second or more, a non-zero value for the `nanos` field must be
29 // of the same sign as the `seconds` field. Must be from -999,999,999
30 // to +999,999,999 inclusive.
35 // Represents seconds of UTC time since Unix epoch
36 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
37 // 9999-12-31T23:59:59Z inclusive.
40 // Non-negative fractions of a second at nanosecond resolution. Negative
41 // second values with fractions must still have non-negative nanos values
42 // that count forward in time. Must be from 0 to 999,999,999
47 message LoadBalanceRequest {
48 oneof load_balance_request_type {
49 // This message should be sent on the first request to the load balancer.
50 InitialLoadBalanceRequest initial_request = 1;
52 // The client stats should be periodically reported to the load balancer
53 // based on the duration defined in the InitialLoadBalanceResponse.
54 ClientStats client_stats = 2;
58 message InitialLoadBalanceRequest {
59 // Name of load balanced service (IE, balancer.service.com)
60 // length should be less than 256 bytes.
64 // Contains client level statistics that are useful to load balancing. Each
65 // count except the timestamp should be reset to zero after reporting the stats.
67 // The timestamp of generating the report.
68 Timestamp timestamp = 1;
70 // The total number of RPCs that started.
71 int64 num_calls_started = 2;
73 // The total number of RPCs that finished.
74 int64 num_calls_finished = 3;
76 // The total number of RPCs that were dropped by the client because of rate
78 int64 num_calls_finished_with_drop_for_rate_limiting = 4;
80 // The total number of RPCs that were dropped by the client because of load
82 int64 num_calls_finished_with_drop_for_load_balancing = 5;
84 // The total number of RPCs that failed to reach a server except dropped RPCs.
85 int64 num_calls_finished_with_client_failed_to_send = 6;
87 // The total number of RPCs that finished and are known to have been received
89 int64 num_calls_finished_known_received = 7;
92 message LoadBalanceResponse {
93 oneof load_balance_response_type {
94 // This message should be sent on the first response to the client.
95 InitialLoadBalanceResponse initial_response = 1;
97 // Contains the list of servers selected by the load balancer. The client
98 // should send requests to these servers in the specified order.
99 ServerList server_list = 2;
103 message InitialLoadBalanceResponse {
104 // This is an application layer redirect that indicates the client should use
105 // the specified server for load balancing. When this field is non-empty in
106 // the response, the client should open a separate connection to the
107 // load_balancer_delegate and call the BalanceLoad method. Its length should
108 // be less than 64 bytes.
109 string load_balancer_delegate = 1;
111 // This interval defines how often the client should send the client stats
112 // to the load balancer. Stats should only be reported when the duration is
114 Duration client_stats_report_interval = 2;
118 // Contains a list of servers selected by the load balancer. The list will
119 // be updated when server resolutions change or as needed to balance load
120 // across more servers. The client should consume the server list in order
121 // unless instructed otherwise via the client_config.
122 repeated Server servers = 1;
124 // Was google.protobuf.Duration expiration_interval.
128 // Contains server information. When none of the [drop_for_*] fields are true,
129 // use the other fields. When drop_for_rate_limiting is true, ignore all other
130 // fields. Use drop_for_load_balancing only when it is true and
131 // drop_for_rate_limiting is false.
133 // A resolved address for the server, serialized in network-byte-order. It may
134 // either be an IPv4 or IPv6 address.
135 bytes ip_address = 1;
137 // A resolved port number for the server.
140 // An opaque but printable token given to the frontend for each pick. All
141 // frontend requests for that pick must include the token in its initial
142 // metadata. The token is used by the backend to verify the request and to
143 // allow the backend to report load to the gRPC LB system.
145 // Its length is variable but less than 50 bytes.
146 string load_balance_token = 3;
148 // Indicates whether this particular request should be dropped by the client
149 // for rate limiting.
150 bool drop_for_rate_limiting = 4;
152 // Indicates whether this particular request should be dropped by the client
153 // for load balancing.
154 bool drop_for_load_balancing = 5;