grpc 1.75.0.pre1 → 1.76.0.pre1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +18 -5
  3. data/include/grpc/credentials.h +21 -5
  4. data/src/core/call/call_filters.cc +4 -4
  5. data/src/core/call/call_filters.h +36 -36
  6. data/src/core/call/call_spine.h +27 -27
  7. data/src/core/call/client_call.cc +6 -5
  8. data/src/core/call/filter_fusion.h +5 -5
  9. data/src/core/call/metadata_batch.h +3 -3
  10. data/src/core/call/security_context.cc +1 -1
  11. data/src/core/call/server_call.cc +4 -4
  12. data/src/core/call/server_call.h +1 -1
  13. data/src/core/channelz/channelz.cc +12 -18
  14. data/src/core/channelz/channelz.h +32 -16
  15. data/src/core/channelz/channelz_registry.h +11 -0
  16. data/src/core/channelz/property_list.cc +18 -0
  17. data/src/core/channelz/property_list.h +10 -1
  18. data/src/core/channelz/text_encode.cc +66 -0
  19. data/src/core/channelz/text_encode.h +29 -0
  20. data/src/core/channelz/v2tov1/convert.cc +11 -0
  21. data/src/core/channelz/v2tov1/legacy_api.cc +15 -8
  22. data/src/core/channelz/ztrace_collector.h +247 -86
  23. data/src/core/client_channel/backup_poller.cc +5 -6
  24. data/src/core/client_channel/client_channel.cc +20 -13
  25. data/src/core/client_channel/client_channel_filter.cc +53 -45
  26. data/src/core/client_channel/client_channel_filter.h +2 -2
  27. data/src/core/client_channel/client_channel_internal.h +3 -4
  28. data/src/core/client_channel/config_selector.h +3 -3
  29. data/src/core/client_channel/dynamic_filters.cc +3 -3
  30. data/src/core/client_channel/global_subchannel_pool.cc +0 -37
  31. data/src/core/client_channel/global_subchannel_pool.h +0 -27
  32. data/src/core/client_channel/load_balanced_call_destination.cc +7 -7
  33. data/src/core/client_channel/local_subchannel_pool.cc +4 -4
  34. data/src/core/client_channel/retry_filter.h +3 -3
  35. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
  36. data/src/core/client_channel/subchannel.cc +8 -8
  37. data/src/core/client_channel/subchannel_stream_client.cc +4 -4
  38. data/src/core/config/config_vars.cc +30 -1
  39. data/src/core/config/config_vars.h +21 -0
  40. data/src/core/config/core_configuration.cc +5 -5
  41. data/src/core/config/core_configuration.h +7 -7
  42. data/src/core/config/load_config.cc +12 -0
  43. data/src/core/config/load_config.h +2 -0
  44. data/src/core/credentials/call/call_credentials.h +2 -2
  45. data/src/core/credentials/call/call_creds_util.cc +4 -3
  46. data/src/core/credentials/call/composite/composite_call_credentials.cc +4 -4
  47. data/src/core/credentials/call/external/aws_external_account_credentials.cc +3 -3
  48. data/src/core/credentials/call/external/external_account_credentials.cc +1 -1
  49. data/src/core/credentials/call/external/url_external_account_credentials.cc +1 -1
  50. data/src/core/credentials/call/iam/iam_credentials.cc +4 -4
  51. data/src/core/credentials/call/jwt/json_token.cc +3 -3
  52. data/src/core/credentials/call/jwt/jwt_credentials.cc +2 -2
  53. data/src/core/credentials/call/jwt/jwt_verifier.cc +14 -13
  54. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +20 -12
  55. data/src/core/credentials/call/plugin/plugin_credentials.cc +2 -2
  56. data/src/core/credentials/transport/alts/alts_credentials.cc +4 -4
  57. data/src/core/credentials/transport/alts/alts_security_connector.cc +14 -12
  58. data/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc +22 -2
  59. data/src/core/credentials/transport/alts/grpc_alts_credentials_options.cc +10 -1
  60. data/src/core/credentials/transport/alts/grpc_alts_credentials_options.h +31 -0
  61. data/src/core/credentials/transport/alts/grpc_alts_credentials_server_options.cc +8 -3
  62. data/src/core/credentials/transport/composite/composite_channel_credentials.cc +5 -5
  63. data/src/core/credentials/transport/fake/fake_security_connector.cc +2 -2
  64. data/src/core/credentials/transport/google_default/google_default_credentials.cc +78 -28
  65. data/src/core/credentials/transport/insecure/insecure_security_connector.cc +3 -3
  66. data/src/core/credentials/transport/local/local_security_connector.cc +8 -8
  67. data/src/core/credentials/transport/security_connector.cc +5 -5
  68. data/src/core/credentials/transport/ssl/ssl_credentials.cc +12 -12
  69. data/src/core/credentials/transport/ssl/ssl_credentials.h +2 -2
  70. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +3 -3
  71. data/src/core/credentials/transport/tls/certificate_provider_registry.cc +2 -2
  72. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +24 -24
  73. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +5 -5
  74. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +2 -2
  75. data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +2 -2
  76. data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.h +2 -2
  77. data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +17 -17
  78. data/src/core/credentials/transport/tls/ssl_utils.cc +14 -9
  79. data/src/core/credentials/transport/tls/tls_credentials.cc +2 -2
  80. data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -11
  81. data/src/core/credentials/transport/transport_credentials.cc +2 -2
  82. data/src/core/credentials/transport/transport_credentials.h +2 -2
  83. data/src/core/credentials/transport/xds/xds_credentials.cc +5 -5
  84. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +2 -0
  85. data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +1 -1
  86. data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
  87. data/src/core/ext/filters/http/message_compress/compression_filter.h +3 -3
  88. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +7 -7
  89. data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -2
  90. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -9
  91. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +10 -7
  92. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
  93. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +6 -6
  94. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +96 -88
  95. data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
  96. data/src/core/ext/transport/chttp2/transport/flow_control.h +12 -7
  97. data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +60 -0
  98. data/src/core/ext/transport/chttp2/transport/frame.cc +32 -10
  99. data/src/core/ext/transport/chttp2/transport/frame.h +16 -2
  100. data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -2
  101. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -4
  102. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -2
  103. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -2
  104. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -3
  105. data/src/core/ext/transport/chttp2/transport/header_assembler.h +28 -12
  106. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
  107. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
  108. data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +8 -8
  109. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +2 -2
  110. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
  111. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -27
  112. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
  113. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  114. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +543 -366
  115. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +198 -277
  116. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +3 -0
  117. data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +11 -0
  118. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +179 -0
  119. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +51 -23
  120. data/src/core/ext/transport/chttp2/transport/http2_transport.h +13 -6
  121. data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +115 -71
  122. data/src/core/ext/transport/chttp2/transport/internal.h +6 -14
  123. data/src/core/ext/transport/chttp2/transport/message_assembler.h +7 -7
  124. data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -15
  125. data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
  126. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +62 -26
  127. data/src/core/ext/transport/chttp2/transport/ping_promise.h +58 -22
  128. data/src/core/ext/transport/chttp2/transport/stream.h +207 -0
  129. data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +328 -187
  130. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +7 -7
  131. data/src/core/ext/transport/chttp2/transport/transport_common.cc +17 -1
  132. data/src/core/ext/transport/chttp2/transport/transport_common.h +52 -0
  133. data/src/core/ext/transport/chttp2/transport/varint.h +2 -2
  134. data/src/core/ext/transport/chttp2/transport/writable_streams.h +181 -79
  135. data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +2 -2
  136. data/src/core/ext/transport/chttp2/transport/writing.cc +3 -3
  137. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
  138. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +3 -3
  139. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +740 -0
  140. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +218 -0
  141. data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +46 -0
  142. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +87 -55
  143. data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +23 -21
  144. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c +80 -0
  145. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.h +47 -0
  146. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.c +129 -0
  147. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.h +72 -0
  148. data/src/core/filter/auth/server_auth_filter.cc +2 -2
  149. data/src/core/handshaker/handshaker.cc +3 -3
  150. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +2 -2
  151. data/src/core/handshaker/security/legacy_secure_endpoint.cc +2 -2
  152. data/src/core/handshaker/security/pipelined_secure_endpoint.cc +31 -8
  153. data/src/core/handshaker/security/secure_endpoint.cc +16 -6
  154. data/src/core/handshaker/security/security_handshaker.cc +3 -3
  155. data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +2 -2
  156. data/src/core/lib/channel/channel_stack.cc +8 -5
  157. data/src/core/lib/channel/channel_stack.h +3 -0
  158. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -0
  159. data/src/core/lib/channel/connected_channel.cc +2 -2
  160. data/src/core/lib/channel/promise_based_filter.cc +69 -64
  161. data/src/core/lib/channel/promise_based_filter.h +16 -15
  162. data/src/core/lib/compression/compression_internal.cc +2 -2
  163. data/src/core/lib/compression/message_compress.cc +7 -7
  164. data/src/core/lib/event_engine/ares_resolver.cc +22 -20
  165. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -2
  166. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +2 -2
  167. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -2
  168. data/src/core/lib/event_engine/extensions/channelz.h +2 -2
  169. data/src/core/lib/event_engine/extensions/supports_fd.h +5 -5
  170. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +8 -8
  171. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -10
  172. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -2
  173. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +23 -22
  174. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +11 -11
  175. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +168 -170
  176. data/src/core/lib/event_engine/posix_engine/posix_engine.h +33 -54
  177. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -3
  178. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +5 -5
  179. data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
  180. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
  181. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +3 -3
  182. data/src/core/lib/event_engine/resolved_address.cc +3 -3
  183. data/src/core/lib/event_engine/shim.cc +8 -11
  184. data/src/core/lib/event_engine/shim.h +2 -1
  185. data/src/core/lib/event_engine/slice.cc +2 -2
  186. data/src/core/lib/event_engine/tcp_socket_utils.cc +11 -11
  187. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +7 -7
  188. data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -31
  189. data/src/core/lib/event_engine/windows/iocp.cc +10 -10
  190. data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
  191. data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -11
  192. data/src/core/lib/event_engine/windows/windows_engine.cc +16 -14
  193. data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
  194. data/src/core/lib/experiments/experiments.cc +105 -18
  195. data/src/core/lib/experiments/experiments.h +43 -11
  196. data/src/core/lib/iomgr/call_combiner.cc +3 -3
  197. data/src/core/lib/iomgr/endpoint_cfstream.cc +6 -6
  198. data/src/core/lib/iomgr/endpoint_pair_posix.cc +5 -5
  199. data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -14
  200. data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -15
  201. data/src/core/lib/iomgr/ev_poll_posix.cc +11 -11
  202. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +5 -4
  203. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -1
  204. data/src/core/lib/iomgr/iocp_windows.cc +8 -8
  205. data/src/core/lib/iomgr/iomgr_windows.cc +3 -3
  206. data/src/core/lib/iomgr/lockfree_event.cc +2 -2
  207. data/src/core/lib/iomgr/polling_entity.cc +3 -3
  208. data/src/core/lib/iomgr/socket_utils_common_posix.cc +2 -2
  209. data/src/core/lib/iomgr/socket_windows.cc +4 -4
  210. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
  211. data/src/core/lib/iomgr/tcp_client_windows.cc +4 -4
  212. data/src/core/lib/iomgr/tcp_posix.cc +42 -42
  213. data/src/core/lib/iomgr/tcp_server.cc +5 -0
  214. data/src/core/lib/iomgr/tcp_server.h +7 -0
  215. data/src/core/lib/iomgr/tcp_server_posix.cc +47 -27
  216. data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
  217. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -5
  218. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
  219. data/src/core/lib/iomgr/tcp_server_windows.cc +68 -29
  220. data/src/core/lib/iomgr/tcp_windows.cc +7 -7
  221. data/src/core/lib/iomgr/timer_generic.cc +2 -2
  222. data/src/core/lib/iomgr/timer_manager.cc +2 -2
  223. data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
  224. data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -2
  225. data/src/core/lib/promise/activity.cc +2 -2
  226. data/src/core/lib/promise/activity.h +6 -6
  227. data/src/core/lib/promise/context.h +2 -2
  228. data/src/core/lib/promise/detail/join_state.h +9 -9
  229. data/src/core/lib/promise/detail/seq_state.h +13 -13
  230. data/src/core/lib/promise/detail/status.h +2 -2
  231. data/src/core/lib/promise/for_each.h +5 -5
  232. data/src/core/lib/promise/interceptor_list.h +2 -2
  233. data/src/core/lib/promise/latch.h +7 -7
  234. data/src/core/lib/promise/mpsc.cc +26 -26
  235. data/src/core/lib/promise/mpsc.h +2 -2
  236. data/src/core/lib/promise/observable.h +4 -4
  237. data/src/core/lib/promise/party.cc +32 -25
  238. data/src/core/lib/promise/party.h +16 -19
  239. data/src/core/lib/promise/pipe.h +15 -15
  240. data/src/core/lib/promise/poll.h +5 -4
  241. data/src/core/lib/promise/promise.h +0 -2
  242. data/src/core/lib/promise/sleep.cc +3 -1
  243. data/src/core/lib/promise/status_flag.h +7 -7
  244. data/src/core/lib/promise/try_join.h +2 -2
  245. data/src/core/lib/promise/try_seq.h +2 -2
  246. data/src/core/lib/resource_quota/arena.h +15 -2
  247. data/src/core/lib/resource_quota/connection_quota.cc +9 -7
  248. data/src/core/lib/resource_quota/memory_quota.cc +45 -24
  249. data/src/core/lib/resource_quota/memory_quota.h +48 -16
  250. data/src/core/lib/resource_quota/telemetry.h +54 -0
  251. data/src/core/lib/resource_quota/thread_quota.cc +2 -2
  252. data/src/core/lib/resource_tracker/resource_tracker.cc +33 -0
  253. data/src/core/lib/resource_tracker/resource_tracker.h +46 -0
  254. data/src/core/lib/security/authorization/audit_logging.cc +5 -5
  255. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +2 -2
  256. data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
  257. data/src/core/lib/surface/byte_buffer_reader.cc +2 -2
  258. data/src/core/lib/surface/call.cc +16 -14
  259. data/src/core/lib/surface/call.h +1 -1
  260. data/src/core/lib/surface/call_utils.cc +2 -2
  261. data/src/core/lib/surface/call_utils.h +2 -2
  262. data/src/core/lib/surface/channel.cc +4 -4
  263. data/src/core/lib/surface/channel_create.cc +10 -6
  264. data/src/core/lib/surface/channel_init.cc +80 -23
  265. data/src/core/lib/surface/channel_init.h +26 -11
  266. data/src/core/lib/surface/completion_queue.cc +17 -16
  267. data/src/core/lib/surface/completion_queue_factory.cc +7 -7
  268. data/src/core/lib/surface/connection_context.h +45 -2
  269. data/src/core/lib/surface/filter_stack_call.cc +12 -23
  270. data/src/core/lib/surface/filter_stack_call.h +3 -4
  271. data/src/core/lib/surface/legacy_channel.cc +7 -7
  272. data/src/core/lib/surface/validate_metadata.h +2 -2
  273. data/src/core/lib/surface/version.cc +2 -2
  274. data/src/core/lib/transport/bdp_estimator.cc +2 -2
  275. data/src/core/lib/transport/bdp_estimator.h +3 -3
  276. data/src/core/lib/transport/promise_endpoint.cc +3 -3
  277. data/src/core/lib/transport/promise_endpoint.h +8 -8
  278. data/src/core/lib/transport/timeout_encoding.cc +4 -4
  279. data/src/core/load_balancing/child_policy_handler.cc +4 -4
  280. data/src/core/load_balancing/endpoint_list.cc +2 -2
  281. data/src/core/load_balancing/grpclb/grpclb.cc +24 -24
  282. data/src/core/load_balancing/health_check_client.cc +4 -4
  283. data/src/core/load_balancing/health_check_client_internal.h +2 -2
  284. data/src/core/load_balancing/lb_policy_registry.cc +2 -2
  285. data/src/core/load_balancing/oob_backend_metric.cc +4 -4
  286. data/src/core/load_balancing/oob_backend_metric_internal.h +2 -2
  287. data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
  288. data/src/core/load_balancing/pick_first/pick_first.cc +14 -14
  289. data/src/core/load_balancing/priority/priority.cc +23 -24
  290. data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -3
  291. data/src/core/load_balancing/rls/rls.cc +13 -13
  292. data/src/core/load_balancing/round_robin/round_robin.cc +9 -9
  293. data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +3 -3
  294. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -26
  295. data/src/core/load_balancing/weighted_target/weighted_target.cc +5 -5
  296. data/src/core/load_balancing/xds/cds.cc +76 -32
  297. data/src/core/load_balancing/xds/xds_cluster_impl.cc +3 -3
  298. data/src/core/load_balancing/xds/xds_override_host.cc +4 -4
  299. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
  300. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +33 -33
  301. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -10
  302. data/src/core/resolver/dns/dns_resolver_plugin.cc +6 -3
  303. data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +2 -2
  304. data/src/core/resolver/endpoint_addresses.cc +3 -3
  305. data/src/core/resolver/endpoint_addresses.h +3 -0
  306. data/src/core/resolver/fake/fake_resolver.cc +2 -2
  307. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +41 -54
  308. data/src/core/resolver/polling_resolver.cc +3 -3
  309. data/src/core/resolver/resolver_registry.cc +5 -4
  310. data/src/core/resolver/xds/xds_dependency_manager.cc +5 -5
  311. data/src/core/resolver/xds/xds_resolver.cc +9 -9
  312. data/src/core/server/server.cc +38 -38
  313. data/src/core/server/server_call_tracer_filter.h +4 -4
  314. data/src/core/server/server_config_selector_filter.cc +2 -2
  315. data/src/core/server/xds_server_config_fetcher.cc +9 -8
  316. data/src/core/service_config/service_config_impl.h +2 -2
  317. data/src/core/telemetry/call_tracer.cc +39 -49
  318. data/src/core/telemetry/call_tracer.h +199 -22
  319. data/src/core/telemetry/histogram.h +205 -0
  320. data/src/core/telemetry/instrument.cc +719 -0
  321. data/src/core/telemetry/instrument.h +932 -0
  322. data/src/core/telemetry/metrics.cc +13 -5
  323. data/src/core/telemetry/metrics.h +3 -1
  324. data/src/core/telemetry/stats_data.cc +0 -19
  325. data/src/core/telemetry/stats_data.h +0 -19
  326. data/src/core/transport/auth_context.cc +2 -2
  327. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +78 -45
  328. data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -0
  329. data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +3 -3
  330. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -31
  331. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -3
  332. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +3 -3
  333. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +7 -7
  334. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
  335. data/src/core/tsi/fake_transport_security.cc +4 -4
  336. data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +4 -4
  337. data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +9 -9
  338. data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -3
  339. data/src/core/tsi/ssl_transport_security.cc +26 -25
  340. data/src/core/tsi/ssl_transport_security_utils.cc +9 -9
  341. data/src/core/util/chunked_vector.h +4 -4
  342. data/src/core/util/event_log.cc +2 -2
  343. data/src/core/util/gcp_metadata_query.cc +2 -2
  344. data/src/core/util/grpc_check.cc +22 -0
  345. data/src/core/util/grpc_check.h +103 -0
  346. data/src/core/util/http_client/httpcli.cc +3 -3
  347. data/src/core/util/http_client/parser.cc +4 -4
  348. data/src/core/util/latent_see.h +7 -4
  349. data/src/core/util/lru_cache.h +4 -4
  350. data/src/core/util/memory_usage.h +16 -0
  351. data/src/core/util/posix/directory_reader.cc +3 -2
  352. data/src/core/util/posix/sync.cc +24 -24
  353. data/src/core/util/postmortem_emit.cc +52 -0
  354. data/src/core/util/postmortem_emit.h +30 -0
  355. data/src/core/util/ref_counted_ptr.h +5 -0
  356. data/src/core/util/trie_lookup.h +170 -0
  357. data/src/core/util/unique_ptr_with_bitset.h +5 -5
  358. data/src/core/xds/grpc/xds_bootstrap_grpc.h +6 -1
  359. data/src/core/xds/grpc/xds_certificate_provider.cc +3 -3
  360. data/src/core/xds/grpc/xds_client_grpc.cc +34 -15
  361. data/src/core/xds/grpc/xds_client_grpc.h +4 -1
  362. data/src/core/xds/grpc/xds_cluster_parser.cc +2 -2
  363. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
  364. data/src/core/xds/grpc/xds_endpoint_parser.cc +2 -2
  365. data/src/core/xds/grpc/xds_http_filter_registry.cc +4 -3
  366. data/src/core/xds/grpc/xds_listener_parser.cc +3 -3
  367. data/src/core/xds/grpc/xds_matcher.cc +277 -0
  368. data/src/core/xds/grpc/xds_matcher.h +432 -0
  369. data/src/core/xds/grpc/xds_matcher_action.cc +47 -0
  370. data/src/core/xds/grpc/xds_matcher_action.h +48 -0
  371. data/src/core/xds/grpc/xds_matcher_context.cc +29 -0
  372. data/src/core/xds/grpc/xds_matcher_context.h +46 -0
  373. data/src/core/xds/grpc/xds_matcher_input.cc +79 -0
  374. data/src/core/xds/grpc/xds_matcher_input.h +105 -0
  375. data/src/core/xds/grpc/xds_matcher_parse.cc +356 -0
  376. data/src/core/xds/grpc/xds_matcher_parse.h +39 -0
  377. data/src/core/xds/grpc/xds_metadata.cc +4 -3
  378. data/src/core/xds/grpc/xds_route_config_parser.cc +6 -6
  379. data/src/core/xds/grpc/xds_routing.cc +3 -3
  380. data/src/core/xds/grpc/xds_transport_grpc.cc +10 -10
  381. data/src/core/xds/xds_client/lrs_client.cc +6 -6
  382. data/src/core/xds/xds_client/xds_client.cc +9 -9
  383. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -2
  384. data/src/ruby/lib/grpc/version.rb +1 -1
  385. data/third_party/abseil-cpp/absl/container/internal/node_slot_policy.h +95 -0
  386. data/third_party/abseil-cpp/absl/container/node_hash_map.h +687 -0
  387. metadata +37 -2
