messages.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. // Copyright 2015-2016 gRPC authors.
  2. //
  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
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  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.
  14. // Message definitions to be used by integration test service definitions.
  15. syntax = "proto3";
  16. package grpc.testing;
  17. option java_package = "io.grpc.testing.integration";
  18. // TODO(dgq): Go back to using well-known types once
  19. // https://github.com/grpc/grpc/issues/6980 has been fixed.
  20. // import "google/protobuf/wrappers.proto";
  21. message BoolValue {
  22. // The bool value.
  23. bool value = 1;
  24. }
  25. // The type of payload that should be returned.
  26. enum PayloadType {
  27. // Compressable text format.
  28. COMPRESSABLE = 0;
  29. }
  30. // A block of data, to simply increase gRPC message size.
  31. message Payload {
  32. // The type of data in body.
  33. PayloadType type = 1;
  34. // Primary contents of payload.
  35. bytes body = 2;
  36. }
  37. // A protobuf representation for grpc status. This is used by test
  38. // clients to specify a status that the server should attempt to return.
  39. message EchoStatus {
  40. int32 code = 1;
  41. string message = 2;
  42. }
  43. // The type of route that a client took to reach a server w.r.t. gRPCLB.
  44. // The server must fill in "fallback" if it detects that the RPC reached
  45. // the server via the "gRPCLB fallback" path, and "backend" if it detects
  46. // that the RPC reached the server via "gRPCLB backend" path (i.e. if it got
  47. // the address of this server from the gRPCLB server BalanceLoad RPC). Exactly
  48. // how this detection is done is context and server dependent.
  49. enum GrpclbRouteType {
  50. // Server didn't detect the route that a client took to reach it.
  51. GRPCLB_ROUTE_TYPE_UNKNOWN = 0;
  52. // Indicates that a client reached a server via gRPCLB fallback.
  53. GRPCLB_ROUTE_TYPE_FALLBACK = 1;
  54. // Indicates that a client reached a server as a gRPCLB-given backend.
  55. GRPCLB_ROUTE_TYPE_BACKEND = 2;
  56. }
  57. // Unary request.
  58. message SimpleRequest {
  59. // Desired payload type in the response from the server.
  60. // If response_type is RANDOM, server randomly chooses one from other formats.
  61. PayloadType response_type = 1;
  62. // Desired payload size in the response from the server.
  63. int32 response_size = 2;
  64. // Optional input payload sent along with the request.
  65. Payload payload = 3;
  66. // Whether SimpleResponse should include username.
  67. bool fill_username = 4;
  68. // Whether SimpleResponse should include OAuth scope.
  69. bool fill_oauth_scope = 5;
  70. // Whether to request the server to compress the response. This field is
  71. // "nullable" in order to interoperate seamlessly with clients not able to
  72. // implement the full compression tests by introspecting the call to verify
  73. // the response's compression status.
  74. BoolValue response_compressed = 6;
  75. // Whether server should return a given status
  76. EchoStatus response_status = 7;
  77. // Whether the server should expect this request to be compressed.
  78. BoolValue expect_compressed = 8;
  79. // Whether SimpleResponse should include server_id.
  80. bool fill_server_id = 9;
  81. // Whether SimpleResponse should include grpclb_route_type.
  82. bool fill_grpclb_route_type = 10;
  83. // If set the server should record this metrics report data for the current RPC.
  84. TestOrcaReport orca_per_query_report = 11;
  85. }
  86. // Unary response, as configured by the request.
  87. message SimpleResponse {
  88. // Payload to increase message size.
  89. Payload payload = 1;
  90. // The user the request came from, for verifying authentication was
  91. // successful when the client expected it.
  92. string username = 2;
  93. // OAuth scope.
  94. string oauth_scope = 3;
  95. // Server ID. This must be unique among different server instances,
  96. // but the same across all RPC's made to a particular server instance.
  97. string server_id = 4;
  98. // gRPCLB Path.
  99. GrpclbRouteType grpclb_route_type = 5;
  100. // Server hostname.
  101. string hostname = 6;
  102. }
  103. // Client-streaming request.
  104. message StreamingInputCallRequest {
  105. // Optional input payload sent along with the request.
  106. Payload payload = 1;
  107. // Whether the server should expect this request to be compressed. This field
  108. // is "nullable" in order to interoperate seamlessly with servers not able to
  109. // implement the full compression tests by introspecting the call to verify
  110. // the request's compression status.
  111. BoolValue expect_compressed = 2;
  112. // Not expecting any payload from the response.
  113. }
  114. // Client-streaming response.
  115. message StreamingInputCallResponse {
  116. // Aggregated size of payloads received from the client.
  117. int32 aggregated_payload_size = 1;
  118. }
  119. // Configuration for a particular response.
  120. message ResponseParameters {
  121. // Desired payload sizes in responses from the server.
  122. int32 size = 1;
  123. // Desired interval between consecutive responses in the response stream in
  124. // microseconds.
  125. int32 interval_us = 2;
  126. // Whether to request the server to compress the response. This field is
  127. // "nullable" in order to interoperate seamlessly with clients not able to
  128. // implement the full compression tests by introspecting the call to verify
  129. // the response's compression status.
  130. BoolValue compressed = 3;
  131. }
  132. // Server-streaming request.
  133. message StreamingOutputCallRequest {
  134. // Desired payload type in the response from the server.
  135. // If response_type is RANDOM, the payload from each response in the stream
  136. // might be of different types. This is to simulate a mixed type of payload
  137. // stream.
  138. PayloadType response_type = 1;
  139. // Configuration for each expected response message.
  140. repeated ResponseParameters response_parameters = 2;
  141. // Optional input payload sent along with the request.
  142. Payload payload = 3;
  143. // Whether server should return a given status
  144. EchoStatus response_status = 7;
  145. // If set the server should update this metrics report data at the OOB server.
  146. TestOrcaReport orca_oob_report = 8;
  147. }
  148. // Server-streaming response, as configured by the request and parameters.
  149. message StreamingOutputCallResponse {
  150. // Payload to increase response size.
  151. Payload payload = 1;
  152. }
  153. // For reconnect interop test only.
  154. // Client tells server what reconnection parameters it used.
  155. message ReconnectParams {
  156. int32 max_reconnect_backoff_ms = 1;
  157. }
  158. // For reconnect interop test only.
  159. // Server tells client whether its reconnects are following the spec and the
  160. // reconnect backoffs it saw.
  161. message ReconnectInfo {
  162. bool passed = 1;
  163. repeated int32 backoff_ms = 2;
  164. }
  165. message LoadBalancerStatsRequest {
  166. // Request stats for the next num_rpcs sent by client.
  167. int32 num_rpcs = 1;
  168. // If num_rpcs have not completed within timeout_sec, return partial results.
  169. int32 timeout_sec = 2;
  170. // Response header + trailer metadata entries we want the values of.
  171. // Matching of the keys is case-insensitive as per rfc7540#section-8.1.2
  172. // * (asterisk) is a special value that will return all metadata entries
  173. repeated string metadata_keys = 3;
  174. }
  175. message LoadBalancerStatsResponse {
  176. enum MetadataType {
  177. UNKNOWN = 0;
  178. INITIAL = 1;
  179. TRAILING = 2;
  180. }
  181. message MetadataEntry {
  182. // Key, exactly as received from the server. Case may be different from what
  183. // was requested in the LoadBalancerStatsRequest)
  184. string key = 1;
  185. // Value, exactly as received from the server.
  186. string value = 2;
  187. // Metadata type
  188. MetadataType type = 3;
  189. }
  190. message RpcMetadata {
  191. // metadata values for each rpc for the keys specified in
  192. // LoadBalancerStatsRequest.metadata_keys.
  193. repeated MetadataEntry metadata = 1;
  194. }
  195. message MetadataByPeer {
  196. // List of RpcMetadata in for each RPC with a given peer
  197. repeated RpcMetadata rpc_metadata = 1;
  198. }
  199. message RpcsByPeer {
  200. // The number of completed RPCs for each peer.
  201. map<string, int32> rpcs_by_peer = 1;
  202. }
  203. // The number of completed RPCs for each peer.
  204. map<string, int32> rpcs_by_peer = 1;
  205. // The number of RPCs that failed to record a remote peer.
  206. int32 num_failures = 2;
  207. map<string, RpcsByPeer> rpcs_by_method = 3;
  208. // All the metadata of all RPCs for each peer.
  209. map<string, MetadataByPeer> metadatas_by_peer = 4;
  210. }
  211. // Request for retrieving a test client's accumulated stats.
  212. message LoadBalancerAccumulatedStatsRequest {}
  213. // Accumulated stats for RPCs sent by a test client.
  214. message LoadBalancerAccumulatedStatsResponse {
  215. // The total number of RPCs have ever issued for each type.
  216. // Deprecated: use stats_per_method.rpcs_started instead.
  217. map<string, int32> num_rpcs_started_by_method = 1 [deprecated = true];
  218. // The total number of RPCs have ever completed successfully for each type.
  219. // Deprecated: use stats_per_method.result instead.
  220. map<string, int32> num_rpcs_succeeded_by_method = 2 [deprecated = true];
  221. // The total number of RPCs have ever failed for each type.
  222. // Deprecated: use stats_per_method.result instead.
  223. map<string, int32> num_rpcs_failed_by_method = 3 [deprecated = true];
  224. message MethodStats {
  225. // The number of RPCs that were started for this method.
  226. int32 rpcs_started = 1;
  227. // The number of RPCs that completed with each status for this method. The
  228. // key is the integral value of a google.rpc.Code; the value is the count.
  229. map<int32, int32> result = 2;
  230. }
  231. // Per-method RPC statistics. The key is the RpcType in string form; e.g.
  232. // 'EMPTY_CALL' or 'UNARY_CALL'
  233. map<string, MethodStats> stats_per_method = 4;
  234. }
  235. // Configurations for a test client.
  236. message ClientConfigureRequest {
  237. // Type of RPCs to send.
  238. enum RpcType {
  239. EMPTY_CALL = 0;
  240. UNARY_CALL = 1;
  241. }
  242. // Metadata to be attached for the given type of RPCs.
  243. message Metadata {
  244. RpcType type = 1;
  245. string key = 2;
  246. string value = 3;
  247. }
  248. // The types of RPCs the client sends.
  249. repeated RpcType types = 1;
  250. // The collection of custom metadata to be attached to RPCs sent by the client.
  251. repeated Metadata metadata = 2;
  252. // The deadline to use, in seconds, for all RPCs. If unset or zero, the
  253. // client will use the default from the command-line.
  254. int32 timeout_sec = 3;
  255. }
  256. // Response for updating a test client's configuration.
  257. message ClientConfigureResponse {}
  258. message MemorySize {
  259. int64 rss = 1;
  260. }
  261. // Metrics data the server will update and send to the client. It mirrors orca load report
  262. // https://github.com/cncf/xds/blob/eded343319d09f30032952beda9840bbd3dcf7ac/xds/data/orca/v3/orca_load_report.proto#L15,
  263. // but avoids orca dependency. Used by both per-query and out-of-band reporting tests.
  264. message TestOrcaReport {
  265. double cpu_utilization = 1;
  266. double memory_utilization = 2;
  267. map<string, double> request_cost = 3;
  268. map<string, double> utilization = 4;
  269. }
  270. // Status that will be return to callers of the Hook method
  271. message SetReturnStatusRequest {
  272. int32 grpc_code_to_return = 1;
  273. string grpc_status_description = 2;
  274. }
  275. message HookRequest {
  276. enum HookRequestCommand {
  277. // Default value
  278. UNSPECIFIED = 0;
  279. // Start the HTTP endpoint
  280. START = 1;
  281. // Stop
  282. STOP = 2;
  283. // Return from HTTP GET/POST
  284. RETURN = 3;
  285. }
  286. HookRequestCommand command = 1;
  287. int32 grpc_code_to_return = 2;
  288. string grpc_status_description = 3;
  289. // Server port to listen to
  290. int32 server_port = 4;
  291. }
  292. message HookResponse {
  293. }