Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. // Copyright 2018 The 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. // This file defines an interface for exporting monitoring information
  15. // out of gRPC servers. See the full design at
  16. // https://github.com/grpc/proposal/blob/master/A14-channelz.md
  17. //
  18. // The canonical version of this proto can be found at
  19. // https://github.com/grpc/grpc-proto/blob/master/grpc/channelz/v1/channelz.proto
  20. syntax = "proto3";
  21. package grpc.channelz.v1;
  22. import "google/protobuf/any.proto";
  23. import "google/protobuf/duration.proto";
  24. import "google/protobuf/timestamp.proto";
  25. import "google/protobuf/wrappers.proto";
  26. option go_package = "google.golang.org/grpc/channelz/grpc_channelz_v1";
  27. option java_multiple_files = true;
  28. option java_package = "io.grpc.channelz.v1";
  29. option java_outer_classname = "ChannelzProto";
  30. // Channel is a logical grouping of channels, subchannels, and sockets.
  31. message Channel {
  32. // The identifier for this channel. This should bet set.
  33. ChannelRef ref = 1;
  34. // Data specific to this channel.
  35. ChannelData data = 2;
  36. // At most one of 'channel_ref+subchannel_ref' and 'socket' is set.
  37. // There are no ordering guarantees on the order of channel refs.
  38. // There may not be cycles in the ref graph.
  39. // A channel ref may be present in more than one channel or subchannel.
  40. repeated ChannelRef channel_ref = 3;
  41. // At most one of 'channel_ref+subchannel_ref' and 'socket' is set.
  42. // There are no ordering guarantees on the order of subchannel refs.
  43. // There may not be cycles in the ref graph.
  44. // A sub channel ref may be present in more than one channel or subchannel.
  45. repeated SubchannelRef subchannel_ref = 4;
  46. // There are no ordering guarantees on the order of sockets.
  47. repeated SocketRef socket_ref = 5;
  48. }
  49. // Subchannel is a logical grouping of channels, subchannels, and sockets.
  50. // A subchannel is load balanced over by it's ancestor
  51. message Subchannel {
  52. // The identifier for this channel.
  53. SubchannelRef ref = 1;
  54. // Data specific to this channel.
  55. ChannelData data = 2;
  56. // At most one of 'channel_ref+subchannel_ref' and 'socket' is set.
  57. // There are no ordering guarantees on the order of channel refs.
  58. // There may not be cycles in the ref graph.
  59. // A channel ref may be present in more than one channel or subchannel.
  60. repeated ChannelRef channel_ref = 3;
  61. // At most one of 'channel_ref+subchannel_ref' and 'socket' is set.
  62. // There are no ordering guarantees on the order of subchannel refs.
  63. // There may not be cycles in the ref graph.
  64. // A sub channel ref may be present in more than one channel or subchannel.
  65. repeated SubchannelRef subchannel_ref = 4;
  66. // There are no ordering guarantees on the order of sockets.
  67. repeated SocketRef socket_ref = 5;
  68. }
  69. // These come from the specified states in this document:
  70. // https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md
  71. message ChannelConnectivityState {
  72. enum State {
  73. UNKNOWN = 0;
  74. IDLE = 1;
  75. CONNECTING = 2;
  76. READY = 3;
  77. TRANSIENT_FAILURE = 4;
  78. SHUTDOWN = 5;
  79. }
  80. State state = 1;
  81. }
  82. // Channel data is data related to a specific Channel or Subchannel.
  83. message ChannelData {
  84. // The connectivity state of the channel or subchannel. Implementations
  85. // should always set this.
  86. ChannelConnectivityState state = 1;
  87. // The target this channel originally tried to connect to. May be absent
  88. string target = 2;
  89. // A trace of recent events on the channel. May be absent.
  90. ChannelTrace trace = 3;
  91. // The number of calls started on the channel
  92. int64 calls_started = 4;
  93. // The number of calls that have completed with an OK status
  94. int64 calls_succeeded = 5;
  95. // The number of calls that have completed with a non-OK status
  96. int64 calls_failed = 6;
  97. // The last time a call was started on the channel.
  98. google.protobuf.Timestamp last_call_started_timestamp = 7;
  99. }
  100. // A trace event is an interesting thing that happened to a channel or
  101. // subchannel, such as creation, address resolution, subchannel creation, etc.
  102. message ChannelTraceEvent {
  103. // High level description of the event.
  104. string description = 1;
  105. // The supported severity levels of trace events.
  106. enum Severity {
  107. CT_UNKNOWN = 0;
  108. CT_INFO = 1;
  109. CT_WARNING = 2;
  110. CT_ERROR = 3;
  111. }
  112. // the severity of the trace event
  113. Severity severity = 2;
  114. // When this event occurred.
  115. google.protobuf.Timestamp timestamp = 3;
  116. // ref of referenced channel or subchannel.
  117. // Optional, only present if this event refers to a child object. For example,
  118. // this field would be filled if this trace event was for a subchannel being
  119. // created.
  120. oneof child_ref {
  121. ChannelRef channel_ref = 4;
  122. SubchannelRef subchannel_ref = 5;
  123. }
  124. }
  125. // ChannelTrace represents the recent events that have occurred on the channel.
  126. message ChannelTrace {
  127. // Number of events ever logged in this tracing object. This can differ from
  128. // events.size() because events can be overwritten or garbage collected by
  129. // implementations.
  130. int64 num_events_logged = 1;
  131. // Time that this channel was created.
  132. google.protobuf.Timestamp creation_timestamp = 2;
  133. // List of events that have occurred on this channel.
  134. repeated ChannelTraceEvent events = 3;
  135. }
  136. // ChannelRef is a reference to a Channel.
  137. message ChannelRef {
  138. // The globally unique id for this channel. Must be a positive number.
  139. int64 channel_id = 1;
  140. // An optional name associated with the channel.
  141. string name = 2;
  142. // Intentionally don't use field numbers from other refs.
  143. reserved 3, 4, 5, 6, 7, 8;
  144. }
  145. // SubchannelRef is a reference to a Subchannel.
  146. message SubchannelRef {
  147. // The globally unique id for this subchannel. Must be a positive number.
  148. int64 subchannel_id = 7;
  149. // An optional name associated with the subchannel.
  150. string name = 8;
  151. // Intentionally don't use field numbers from other refs.
  152. reserved 1, 2, 3, 4, 5, 6;
  153. }
  154. // SocketRef is a reference to a Socket.
  155. message SocketRef {
  156. // The globally unique id for this socket. Must be a positive number.
  157. int64 socket_id = 3;
  158. // An optional name associated with the socket.
  159. string name = 4;
  160. // Intentionally don't use field numbers from other refs.
  161. reserved 1, 2, 5, 6, 7, 8;
  162. }
  163. // ServerRef is a reference to a Server.
  164. message ServerRef {
  165. // A globally unique identifier for this server. Must be a positive number.
  166. int64 server_id = 5;
  167. // An optional name associated with the server.
  168. string name = 6;
  169. // Intentionally don't use field numbers from other refs.
  170. reserved 1, 2, 3, 4, 7, 8;
  171. }
  172. // Server represents a single server. There may be multiple servers in a single
  173. // program.
  174. message Server {
  175. // The identifier for a Server. This should be set.
  176. ServerRef ref = 1;
  177. // The associated data of the Server.
  178. ServerData data = 2;
  179. // The sockets that the server is listening on. There are no ordering
  180. // guarantees. This may be absent.
  181. repeated SocketRef listen_socket = 3;
  182. }
  183. // ServerData is data for a specific Server.
  184. message ServerData {
  185. // A trace of recent events on the server. May be absent.
  186. ChannelTrace trace = 1;
  187. // The number of incoming calls started on the server
  188. int64 calls_started = 2;
  189. // The number of incoming calls that have completed with an OK status
  190. int64 calls_succeeded = 3;
  191. // The number of incoming calls that have a completed with a non-OK status
  192. int64 calls_failed = 4;
  193. // The last time a call was started on the server.
  194. google.protobuf.Timestamp last_call_started_timestamp = 5;
  195. }
  196. // Information about an actual connection. Pronounced "sock-ay".
  197. message Socket {
  198. // The identifier for the Socket.
  199. SocketRef ref = 1;
  200. // Data specific to this Socket.
  201. SocketData data = 2;
  202. // The locally bound address.
  203. Address local = 3;
  204. // The remote bound address. May be absent.
  205. Address remote = 4;
  206. // Security details for this socket. May be absent if not available, or
  207. // there is no security on the socket.
  208. Security security = 5;
  209. // Optional, represents the name of the remote endpoint, if different than
  210. // the original target name.
  211. string remote_name = 6;
  212. }
  213. // SocketData is data associated for a specific Socket. The fields present
  214. // are specific to the implementation, so there may be minor differences in
  215. // the semantics. (e.g. flow control windows)
  216. message SocketData {
  217. // The number of streams that have been started.
  218. int64 streams_started = 1;
  219. // The number of streams that have ended successfully:
  220. // On client side, received frame with eos bit set;
  221. // On server side, sent frame with eos bit set.
  222. int64 streams_succeeded = 2;
  223. // The number of streams that have ended unsuccessfully:
  224. // On client side, ended without receiving frame with eos bit set;
  225. // On server side, ended without sending frame with eos bit set.
  226. int64 streams_failed = 3;
  227. // The number of grpc messages successfully sent on this socket.
  228. int64 messages_sent = 4;
  229. // The number of grpc messages received on this socket.
  230. int64 messages_received = 5;
  231. // The number of keep alives sent. This is typically implemented with HTTP/2
  232. // ping messages.
  233. int64 keep_alives_sent = 6;
  234. // The last time a stream was created by this endpoint. Usually unset for
  235. // servers.
  236. google.protobuf.Timestamp last_local_stream_created_timestamp = 7;
  237. // The last time a stream was created by the remote endpoint. Usually unset
  238. // for clients.
  239. google.protobuf.Timestamp last_remote_stream_created_timestamp = 8;
  240. // The last time a message was sent by this endpoint.
  241. google.protobuf.Timestamp last_message_sent_timestamp = 9;
  242. // The last time a message was received by this endpoint.
  243. google.protobuf.Timestamp last_message_received_timestamp = 10;
  244. // The amount of window, granted to the local endpoint by the remote endpoint.
  245. // This may be slightly out of date due to network latency. This does NOT
  246. // include stream level or TCP level flow control info.
  247. google.protobuf.Int64Value local_flow_control_window = 11;
  248. // The amount of window, granted to the remote endpoint by the local endpoint.
  249. // This may be slightly out of date due to network latency. This does NOT
  250. // include stream level or TCP level flow control info.
  251. google.protobuf.Int64Value remote_flow_control_window = 12;
  252. // Socket options set on this socket. May be absent if 'summary' is set
  253. // on GetSocketRequest.
  254. repeated SocketOption option = 13;
  255. }
  256. // Address represents the address used to create the socket.
  257. message Address {
  258. message TcpIpAddress {
  259. // Either the IPv4 or IPv6 address in bytes. Will be either 4 bytes or 16
  260. // bytes in length.
  261. bytes ip_address = 1;
  262. // 0-64k, or -1 if not appropriate.
  263. int32 port = 2;
  264. }
  265. // A Unix Domain Socket address.
  266. message UdsAddress {
  267. string filename = 1;
  268. }
  269. // An address type not included above.
  270. message OtherAddress {
  271. // The human readable version of the value. This value should be set.
  272. string name = 1;
  273. // The actual address message.
  274. google.protobuf.Any value = 2;
  275. }
  276. oneof address {
  277. TcpIpAddress tcpip_address = 1;
  278. UdsAddress uds_address = 2;
  279. OtherAddress other_address = 3;
  280. }
  281. }
  282. // Security represents details about how secure the socket is.
  283. message Security {
  284. message Tls {
  285. oneof cipher_suite {
  286. // The cipher suite name in the RFC 4346 format:
  287. // https://tools.ietf.org/html/rfc4346#appendix-C
  288. string standard_name = 1;
  289. // Some other way to describe the cipher suite if
  290. // the RFC 4346 name is not available.
  291. string other_name = 2;
  292. }
  293. // the certificate used by this endpoint.
  294. bytes local_certificate = 3;
  295. // the certificate used by the remote endpoint.
  296. bytes remote_certificate = 4;
  297. }
  298. message OtherSecurity {
  299. // The human readable version of the value.
  300. string name = 1;
  301. // The actual security details message.
  302. google.protobuf.Any value = 2;
  303. }
  304. oneof model {
  305. Tls tls = 1;
  306. OtherSecurity other = 2;
  307. }
  308. }
  309. // SocketOption represents socket options for a socket. Specifically, these
  310. // are the options returned by getsockopt().
  311. message SocketOption {
  312. // The full name of the socket option. Typically this will be the upper case
  313. // name, such as "SO_REUSEPORT".
  314. string name = 1;
  315. // The human readable value of this socket option. At least one of value or
  316. // additional will be set.
  317. string value = 2;
  318. // Additional data associated with the socket option. At least one of value
  319. // or additional will be set.
  320. google.protobuf.Any additional = 3;
  321. }
  322. // For use with SocketOption's additional field. This is primarily used for
  323. // SO_RCVTIMEO and SO_SNDTIMEO
  324. message SocketOptionTimeout {
  325. google.protobuf.Duration duration = 1;
  326. }
  327. // For use with SocketOption's additional field. This is primarily used for
  328. // SO_LINGER.
  329. message SocketOptionLinger {
  330. // active maps to `struct linger.l_onoff`
  331. bool active = 1;
  332. // duration maps to `struct linger.l_linger`
  333. google.protobuf.Duration duration = 2;
  334. }
  335. // For use with SocketOption's additional field. Tcp info for
  336. // SOL_TCP and TCP_INFO.
  337. message SocketOptionTcpInfo {
  338. uint32 tcpi_state = 1;
  339. uint32 tcpi_ca_state = 2;
  340. uint32 tcpi_retransmits = 3;
  341. uint32 tcpi_probes = 4;
  342. uint32 tcpi_backoff = 5;
  343. uint32 tcpi_options = 6;
  344. uint32 tcpi_snd_wscale = 7;
  345. uint32 tcpi_rcv_wscale = 8;
  346. uint32 tcpi_rto = 9;
  347. uint32 tcpi_ato = 10;
  348. uint32 tcpi_snd_mss = 11;
  349. uint32 tcpi_rcv_mss = 12;
  350. uint32 tcpi_unacked = 13;
  351. uint32 tcpi_sacked = 14;
  352. uint32 tcpi_lost = 15;
  353. uint32 tcpi_retrans = 16;
  354. uint32 tcpi_fackets = 17;
  355. uint32 tcpi_last_data_sent = 18;
  356. uint32 tcpi_last_ack_sent = 19;
  357. uint32 tcpi_last_data_recv = 20;
  358. uint32 tcpi_last_ack_recv = 21;
  359. uint32 tcpi_pmtu = 22;
  360. uint32 tcpi_rcv_ssthresh = 23;
  361. uint32 tcpi_rtt = 24;
  362. uint32 tcpi_rttvar = 25;
  363. uint32 tcpi_snd_ssthresh = 26;
  364. uint32 tcpi_snd_cwnd = 27;
  365. uint32 tcpi_advmss = 28;
  366. uint32 tcpi_reordering = 29;
  367. }
  368. // Channelz is a service exposed by gRPC servers that provides detailed debug
  369. // information.
  370. service Channelz {
  371. // Gets all root channels (i.e. channels the application has directly
  372. // created). This does not include subchannels nor non-top level channels.
  373. rpc GetTopChannels(GetTopChannelsRequest) returns (GetTopChannelsResponse);
  374. // Gets all servers that exist in the process.
  375. rpc GetServers(GetServersRequest) returns (GetServersResponse);
  376. // Returns a single Server, or else a NOT_FOUND code.
  377. rpc GetServer(GetServerRequest) returns (GetServerResponse);
  378. // Gets all server sockets that exist in the process.
  379. rpc GetServerSockets(GetServerSocketsRequest) returns (GetServerSocketsResponse);
  380. // Returns a single Channel, or else a NOT_FOUND code.
  381. rpc GetChannel(GetChannelRequest) returns (GetChannelResponse);
  382. // Returns a single Subchannel, or else a NOT_FOUND code.
  383. rpc GetSubchannel(GetSubchannelRequest) returns (GetSubchannelResponse);
  384. // Returns a single Socket or else a NOT_FOUND code.
  385. rpc GetSocket(GetSocketRequest) returns (GetSocketResponse);
  386. }
  387. message GetTopChannelsRequest {
  388. // start_channel_id indicates that only channels at or above this id should be
  389. // included in the results.
  390. // To request the first page, this should be set to 0. To request
  391. // subsequent pages, the client generates this value by adding 1 to
  392. // the highest seen result ID.
  393. int64 start_channel_id = 1;
  394. // If non-zero, the server will return a page of results containing
  395. // at most this many items. If zero, the server will choose a
  396. // reasonable page size. Must never be negative.
  397. int64 max_results = 2;
  398. }
  399. message GetTopChannelsResponse {
  400. // list of channels that the connection detail service knows about. Sorted in
  401. // ascending channel_id order.
  402. // Must contain at least 1 result, otherwise 'end' must be true.
  403. repeated Channel channel = 1;
  404. // If set, indicates that the list of channels is the final list. Requesting
  405. // more channels can only return more if they are created after this RPC
  406. // completes.
  407. bool end = 2;
  408. }
  409. message GetServersRequest {
  410. // start_server_id indicates that only servers at or above this id should be
  411. // included in the results.
  412. // To request the first page, this must be set to 0. To request
  413. // subsequent pages, the client generates this value by adding 1 to
  414. // the highest seen result ID.
  415. int64 start_server_id = 1;
  416. // If non-zero, the server will return a page of results containing
  417. // at most this many items. If zero, the server will choose a
  418. // reasonable page size. Must never be negative.
  419. int64 max_results = 2;
  420. }
  421. message GetServersResponse {
  422. // list of servers that the connection detail service knows about. Sorted in
  423. // ascending server_id order.
  424. // Must contain at least 1 result, otherwise 'end' must be true.
  425. repeated Server server = 1;
  426. // If set, indicates that the list of servers is the final list. Requesting
  427. // more servers will only return more if they are created after this RPC
  428. // completes.
  429. bool end = 2;
  430. }
  431. message GetServerRequest {
  432. // server_id is the identifier of the specific server to get.
  433. int64 server_id = 1;
  434. }
  435. message GetServerResponse {
  436. // The Server that corresponds to the requested server_id. This field
  437. // should be set.
  438. Server server = 1;
  439. }
  440. message GetServerSocketsRequest {
  441. int64 server_id = 1;
  442. // start_socket_id indicates that only sockets at or above this id should be
  443. // included in the results.
  444. // To request the first page, this must be set to 0. To request
  445. // subsequent pages, the client generates this value by adding 1 to
  446. // the highest seen result ID.
  447. int64 start_socket_id = 2;
  448. // If non-zero, the server will return a page of results containing
  449. // at most this many items. If zero, the server will choose a
  450. // reasonable page size. Must never be negative.
  451. int64 max_results = 3;
  452. }
  453. message GetServerSocketsResponse {
  454. // list of socket refs that the connection detail service knows about. Sorted in
  455. // ascending socket_id order.
  456. // Must contain at least 1 result, otherwise 'end' must be true.
  457. repeated SocketRef socket_ref = 1;
  458. // If set, indicates that the list of sockets is the final list. Requesting
  459. // more sockets will only return more if they are created after this RPC
  460. // completes.
  461. bool end = 2;
  462. }
  463. message GetChannelRequest {
  464. // channel_id is the identifier of the specific channel to get.
  465. int64 channel_id = 1;
  466. }
  467. message GetChannelResponse {
  468. // The Channel that corresponds to the requested channel_id. This field
  469. // should be set.
  470. Channel channel = 1;
  471. }
  472. message GetSubchannelRequest {
  473. // subchannel_id is the identifier of the specific subchannel to get.
  474. int64 subchannel_id = 1;
  475. }
  476. message GetSubchannelResponse {
  477. // The Subchannel that corresponds to the requested subchannel_id. This
  478. // field should be set.
  479. Subchannel subchannel = 1;
  480. }
  481. message GetSocketRequest {
  482. // socket_id is the identifier of the specific socket to get.
  483. int64 socket_id = 1;
  484. // If true, the response will contain only high level information
  485. // that is inexpensive to obtain. Fields thay may be omitted are
  486. // documented.
  487. bool summary = 2;
  488. }
  489. message GetSocketResponse {
  490. // The Socket that corresponds to the requested socket_id. This field
  491. // should be set.
  492. Socket socket = 1;
  493. }