@@ -31,8 +31,8 @@
31
31
  #include <memory>
32
32
  #include <optional>
33
33
  #include <string>
34
+ #include <utility>
34
35
 
35
- #include "absl/log/check.h"
36
36
  #include "absl/log/log.h"
37
37
  #include "absl/status/statusor.h"
38
38
  #include "absl/strings/match.h"
@@ -60,6 +60,7 @@
60
60
  #include "src/core/load_balancing/grpclb/grpclb.h"
61
61
  #include "src/core/load_balancing/xds/xds_channel_args.h"
62
62
  #include "src/core/util/env.h"
63
+ #include "src/core/util/grpc_check.h"
63
64
  #include "src/core/util/http_client/httpcli.h"
64
65
  #include "src/core/util/http_client/parser.h"
65
66
  #include "src/core/util/json/json.h"
@@ -221,7 +222,7 @@ static int is_metadata_server_reachable() {
221
222
  auto uri = grpc_core::URI::Create("http", /*user_info=*/"",
222
223
  GRPC_COMPUTE_ENGINE_DETECTION_HOST, "/",
223
224
  {} /* query params */, "" /* fragment */);
224
- CHECK(uri.ok()); // params are hardcoded
225
+ GRPC_CHECK(uri.ok()); // params are hardcoded
225
226
  auto http_request = grpc_core::HttpRequest::Get(
226
227
  std::move(*uri), nullptr /* channel args */, &detector.pollent, &request,
227
228
  grpc_core::Timestamp::Now() + max_detection_delay,
@@ -339,6 +340,8 @@ static bool metadata_server_available() {
339
340
  return static_cast<bool>(g_metadata_server_available);
340
341
  }
341
342
 
343
+ namespace {
344
+
342
345
  // A grpc_call_credentials implementation that uses two
343
346
  // underlying credentials: one for TLS and one for ALTS.
344
347
  // The implementation will pick the right credentials based on the auth
@@ -398,24 +401,42 @@ class GoogleDefaultCallCredentialsWrapper : public grpc_call_credentials {
398
401
  grpc_core::RefCountedPtr<grpc_call_credentials> alts_credentials_;
399
402
  };
400
403
 
401
- static grpc_core::RefCountedPtr<grpc_call_credentials> make_default_call_creds(
402
- grpc_error_handle* error) {
404
+ enum class DefaultCallCredentialsCreationMethod {
405
+ kNone,
406
+ kFromEnviromentPathValue,
407
+ kFromWellKnownFile,
408
+ kFromDefaultGCE,
409
+ };
410
+
411
+ absl::StatusOr<std::pair<grpc_core::RefCountedPtr<grpc_call_credentials>,
412
+ DefaultCallCredentialsCreationMethod>>
413
+ CreateGoogleDefaultCallCredentials() {
414
+ DefaultCallCredentialsCreationMethod default_credentials_type;
403
415
  grpc_core::RefCountedPtr<grpc_call_credentials> call_creds;
404
- grpc_error_handle err;
416
+ grpc_error_handle return_status;
417
+ grpc_error_handle child_error;
405
418
 
406
419
  // First, try the environment variable.
407
420
  auto path_from_env = grpc_core::GetEnv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR);
408
421
  if (path_from_env.has_value()) {
409
- err = create_default_creds_from_path(*path_from_env, &call_creds);
410
- if (err.ok()) return call_creds;
411
- *error = grpc_error_add_child(*error, err);
422
+ child_error = create_default_creds_from_path(*path_from_env, &call_creds);
423
+ if (child_error.ok()) {
424
+ default_credentials_type =
425
+ DefaultCallCredentialsCreationMethod::kFromEnviromentPathValue;
426
+ return std::pair(call_creds, default_credentials_type);
427
+ }
428
+ return_status = grpc_error_add_child(return_status, child_error);
412
429
  }
413
430
 
414
431
  // Then the well-known file.
415
- err = create_default_creds_from_path(
432
+ child_error = create_default_creds_from_path(
416
433
  grpc_get_well_known_google_credentials_file_path(), &call_creds);
417
- if (err.ok()) return call_creds;
418
- *error = grpc_error_add_child(*error, err);
434
+ if (child_error.ok()) {
435
+ default_credentials_type =
436
+ DefaultCallCredentialsCreationMethod::kFromWellKnownFile;
437
+ return std::pair(call_creds, default_credentials_type);
438
+ }
439
+ return_status = grpc_error_add_child(return_status, child_error);
419
440
 
420
441
  update_tenancy();
421
442
 
@@ -423,18 +444,26 @@ static grpc_core::RefCountedPtr<grpc_call_credentials> make_default_call_creds(
423
444
  call_creds = grpc_core::RefCountedPtr<grpc_call_credentials>(
424
445
  grpc_google_compute_engine_credentials_create(nullptr));
425
446
  if (call_creds == nullptr) {
426
- *error = GRPC_ERROR_CREATE(GRPC_GOOGLE_CREDENTIAL_CREATION_ERROR);
427
- *error = grpc_error_add_child(
428
- *error, GRPC_ERROR_CREATE("Failed to get credentials from network"));
447
+ return_status = GRPC_ERROR_CREATE(GRPC_GOOGLE_CREDENTIAL_CREATION_ERROR);
448
+ return_status = grpc_error_add_child(
449
+ return_status,
450
+ GRPC_ERROR_CREATE("Failed to get credentials from network"));
451
+ return return_status;
429
452
  }
453
+ default_credentials_type =
454
+ DefaultCallCredentialsCreationMethod::kFromDefaultGCE;
430
455
  }
431
456
 
432
- return call_creds;
457
+ return std::pair(call_creds, default_credentials_type);
433
458
  }
434
459
 
460
+ } // namespace
461
+
435
462
  grpc_channel_credentials* grpc_google_default_credentials_create(
436
463
  grpc_call_credentials* call_creds_for_tls,
437
- grpc_call_credentials* call_creds_for_alts) {
464
+ grpc_google_default_credentials_options* options) {
465
+ DefaultCallCredentialsCreationMethod default_credentials_type =
466
+ DefaultCallCredentialsCreationMethod::kNone;
438
467
  grpc_channel_credentials* result = nullptr;
439
468
  grpc_core::RefCountedPtr<grpc_call_credentials> call_creds(
440
469
  call_creds_for_tls);
@@ -445,33 +474,54 @@ grpc_channel_credentials* grpc_google_default_credentials_create(
445
474
  << "grpc_google_default_credentials_create(" << call_creds_for_tls << ")";
446
475
 
447
476
  if (call_creds == nullptr) {
448
- call_creds = make_default_call_creds(&error);
477
+ auto create_default_creds_status = CreateGoogleDefaultCallCredentials();
478
+
479
+ if (!create_default_creds_status.ok()) {
480
+ LOG(ERROR) << "Could not create google default credentials: "
481
+ << grpc_core::StatusToString(
482
+ create_default_creds_status.status());
483
+ } else {
484
+ call_creds = create_default_creds_status->first;
485
+ default_credentials_type = create_default_creds_status->second;
486
+ }
449
487
  }
450
488
 
451
489
  if (call_creds != nullptr) {
452
490
  // Create google default credentials.
453
491
  grpc_channel_credentials* ssl_creds =
454
492
  grpc_ssl_credentials_create(nullptr, nullptr, nullptr, nullptr);
455
- CHECK_NE(ssl_creds, nullptr);
456
- grpc_alts_credentials_options* options =
493
+ GRPC_CHECK_NE(ssl_creds, nullptr);
494
+ grpc_alts_credentials_options* credentials_options =
457
495
  grpc_alts_credentials_client_options_create();
458
496
  grpc_channel_credentials* alts_creds =
459
- grpc_alts_credentials_create(options);
460
- grpc_alts_credentials_options_destroy(options);
497
+ grpc_alts_credentials_create(credentials_options);
498
+ grpc_alts_credentials_options_destroy(credentials_options);
461
499
  auto creds =
462
500
  grpc_core::MakeRefCounted<grpc_google_default_channel_credentials>(
463
501
  grpc_core::RefCountedPtr<grpc_channel_credentials>(alts_creds),
464
502
  grpc_core::RefCountedPtr<grpc_channel_credentials>(ssl_creds));
465
- if (call_creds_for_alts != nullptr) {
466
- grpc_core::RefCountedPtr<grpc_call_credentials> alts_call_creds(
467
- call_creds_for_alts);
468
- call_creds =
469
- grpc_core::MakeRefCounted<GoogleDefaultCallCredentialsWrapper>(
470
- std::move(call_creds), std::move(alts_call_creds));
503
+ if (options != nullptr) {
504
+ if (options->create_hard_bound_credentials &&
505
+ default_credentials_type ==
506
+ DefaultCallCredentialsCreationMethod::kFromDefaultGCE) {
507
+ grpc_google_compute_engine_credentials_options alts_options = {};
508
+ alts_options.alts_hard_bound = true;
509
+ grpc_core::RefCountedPtr<grpc_call_credentials> alts_call_creds(
510
+ grpc_google_compute_engine_credentials_create(&alts_options));
511
+ call_creds =
512
+ grpc_core::MakeRefCounted<GoogleDefaultCallCredentialsWrapper>(
513
+ std::move(call_creds), std::move(alts_call_creds));
514
+ } else if (options->call_creds_for_alts != nullptr) {
515
+ grpc_core::RefCountedPtr<grpc_call_credentials> alts_call_creds(
516
+ options->call_creds_for_alts);
517
+ call_creds =
518
+ grpc_core::MakeRefCounted<GoogleDefaultCallCredentialsWrapper>(
519
+ std::move(call_creds), std::move(alts_call_creds));
520
+ }
471
521
  }
472
522
  result = grpc_composite_channel_credentials_create(
473
523
  creds.get(), call_creds.get(), nullptr);
474
- CHECK_NE(result, nullptr);
524
+ GRPC_CHECK_NE(result, nullptr);
475
525
  } else {
476
526
  LOG(ERROR) << "Could not create google default credentials: "
477
527
  << grpc_core::StatusToString(error);
@@ -22,7 +22,6 @@
22
22
  #include <grpc/support/port_platform.h>
23
23
  #include <string.h>
24
24
 
25
- #include "absl/log/check.h"
26
25
  #include "src/core/handshaker/security/security_handshaker.h"
27
26
  #include "src/core/lib/channel/channel_args.h"
28
27
  #include "src/core/lib/iomgr/exec_ctx.h"
@@ -30,6 +29,7 @@
30
29
  #include "src/core/transport/auth_context.h"
31
30
  #include "src/core/tsi/local_transport_security.h"
32
31
  #include "src/core/util/debug_location.h"
32
+ #include "src/core/util/grpc_check.h"
33
33
  #include "src/core/util/ref_counted_ptr.h"
34
34
 
35
35
  namespace grpc_core {
@@ -69,7 +69,7 @@ void InsecureChannelSecurityConnector::add_handshakers(
69
69
  HandshakeManager* handshake_manager) {
70
70
  tsi_handshaker* handshaker = nullptr;
71
71
  // Re-use local_tsi_handshaker_create as a minimalist handshaker.
72
- CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
72
+ GRPC_CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
73
73
  handshake_manager->Add(SecurityHandshakerCreate(handshaker, this, args));
74
74
  }
75
75
 
@@ -96,7 +96,7 @@ void InsecureServerSecurityConnector::add_handshakers(
96
96
  HandshakeManager* handshake_manager) {
97
97
  tsi_handshaker* handshaker = nullptr;
98
98
  // Re-use local_tsi_handshaker_create as a minimalist handshaker.
99
- CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
99
+ GRPC_CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
100
100
  handshake_manager->Add(SecurityHandshakerCreate(handshaker, this, args));
101
101
  }
102
102
 
@@ -29,7 +29,6 @@
29
29
  #include <string>
30
30
  #include <utility>
31
31
 
32
- #include "absl/log/check.h"
33
32
  #include "absl/log/log.h"
34
33
  #include "absl/status/status.h"
35
34
  #include "absl/status/statusor.h"
@@ -60,6 +59,7 @@
60
59
  #include "src/core/tsi/transport_security.h"
61
60
  #include "src/core/tsi/transport_security_interface.h"
62
61
  #include "src/core/util/debug_location.h"
62
+ #include "src/core/util/grpc_check.h"
63
63
  #include "src/core/util/ref_counted_ptr.h"
64
64
  #include "src/core/util/uri.h"
65
65
 
@@ -77,12 +77,12 @@ grpc_core::RefCountedPtr<grpc_auth_context> local_auth_context_create(
77
77
  grpc_auth_context_add_cstring_property(
78
78
  ctx.get(), GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME,
79
79
  GRPC_LOCAL_TRANSPORT_SECURITY_TYPE);
80
- CHECK(grpc_auth_context_set_peer_identity_property_name(
81
- ctx.get(), GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME) == 1);
82
- CHECK_EQ(peer->property_count, 1u);
80
+ GRPC_CHECK(grpc_auth_context_set_peer_identity_property_name(
81
+ ctx.get(), GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME) == 1);
82
+ GRPC_CHECK_EQ(peer->property_count, 1u);
83
83
  const tsi_peer_property* prop = &peer->properties[0];
84
- CHECK_NE(prop, nullptr);
85
- CHECK_EQ(strcmp(prop->name, TSI_SECURITY_LEVEL_PEER_PROPERTY), 0);
84
+ GRPC_CHECK_NE(prop, nullptr);
85
+ GRPC_CHECK_EQ(strcmp(prop->name, TSI_SECURITY_LEVEL_PEER_PROPERTY), 0);
86
86
  grpc_auth_context_add_property(ctx.get(),
87
87
  GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME,
88
88
  prop->value.data, prop->value.length);
@@ -186,7 +186,7 @@ class grpc_local_channel_security_connector final
186
186
  grpc_pollset_set* /*interested_parties*/,
187
187
  grpc_core::HandshakeManager* handshake_manager) override {
188
188
  tsi_handshaker* handshaker = nullptr;
189
- CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
189
+ GRPC_CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
190
190
  handshake_manager->Add(
191
191
  grpc_core::SecurityHandshakerCreate(handshaker, this, args));
192
192
  }
@@ -241,7 +241,7 @@ class grpc_local_server_security_connector final
241
241
  grpc_pollset_set* /*interested_parties*/,
242
242
  grpc_core::HandshakeManager* handshake_manager) override {
243
243
  tsi_handshaker* handshaker = nullptr;
244
- CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
244
+ GRPC_CHECK(tsi_local_handshaker_create(&handshaker) == TSI_OK);
245
245
  handshake_manager->Add(
246
246
  grpc_core::SecurityHandshakerCreate(handshaker, this, args));
247
247
  }
@@ -23,11 +23,11 @@
23
23
 
24
24
  #include <utility>
25
25
 
26
- #include "absl/log/check.h"
27
26
  #include "absl/log/log.h"
28
27
  #include "src/core/credentials/transport/transport_credentials.h"
29
28
  #include "src/core/lib/channel/channel_args.h"
30
29
  #include "src/core/util/debug_location.h"
30
+ #include "src/core/util/grpc_check.h"
31
31
  #include "src/core/util/useful.h"
32
32
 
33
33
  grpc_channel_security_connector::grpc_channel_security_connector(
@@ -42,8 +42,8 @@ int grpc_channel_security_connector::channel_security_connector_cmp(
42
42
  const grpc_channel_security_connector* other) const {
43
43
  const grpc_channel_security_connector* other_sc =
44
44
  static_cast<const grpc_channel_security_connector*>(other);
45
- CHECK_NE(channel_creds(), nullptr);
46
- CHECK_NE(other_sc->channel_creds(), nullptr);
45
+ GRPC_CHECK_NE(channel_creds(), nullptr);
46
+ GRPC_CHECK_NE(other_sc->channel_creds(), nullptr);
47
47
  int c = channel_creds()->cmp(other_sc->channel_creds());
48
48
  if (c != 0) return c;
49
49
  return grpc_core::QsortCompare(request_metadata_creds(),
@@ -64,8 +64,8 @@ int grpc_server_security_connector::server_security_connector_cmp(
64
64
  const grpc_server_security_connector* other) const {
65
65
  const grpc_server_security_connector* other_sc =
66
66
  static_cast<const grpc_server_security_connector*>(other);
67
- CHECK_NE(server_creds(), nullptr);
68
- CHECK_NE(other_sc->server_creds(), nullptr);
67
+ GRPC_CHECK_NE(server_creds(), nullptr);
68
+ GRPC_CHECK_NE(other_sc->server_creds(), nullptr);
69
69
  return grpc_core::QsortCompare(server_creds(), other_sc->server_creds());
70
70
  }
71
71
 
@@ -28,7 +28,6 @@
28
28
  #include <string>
29
29
  #include <utility>
30
30
 
31
- #include "absl/log/check.h"
32
31
  #include "absl/log/log.h"
33
32
  #include "src/core/credentials/transport/tls/ssl_utils.h"
34
33
  #include "src/core/lib/channel/channel_args.h"
@@ -36,6 +35,7 @@
36
35
  #include "src/core/tsi/ssl/session_cache/ssl_session_cache.h"
37
36
  #include "src/core/tsi/ssl_transport_security.h"
38
37
  #include "src/core/tsi/transport_security_interface.h"
38
+ #include "src/core/util/grpc_check.h"
39
39
 
40
40
  //
41
41
  // SSL Channel Credentials.
@@ -143,8 +143,8 @@ void grpc_ssl_credentials::build_config(
143
143
  const grpc_ssl_verify_peer_options* verify_options) {
144
144
  config_.pem_root_certs = gpr_strdup(pem_root_certs);
145
145
  if (pem_key_cert_pair != nullptr) {
146
- CHECK_NE(pem_key_cert_pair->private_key, nullptr);
147
- CHECK_NE(pem_key_cert_pair->cert_chain, nullptr);
146
+ GRPC_CHECK_NE(pem_key_cert_pair->private_key, nullptr);
147
+ GRPC_CHECK_NE(pem_key_cert_pair->cert_chain, nullptr);
148
148
  config_.pem_key_cert_pair = static_cast<tsi_ssl_pem_key_cert_pair*>(
149
149
  gpr_zalloc(sizeof(tsi_ssl_pem_key_cert_pair)));
150
150
  config_.pem_key_cert_pair->cert_chain =
@@ -226,7 +226,7 @@ grpc_channel_credentials* grpc_ssl_credentials_create(
226
226
  << ", pem_key_cert_pair=" << pem_key_cert_pair
227
227
  << ", verify_options=" << verify_options << ", reserved=" << reserved
228
228
  << ")";
229
- CHECK_EQ(reserved, nullptr);
229
+ GRPC_CHECK_EQ(reserved, nullptr);
230
230
 
231
231
  return new grpc_ssl_credentials(
232
232
  pem_root_certs, pem_key_cert_pair,
@@ -241,7 +241,7 @@ grpc_channel_credentials* grpc_ssl_credentials_create_ex(
241
241
  << ", pem_key_cert_pair=" << pem_key_cert_pair
242
242
  << ", verify_options=" << verify_options << ", reserved=" << reserved
243
243
  << ")";
244
- CHECK_EQ(reserved, nullptr);
244
+ GRPC_CHECK_EQ(reserved, nullptr);
245
245
 
246
246
  return new grpc_ssl_credentials(pem_root_certs, pem_key_cert_pair,
247
247
  verify_options);
@@ -291,13 +291,13 @@ tsi_ssl_pem_key_cert_pair* grpc_convert_grpc_to_tsi_cert_pairs(
291
291
  size_t num_key_cert_pairs) {
292
292
  tsi_ssl_pem_key_cert_pair* tsi_pairs = nullptr;
293
293
  if (num_key_cert_pairs > 0) {
294
- CHECK_NE(pem_key_cert_pairs, nullptr);
294
+ GRPC_CHECK_NE(pem_key_cert_pairs, nullptr);
295
295
  tsi_pairs = static_cast<tsi_ssl_pem_key_cert_pair*>(
296
296
  gpr_zalloc(num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair)));
297
297
  }
298
298
  for (size_t i = 0; i < num_key_cert_pairs; i++) {
299
- CHECK_NE(pem_key_cert_pairs[i].private_key, nullptr);
300
- CHECK_NE(pem_key_cert_pairs[i].cert_chain, nullptr);
299
+ GRPC_CHECK_NE(pem_key_cert_pairs[i].private_key, nullptr);
300
+ GRPC_CHECK_NE(pem_key_cert_pairs[i].cert_chain, nullptr);
301
301
  tsi_pairs[i].cert_chain = gpr_strdup(pem_key_cert_pairs[i].cert_chain);
302
302
  tsi_pairs[i].private_key = gpr_strdup(pem_key_cert_pairs[i].private_key);
303
303
  }
@@ -334,14 +334,14 @@ grpc_ssl_server_certificate_config* grpc_ssl_server_certificate_config_create(
334
334
  gpr_zalloc(sizeof(grpc_ssl_server_certificate_config)));
335
335
  config->pem_root_certs = gpr_strdup(pem_root_certs);
336
336
  if (num_key_cert_pairs > 0) {
337
- CHECK_NE(pem_key_cert_pairs, nullptr);
337
+ GRPC_CHECK_NE(pem_key_cert_pairs, nullptr);
338
338
  config->pem_key_cert_pairs = static_cast<grpc_ssl_pem_key_cert_pair*>(
339
339
  gpr_zalloc(num_key_cert_pairs * sizeof(grpc_ssl_pem_key_cert_pair)));
340
340
  }
341
341
  config->num_key_cert_pairs = num_key_cert_pairs;
342
342
  for (size_t i = 0; i < num_key_cert_pairs; i++) {
343
- CHECK_NE(pem_key_cert_pairs[i].private_key, nullptr);
344
- CHECK_NE(pem_key_cert_pairs[i].cert_chain, nullptr);
343
+ GRPC_CHECK_NE(pem_key_cert_pairs[i].private_key, nullptr);
344
+ GRPC_CHECK_NE(pem_key_cert_pairs[i].cert_chain, nullptr);
345
345
  config->pem_key_cert_pairs[i].cert_chain =
346
346
  gpr_strdup(pem_key_cert_pairs[i].cert_chain);
347
347
  config->pem_key_cert_pairs[i].private_key =
@@ -425,7 +425,7 @@ grpc_server_credentials* grpc_ssl_server_credentials_create_ex(
425
425
  << ", num_key_cert_pairs=" << (unsigned long)num_key_cert_pairs
426
426
  << ", client_certificate_request=" << client_certificate_request
427
427
  << ", reserved=" << reserved << ")";
428
- CHECK_EQ(reserved, nullptr);
428
+ GRPC_CHECK_EQ(reserved, nullptr);
429
429
 
430
430
  grpc_ssl_server_certificate_config* cert_config =
431
431
  grpc_ssl_server_certificate_config_create(
@@ -25,12 +25,12 @@
25
25
  #include <grpc/support/port_platform.h>
26
26
  #include <stddef.h>
27
27
 
28
- #include "absl/log/check.h"
29
28
  #include "src/core/credentials/transport/security_connector.h"
30
29
  #include "src/core/credentials/transport/ssl/ssl_security_connector.h"
31
30
  #include "src/core/credentials/transport/transport_credentials.h"
32
31
  #include "src/core/lib/channel/channel_args.h"
33
32
  #include "src/core/tsi/ssl_transport_security.h"
33
+ #include "src/core/util/grpc_check.h"
34
34
  #include "src/core/util/ref_counted_ptr.h"
35
35
  #include "src/core/util/unique_type_name.h"
36
36
  #include "src/core/util/useful.h"
@@ -115,7 +115,7 @@ class grpc_ssl_server_credentials final : public grpc_server_credentials {
115
115
 
116
116
  grpc_ssl_certificate_config_reload_status FetchCertConfig(
117
117
  grpc_ssl_server_certificate_config** config) {
118
- DCHECK(has_cert_config_fetcher());
118
+ GRPC_DCHECK(has_cert_config_fetcher());
119
119
  return certificate_config_fetcher_.cb(certificate_config_fetcher_.user_data,
120
120
  config);
121
121
  }
@@ -26,7 +26,6 @@
26
26
  #include <string>
27
27
  #include <utility>
28
28
 
29
- #include "absl/log/check.h"
30
29
  #include "absl/log/log.h"
31
30
  #include "absl/status/status.h"
32
31
  #include "absl/strings/str_cat.h"
@@ -50,6 +49,7 @@
50
49
  #include "src/core/tsi/transport_security.h"
51
50
  #include "src/core/tsi/transport_security_interface.h"
52
51
  #include "src/core/util/debug_location.h"
52
+ #include "src/core/util/grpc_check.h"
53
53
  #include "src/core/util/host_port.h"
54
54
  #include "src/core/util/ref_counted_ptr.h"
55
55
  #include "src/core/util/sync.h"
@@ -357,7 +357,7 @@ class grpc_ssl_server_security_connector
357
357
  tsi_ssl_server_handshaker_factory* new_handshaker_factory = nullptr;
358
358
  const grpc_ssl_server_credentials* server_creds =
359
359
  static_cast<const grpc_ssl_server_credentials*>(this->server_creds());
360
- DCHECK_NE(config->pem_root_certs, nullptr);
360
+ GRPC_DCHECK_NE(config->pem_root_certs, nullptr);
361
361
  tsi_ssl_server_handshaker_options options;
362
362
  options.pem_key_cert_pairs = grpc_convert_grpc_to_tsi_cert_pairs(
363
363
  config->pem_key_cert_pairs, config->num_key_cert_pairs);
@@ -425,7 +425,7 @@ grpc_core::RefCountedPtr<grpc_server_security_connector>
425
425
  grpc_ssl_server_security_connector_create(
426
426
  grpc_core::RefCountedPtr<grpc_server_credentials> server_credentials,
427
427
  const grpc_core::ChannelArgs& args) {
428
- CHECK(server_credentials != nullptr);
428
+ GRPC_CHECK(server_credentials != nullptr);
429
429
  grpc_core::RefCountedPtr<grpc_ssl_server_security_connector> c =
430
430
  grpc_core::MakeRefCounted<grpc_ssl_server_security_connector>(
431
431
  std::move(server_credentials));
@@ -23,8 +23,8 @@
23
23
  #include <string>
24
24
  #include <utility>
25
25
 
26
- #include "absl/log/check.h"
27
26
  #include "absl/log/log.h"
27
+ #include "src/core/util/grpc_check.h"
28
28
 
29
29
  namespace grpc_core {
30
30
 
@@ -32,7 +32,7 @@ void CertificateProviderRegistry::Builder::RegisterCertificateProviderFactory(
32
32
  std::unique_ptr<CertificateProviderFactory> factory) {
33
33
  absl::string_view name = factory->name();
34
34
  VLOG(2) << "registering certificate provider factory for \"" << name << "\"";
35
- CHECK(factories_.emplace(name, std::move(factory)).second);
35
+ GRPC_CHECK(factories_.emplace(name, std::move(factory)).second);
36
36
  }
37
37
 
38
38
  CertificateProviderRegistry CertificateProviderRegistry::Builder::Build() {
@@ -20,10 +20,10 @@
20
20
  #include <grpc/grpc_security.h>
21
21
  #include <grpc/support/port_platform.h>
22
22
 
23
- #include "absl/log/check.h"
24
23
  #include "absl/status/status.h"
25
24
  #include "src/core/credentials/transport/tls/spiffe_utils.h"
26
25
  #include "src/core/tsi/ssl_transport_security.h"
26
+ #include "src/core/util/grpc_check.h"
27
27
 
28
28
  bool grpc_tls_certificate_distributor::CertificateInfo::AreRootsEmpty() {
29
29
  return IsRootCertInfoEmpty(roots.get());
@@ -32,17 +32,17 @@ bool grpc_tls_certificate_distributor::CertificateInfo::AreRootsEmpty() {
32
32
  void grpc_tls_certificate_distributor::SetKeyMaterials(
33
33
  const std::string& cert_name, std::shared_ptr<RootCertInfo> roots,
34
34
  std::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs) {
35
- CHECK(roots != nullptr || pem_key_cert_pairs.has_value());
35
+ GRPC_CHECK(roots != nullptr || pem_key_cert_pairs.has_value());
36
36
  grpc_core::MutexLock lock(&mu_);
37
37
  auto& cert_info = certificate_info_map_[cert_name];
38
38
  if (roots != nullptr) {
39
39
  // Successful credential updates will clear any pre-existing error.
40
40
  cert_info.SetRootError(absl::OkStatus());
41
41
  for (auto* watcher_ptr : cert_info.root_cert_watchers) {
42
- CHECK_NE(watcher_ptr, nullptr);
42
+ GRPC_CHECK_NE(watcher_ptr, nullptr);
43
43
  const auto watcher_it = watchers_.find(watcher_ptr);
44
- CHECK(watcher_it != watchers_.end());
45
- CHECK(watcher_it->second.root_cert_name.has_value());
44
+ GRPC_CHECK(watcher_it != watchers_.end());
45
+ GRPC_CHECK(watcher_it->second.root_cert_name.has_value());
46
46
  std::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs_to_report;
47
47
  if (pem_key_cert_pairs.has_value() &&
48
48
  watcher_it->second.identity_cert_name == cert_name) {
@@ -63,10 +63,10 @@ void grpc_tls_certificate_distributor::SetKeyMaterials(
63
63
  // Successful credential updates will clear any pre-existing error.
64
64
  cert_info.SetIdentityError(absl::OkStatus());
65
65
  for (const auto watcher_ptr : cert_info.identity_cert_watchers) {
66
- CHECK_NE(watcher_ptr, nullptr);
66
+ GRPC_CHECK_NE(watcher_ptr, nullptr);
67
67
  const auto watcher_it = watchers_.find(watcher_ptr);
68
- CHECK(watcher_it != watchers_.end());
69
- CHECK(watcher_it->second.identity_cert_name.has_value());
68
+ GRPC_CHECK(watcher_it != watchers_.end());
69
+ GRPC_CHECK(watcher_it->second.identity_cert_name.has_value());
70
70
  std::shared_ptr<RootCertInfo> roots_to_report;
71
71
  if (roots != nullptr && watcher_it->second.root_cert_name == cert_name) {
72
72
  // In this case, We've already sent the credential updates at the time
@@ -105,14 +105,14 @@ void grpc_tls_certificate_distributor::SetErrorForCert(
105
105
  const std::string& cert_name,
106
106
  std::optional<grpc_error_handle> root_cert_error,
107
107
  std::optional<grpc_error_handle> identity_cert_error) {
108
- CHECK(root_cert_error.has_value() || identity_cert_error.has_value());
108
+ GRPC_CHECK(root_cert_error.has_value() || identity_cert_error.has_value());
109
109
  grpc_core::MutexLock lock(&mu_);
110
110
  CertificateInfo& cert_info = certificate_info_map_[cert_name];
111
111
  if (root_cert_error.has_value()) {
112
112
  for (auto* watcher_ptr : cert_info.root_cert_watchers) {
113
- CHECK_NE(watcher_ptr, nullptr);
113
+ GRPC_CHECK_NE(watcher_ptr, nullptr);
114
114
  const auto watcher_it = watchers_.find(watcher_ptr);
115
- CHECK(watcher_it != watchers_.end());
115
+ GRPC_CHECK(watcher_it != watchers_.end());
116
116
  // identity_cert_error_to_report is the error of the identity cert this
117
117
  // watcher is watching, if there is any.
118
118
  grpc_error_handle identity_cert_error_to_report;
@@ -130,9 +130,9 @@ void grpc_tls_certificate_distributor::SetErrorForCert(
130
130
  }
131
131
  if (identity_cert_error.has_value()) {
132
132
  for (auto* watcher_ptr : cert_info.identity_cert_watchers) {
133
- CHECK_NE(watcher_ptr, nullptr);
133
+ GRPC_CHECK_NE(watcher_ptr, nullptr);
134
134
  const auto watcher_it = watchers_.find(watcher_ptr);
135
- CHECK(watcher_it != watchers_.end());
135
+ GRPC_CHECK(watcher_it != watchers_.end());
136
136
  // root_error_to_report is the error of the roots this watcher
137
137
  // is watching, if there is any.
138
138
  grpc_error_handle root_error_to_report;
@@ -153,11 +153,11 @@ void grpc_tls_certificate_distributor::SetErrorForCert(
153
153
  };
154
154
 
155
155
  void grpc_tls_certificate_distributor::SetError(grpc_error_handle error) {
156
- CHECK(!error.ok());
156
+ GRPC_CHECK(!error.ok());
157
157
  grpc_core::MutexLock lock(&mu_);
158
158
  for (const auto& watcher : watchers_) {
159
159
  const auto watcher_ptr = watcher.first;
160
- CHECK_NE(watcher_ptr, nullptr);
160
+ GRPC_CHECK_NE(watcher_ptr, nullptr);
161
161
  const auto& watcher_info = watcher.second;
162
162
  watcher_ptr->OnError(
163
163
  watcher_info.root_cert_name.has_value() ? error : absl::OkStatus(),
@@ -178,16 +178,16 @@ void grpc_tls_certificate_distributor::WatchTlsCertificates(
178
178
  bool already_watching_identity_for_root_cert = false;
179
179
  bool start_watching_identity_cert = false;
180
180
  bool already_watching_root_for_identity_cert = false;
181
- CHECK(root_cert_name.has_value() || identity_cert_name.has_value());
181
+ GRPC_CHECK(root_cert_name.has_value() || identity_cert_name.has_value());
182
182
  TlsCertificatesWatcherInterface* watcher_ptr = watcher.get();
183
- CHECK_NE(watcher_ptr, nullptr);
183
+ GRPC_CHECK_NE(watcher_ptr, nullptr);
184
184
  // Update watchers_ and certificate_info_map_.
185
185
  {
186
186
  grpc_core::MutexLock lock(&mu_);
187
187
  const auto watcher_it = watchers_.find(watcher_ptr);
188
188
  // The caller needs to cancel the watcher first if it wants to re-register
189
189
  // the watcher.
190
- CHECK(watcher_it == watchers_.end());
190
+ GRPC_CHECK(watcher_it == watchers_.end());
191
191
  watchers_[watcher_ptr] = {std::move(watcher), root_cert_name,
192
192
  identity_cert_name};
193
193
  std::shared_ptr<RootCertInfo> updated_roots;
@@ -274,7 +274,7 @@ void grpc_tls_certificate_distributor::CancelTlsCertificatesWatch(
274
274
  watchers_.erase(it);
275
275
  if (root_cert_name.has_value()) {
276
276
  auto it = certificate_info_map_.find(*root_cert_name);
277
- CHECK(it != certificate_info_map_.end());
277
+ GRPC_CHECK(it != certificate_info_map_.end());
278
278
  CertificateInfo& cert_info = it->second;
279
279
  cert_info.root_cert_watchers.erase(watcher);
280
280
  stop_watching_root_cert = cert_info.root_cert_watchers.empty();
@@ -286,7 +286,7 @@ void grpc_tls_certificate_distributor::CancelTlsCertificatesWatch(
286
286
  }
287
287
  if (identity_cert_name.has_value()) {
288
288
  auto it = certificate_info_map_.find(*identity_cert_name);
289
- CHECK(it != certificate_info_map_.end());
289
+ GRPC_CHECK(it != certificate_info_map_.end());
290
290
  CertificateInfo& cert_info = it->second;
291
291
  cert_info.identity_cert_watchers.erase(watcher);
292
292
  stop_watching_identity_cert = cert_info.identity_cert_watchers.empty();
@@ -330,13 +330,13 @@ grpc_tls_identity_pairs* grpc_tls_identity_pairs_create() {
330
330
  void grpc_tls_identity_pairs_add_pair(grpc_tls_identity_pairs* pairs,
331
331
  const char* private_key,
332
332
  const char* cert_chain) {
333
- CHECK_NE(pairs, nullptr);
334
- CHECK_NE(private_key, nullptr);
335
- CHECK_NE(cert_chain, nullptr);
333
+ GRPC_CHECK_NE(pairs, nullptr);
334
+ GRPC_CHECK_NE(private_key, nullptr);
335
+ GRPC_CHECK_NE(cert_chain, nullptr);
336
336
  pairs->pem_key_cert_pairs.emplace_back(private_key, cert_chain);
337
337
  }
338
338
 
339
339
  void grpc_tls_identity_pairs_destroy(grpc_tls_identity_pairs* pairs) {
340
- CHECK_NE(pairs, nullptr);
340
+ GRPC_CHECK_NE(pairs, nullptr);
341
341
  delete pairs;
342
342
  }
@@ -27,7 +27,6 @@
27
27
  #include <utility>
28
28
  #include <vector>
29
29
 
30
- #include "absl/log/check.h"
31
30
  #include "absl/log/log.h"
32
31
  #include "absl/status/status.h"
33
32
  #include "absl/strings/string_view.h"
@@ -39,6 +38,7 @@
39
38
  #include "src/core/lib/slice/slice.h"
40
39
  #include "src/core/lib/slice/slice_internal.h"
41
40
  #include "src/core/tsi/ssl_transport_security_utils.h"
41
+ #include "src/core/util/grpc_check.h"
42
42
  #include "src/core/util/load_file.h"
43
43
  #include "src/core/util/match.h"
44
44
  #include "src/core/util/stat.h"
@@ -216,17 +216,17 @@ FileWatcherCertificateProvider::FileWatcherCertificateProvider(
216
216
  refresh_interval_sec_ = kMinimumFileWatcherRefreshIntervalSeconds;
217
217
  }
218
218
  // Private key and identity cert files must be both set or both unset.
219
- CHECK(private_key_path_.empty() == identity_certificate_path_.empty());
219
+ GRPC_CHECK(private_key_path_.empty() == identity_certificate_path_.empty());
220
220
  // Must be watching either root or identity certs.
221
221
  bool watching_root =
222
222
  !root_cert_path_.empty() || !spiffe_bundle_map_path_.empty();
223
- CHECK(!private_key_path_.empty() || watching_root);
223
+ GRPC_CHECK(!private_key_path_.empty() || watching_root);
224
224
  gpr_event_init(&shutdown_event_);
225
225
  ForceUpdate();
226
226
  auto thread_lambda = [](void* arg) {
227
227
  FileWatcherCertificateProvider* provider =
228
228
  static_cast<FileWatcherCertificateProvider*>(arg);
229
- CHECK_NE(provider, nullptr);
229
+ GRPC_CHECK_NE(provider, nullptr);
230
230
  while (true) {
231
231
  void* value = gpr_event_wait(
232
232
  &provider->shutdown_event_,
@@ -494,7 +494,7 @@ int64_t FileWatcherCertificateProvider::TestOnlyGetRefreshIntervalSecond()
494
494
 
495
495
  grpc_tls_certificate_provider* grpc_tls_certificate_provider_static_data_create(
496
496
  const char* root_certificate, grpc_tls_identity_pairs* pem_key_cert_pairs) {
497
- CHECK(root_certificate != nullptr || pem_key_cert_pairs != nullptr);
497
+ GRPC_CHECK(root_certificate != nullptr || pem_key_cert_pairs != nullptr);
498
498
  grpc_core::ExecCtx exec_ctx;
499
499
  grpc_core::PemKeyCertPairList identity_pairs_core;
500
500
  if (pem_key_cert_pairs != nullptr) {