grpc 1.83.1 → 1.84.0
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.
- checksums.yaml +4 -4
- data/Makefile +21 -17
- data/include/grpc/credentials.h +10 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +9 -0
- data/src/core/call/call_filters.h +4 -2
- data/src/core/call/client_call.cc +20 -8
- data/src/core/call/client_call.h +4 -0
- data/src/core/call/interception_chain.cc +2 -0
- data/src/core/call/interception_chain.h +14 -1
- data/src/core/call/metadata.cc +1 -3
- data/src/core/call/metadata_batch.h +13 -5
- data/src/core/call/server_call.cc +31 -14
- data/src/core/call/server_call.h +4 -0
- data/src/core/channelz/text_encode.cc +9 -4
- data/src/core/channelz/v2tov1/convert.cc +2 -2
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/client_channel.cc +6 -33
- data/src/core/client_channel/client_channel_filter.cc +22 -55
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_service_config.cc +3 -19
- data/src/core/client_channel/direct_channel.cc +7 -1
- data/src/core/client_channel/direct_channel.h +2 -2
- data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
- data/src/core/client_channel/subchannel.cc +310 -1058
- data/src/core/client_channel/subchannel.h +44 -329
- data/src/core/client_channel/subchannel_metrics.cc +48 -0
- data/src/core/client_channel/subchannel_metrics.h +60 -0
- data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
- data/src/core/credentials/call/json_util.h +1 -0
- data/src/core/credentials/call/jwt/json_token.cc +10 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
- data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
- data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
- data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
- data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
- data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
- data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
- data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
- data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
- data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
- data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
- data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
- data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
- data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
- data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
- data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
- data/src/core/filter/auth/server_auth_filter.cc +2 -3
- data/src/core/filter/composite/composite_filter.cc +45 -33
- data/src/core/filter/composite/composite_filter.h +5 -4
- data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
- data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
- data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
- data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
- data/src/core/filter/filter_args.h +13 -2
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
- data/src/core/handshaker/security/security_handshaker.cc +9 -6
- data/src/core/lib/channel/channel_stack.cc +3 -0
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
- data/src/core/lib/channel/promise_based_filter.cc +132 -20
- data/src/core/lib/channel/promise_based_filter.h +42 -12
- data/src/core/lib/compression/compression_internal.cc +4 -5
- data/src/core/lib/debug/trace_flags.cc +8 -0
- data/src/core/lib/debug/trace_flags.h +3 -0
- data/src/core/lib/event_engine/ares_resolver.cc +54 -50
- data/src/core/lib/event_engine/ares_resolver.h +3 -2
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
- data/src/core/lib/experiments/experiments.cc +60 -96
- data/src/core/lib/experiments/experiments.h +34 -50
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
- data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/systemd_utils.cc +0 -1
- data/src/core/lib/iomgr/tcp_client.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +23 -15
- data/src/core/lib/iomgr/tcp_server.h +1 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +5 -10
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/vsock.h +3 -1
- data/src/core/lib/resource_quota/memory_quota.cc +1 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
- data/src/core/lib/security/authorization/rbac_policy.h +21 -3
- data/src/core/lib/surface/call.cc +3 -9
- data/src/core/lib/surface/call_utils.h +113 -0
- data/src/core/lib/surface/channel_create.cc +1 -1
- data/src/core/lib/surface/channel_create.h +0 -2
- data/src/core/lib/surface/channel_init.cc +77 -38
- data/src/core/lib/surface/channel_init.h +30 -16
- data/src/core/lib/surface/filter_stack_call.cc +5 -10
- data/src/core/lib/surface/init.cc +13 -27
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +0 -27
- data/src/core/lib/transport/error_utils.h +0 -16
- data/src/core/lib/transport/transport.h +7 -5
- data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
- data/src/core/load_balancing/rls/rls.cc +28 -11
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
- data/src/core/load_balancing/xds/cds.cc +3 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
- data/src/core/mitigation_engine/mitigation.h +14 -5
- data/src/core/mitigation_engine/mitigation_engine.h +7 -3
- data/src/core/mitigation_engine/mitigation_provider.h +2 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
- data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
- data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
- data/src/core/resolver/xds/xds_resolver.cc +35 -9
- data/src/core/server/server.cc +2 -6
- data/src/core/server/server_config_selector.h +18 -3
- data/src/core/server/server_config_selector_filter.cc +178 -91
- data/src/core/server/server_config_selector_filter.h +58 -3
- data/src/core/server/xds_server_config_fetcher.cc +196 -129
- data/src/core/server/xds_server_config_fetcher.h +49 -0
- data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
- data/src/core/telemetry/histogram.h +94 -14
- data/src/core/telemetry/instrument.cc +179 -74
- data/src/core/telemetry/instrument.h +78 -30
- data/src/core/telemetry/metrics.h +5 -0
- data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
- data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
- data/src/core/tsi/ssl_telemetry_utils.h +12 -2
- data/src/core/tsi/ssl_transport_security.cc +238 -80
- data/src/core/tsi/ssl_transport_security.h +63 -33
- data/src/core/tsi/tls_telemetry.cc +31 -0
- data/src/core/tsi/tls_telemetry.h +47 -0
- data/src/core/tsi/transport_security.cc +2 -2
- data/src/core/tsi/transport_security.h +1 -1
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
- data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
- data/src/core/util/http_client/httpcli.cc +16 -53
- data/src/core/util/http_client/httpcli.h +0 -7
- data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
- data/src/core/util/linux/cpu.cc +1 -1
- data/src/core/util/load_file.cc +3 -9
- data/src/core/util/load_file.h +3 -4
- data/src/core/util/matchers.h +8 -0
- data/src/core/util/posix/cpu.cc +1 -1
- data/src/core/util/status_helper.cc +0 -20
- data/src/core/util/status_helper.h +3 -14
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
- data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
- data/src/core/xds/grpc/xds_client_grpc.h +0 -4
- data/src/core/xds/grpc/xds_cluster.h +1 -0
- data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
- data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
- data/src/core/xds/grpc/xds_common_types.cc +0 -91
- data/src/core/xds/grpc/xds_common_types.h +1 -47
- data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
- data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
- data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
- data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
- data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
- data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
- data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
- data/src/core/xds/grpc/xds_http_filter.cc +2 -1
- data/src/core/xds/grpc/xds_http_filter.h +6 -5
- data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
- data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
- data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
- data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
- data/src/core/xds/grpc/xds_listener.cc +2 -0
- data/src/core/xds/grpc/xds_listener.h +5 -0
- data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
- data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
- data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
- data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
- data/src/core/xds/grpc/xds_route_config.cc +2 -0
- data/src/core/xds/grpc/xds_route_config.h +3 -1
- data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
- data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
- data/src/core/xds/grpc/xds_routing.cc +116 -69
- data/src/core/xds/grpc/xds_routing.h +19 -8
- data/src/core/xds/grpc/xds_tls_context.cc +117 -0
- data/src/core/xds/grpc/xds_tls_context.h +76 -0
- data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
- data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
- data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_call.c +26 -15
- data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +5 -4
- data/src/ruby/spec/call_spec.rb +14 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
- metadata +50 -35
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
- data/src/core/lib/iomgr/resolve_address.cc +0 -59
- data/src/core/lib/iomgr/resolve_address.h +0 -125
- data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
- data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
- data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
- data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
- data/src/core/util/json/json_util.cc +0 -101
- data/src/core/util/json/json_util.h +0 -163
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
#include "src/core/call/metadata_batch.h"
|
|
30
30
|
#include "src/core/client_channel/connector.h"
|
|
31
|
+
#include "src/core/client_channel/subchannel_metrics.h"
|
|
31
32
|
#include "src/core/client_channel/subchannel_pool_interface.h"
|
|
32
33
|
#include "src/core/lib/address_utils/sockaddr_utils.h"
|
|
33
34
|
#include "src/core/lib/channel/channel_args.h"
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
#include "src/core/lib/slice/slice.h"
|
|
44
45
|
#include "src/core/lib/transport/connectivity_state.h"
|
|
45
46
|
#include "src/core/lib/transport/transport.h"
|
|
47
|
+
#include "src/core/telemetry/metrics.h"
|
|
46
48
|
#include "src/core/util/backoff.h"
|
|
47
49
|
#include "src/core/util/debug_location.h"
|
|
48
50
|
#include "src/core/util/dual_ref_counted.h"
|
|
@@ -141,116 +143,25 @@ class Subchannel : public DualRefCounted<Subchannel> {
|
|
|
141
143
|
OrphanablePtr<SubchannelConnector> connector,
|
|
142
144
|
const grpc_resolved_address& address, const ChannelArgs& args);
|
|
143
145
|
|
|
144
|
-
//
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
virtual void ThrottleKeepaliveTime(Duration new_keepalive_time) = 0;
|
|
148
|
-
|
|
149
|
-
virtual grpc_pollset_set* pollset_set() const = 0;
|
|
150
|
-
|
|
151
|
-
virtual channelz::SubchannelNode* channelz_node() = 0;
|
|
152
|
-
|
|
153
|
-
virtual const ChannelArgs& args() const = 0;
|
|
154
|
-
|
|
155
|
-
virtual std::string address() const = 0;
|
|
156
|
-
|
|
157
|
-
// Starts watching the subchannel's connectivity state.
|
|
158
|
-
// The first callback to the watcher will be delivered ~immediately.
|
|
159
|
-
// Subsequent callbacks will be delivered as the subchannel's state
|
|
160
|
-
// changes.
|
|
161
|
-
// The watcher will be destroyed either when the subchannel is
|
|
162
|
-
// destroyed or when CancelConnectivityStateWatch() is called.
|
|
163
|
-
virtual void WatchConnectivityState(
|
|
164
|
-
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) = 0;
|
|
165
|
-
|
|
166
|
-
// Cancels a connectivity state watch.
|
|
167
|
-
// If the watcher has already been destroyed, this is a no-op.
|
|
168
|
-
virtual void CancelConnectivityStateWatch(
|
|
169
|
-
ConnectivityStateWatcherInterface* watcher) = 0;
|
|
170
|
-
|
|
171
|
-
// Starts a call in the v1 stack.
|
|
172
|
-
// Returns null if there is no connected subchannel.
|
|
173
|
-
struct CreateCallArgs {
|
|
174
|
-
grpc_polling_entity* pollent;
|
|
175
|
-
gpr_cycle_counter start_time;
|
|
176
|
-
Timestamp deadline;
|
|
177
|
-
Arena* arena;
|
|
178
|
-
CallCombiner* call_combiner;
|
|
179
|
-
};
|
|
180
|
-
virtual RefCountedPtr<Call> CreateCall(CreateCallArgs args,
|
|
181
|
-
grpc_error_handle* error) = 0;
|
|
182
|
-
|
|
183
|
-
// Used for calls in the v3 stack.
|
|
184
|
-
virtual RefCountedPtr<UnstartedCallDestination> call_destination() = 0;
|
|
185
|
-
|
|
186
|
-
// Attempt to connect to the backend. Has no effect if already connected.
|
|
187
|
-
virtual void RequestConnection() = 0;
|
|
188
|
-
|
|
189
|
-
// Resets the connection backoff of the subchannel.
|
|
190
|
-
virtual void ResetBackoff() = 0;
|
|
146
|
+
// Do not instantiate directly; use Create() instead.
|
|
147
|
+
Subchannel(SubchannelKey key, OrphanablePtr<SubchannelConnector> connector,
|
|
148
|
+
const ChannelArgs& args);
|
|
191
149
|
|
|
192
|
-
|
|
193
|
-
// We do not hold refs to the data producer; the implementation is
|
|
194
|
-
// expected to register itself upon construction and remove itself
|
|
195
|
-
// upon destruction.
|
|
196
|
-
//
|
|
197
|
-
// Looks up the current data producer for type and invokes get_or_add()
|
|
198
|
-
// with a pointer to that producer in the map. The get_or_add() function
|
|
199
|
-
// can modify the pointed-to value to update the map. This provides a
|
|
200
|
-
// way to either re-use an existing producer or register a new one in
|
|
201
|
-
// a non-racy way.
|
|
202
|
-
virtual void GetOrAddDataProducer(
|
|
203
|
-
UniqueTypeName type,
|
|
204
|
-
std::function<void(DataProducerInterface**)> get_or_add) = 0;
|
|
205
|
-
// Removes the data producer from the map, if the current producer for
|
|
206
|
-
// this type is the specified producer.
|
|
207
|
-
virtual void RemoveDataProducer(DataProducerInterface* data_producer) = 0;
|
|
208
|
-
|
|
209
|
-
virtual std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
|
210
|
-
event_engine() = 0;
|
|
211
|
-
|
|
212
|
-
// Ping API for v3 stack.
|
|
213
|
-
virtual void Ping(absl::AnyInvocable<void(absl::Status)> on_ack) = 0;
|
|
214
|
-
// Ping API for v1 stack.
|
|
215
|
-
// TODO(roth): Remove this when v3 migration is done.
|
|
216
|
-
virtual absl::Status Ping(grpc_closure* on_initiate,
|
|
217
|
-
grpc_closure* on_ack) = 0;
|
|
218
|
-
|
|
219
|
-
// Exposed for testing purposes only.
|
|
220
|
-
static ChannelArgs MakeSubchannelArgs(
|
|
221
|
-
const ChannelArgs& channel_args, const ChannelArgs& address_args,
|
|
222
|
-
const RefCountedPtr<SubchannelPoolInterface>& subchannel_pool,
|
|
223
|
-
const std::string& channel_default_authority);
|
|
224
|
-
|
|
225
|
-
protected:
|
|
226
|
-
Subchannel();
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
class OldSubchannel final : public Subchannel {
|
|
230
|
-
public:
|
|
231
|
-
// Creates a subchannel.
|
|
232
|
-
static RefCountedPtr<Subchannel> Create(
|
|
233
|
-
OrphanablePtr<SubchannelConnector> connector,
|
|
234
|
-
const grpc_resolved_address& address, const ChannelArgs& args);
|
|
235
|
-
|
|
236
|
-
// The ctor and dtor are not intended to use directly.
|
|
237
|
-
OldSubchannel(SubchannelKey key, OrphanablePtr<SubchannelConnector> connector,
|
|
238
|
-
const ChannelArgs& args);
|
|
239
|
-
~OldSubchannel() override;
|
|
150
|
+
~Subchannel() override;
|
|
240
151
|
|
|
241
152
|
// Throttles keepalive time to \a new_keepalive_time iff \a new_keepalive_time
|
|
242
153
|
// is larger than the subchannel's current keepalive time. The updated value
|
|
243
154
|
// will have an affect when the subchannel creates a new ConnectedSubchannel.
|
|
244
|
-
void ThrottleKeepaliveTime(Duration new_keepalive_time)
|
|
155
|
+
void ThrottleKeepaliveTime(Duration new_keepalive_time)
|
|
245
156
|
ABSL_LOCKS_EXCLUDED(mu_);
|
|
246
157
|
|
|
247
|
-
grpc_pollset_set* pollset_set() const
|
|
158
|
+
grpc_pollset_set* pollset_set() const { return pollset_set_; }
|
|
248
159
|
|
|
249
|
-
channelz::SubchannelNode* channelz_node()
|
|
160
|
+
channelz::SubchannelNode* channelz_node();
|
|
250
161
|
|
|
251
|
-
const ChannelArgs& args() const
|
|
162
|
+
const ChannelArgs& args() const { return args_; }
|
|
252
163
|
|
|
253
|
-
std::string address() const
|
|
164
|
+
std::string address() const {
|
|
254
165
|
return grpc_sockaddr_to_uri(&key_.address())
|
|
255
166
|
.value_or("<unknown address type>");
|
|
256
167
|
}
|
|
@@ -262,242 +173,33 @@ class OldSubchannel final : public Subchannel {
|
|
|
262
173
|
// The watcher will be destroyed either when the subchannel is
|
|
263
174
|
// destroyed or when CancelConnectivityStateWatch() is called.
|
|
264
175
|
void WatchConnectivityState(
|
|
265
|
-
RefCountedPtr<ConnectivityStateWatcherInterface> watcher)
|
|
176
|
+
RefCountedPtr<ConnectivityStateWatcherInterface> watcher)
|
|
266
177
|
ABSL_LOCKS_EXCLUDED(mu_);
|
|
267
178
|
|
|
268
179
|
// Cancels a connectivity state watch.
|
|
269
180
|
// If the watcher has already been destroyed, this is a no-op.
|
|
270
181
|
void CancelConnectivityStateWatch(ConnectivityStateWatcherInterface* watcher)
|
|
271
|
-
override ABSL_LOCKS_EXCLUDED(mu_);
|
|
272
|
-
|
|
273
|
-
// Starts a call in the v1 stack.
|
|
274
|
-
// Returns null if there is no connected subchannel.
|
|
275
|
-
RefCountedPtr<Call> CreateCall(CreateCallArgs args,
|
|
276
|
-
grpc_error_handle* error) override;
|
|
277
|
-
|
|
278
|
-
// Used for calls in the v3 stack.
|
|
279
|
-
RefCountedPtr<UnstartedCallDestination> call_destination() override;
|
|
280
|
-
|
|
281
|
-
// Attempt to connect to the backend. Has no effect if already connected.
|
|
282
|
-
void RequestConnection() override ABSL_LOCKS_EXCLUDED(mu_);
|
|
283
|
-
|
|
284
|
-
// Resets the connection backoff of the subchannel.
|
|
285
|
-
void ResetBackoff() override ABSL_LOCKS_EXCLUDED(mu_);
|
|
286
|
-
|
|
287
|
-
// Access to data producer map.
|
|
288
|
-
// We do not hold refs to the data producer; the implementation is
|
|
289
|
-
// expected to register itself upon construction and remove itself
|
|
290
|
-
// upon destruction.
|
|
291
|
-
//
|
|
292
|
-
// Looks up the current data producer for type and invokes get_or_add()
|
|
293
|
-
// with a pointer to that producer in the map. The get_or_add() function
|
|
294
|
-
// can modify the pointed-to value to update the map. This provides a
|
|
295
|
-
// way to either re-use an existing producer or register a new one in
|
|
296
|
-
// a non-racy way.
|
|
297
|
-
void GetOrAddDataProducer(
|
|
298
|
-
UniqueTypeName type,
|
|
299
|
-
std::function<void(DataProducerInterface**)> get_or_add) override
|
|
300
|
-
ABSL_LOCKS_EXCLUDED(mu_);
|
|
301
|
-
// Removes the data producer from the map, if the current producer for
|
|
302
|
-
// this type is the specified producer.
|
|
303
|
-
void RemoveDataProducer(DataProducerInterface* data_producer) override
|
|
304
|
-
ABSL_LOCKS_EXCLUDED(mu_);
|
|
305
|
-
|
|
306
|
-
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine()
|
|
307
|
-
override {
|
|
308
|
-
return event_engine_;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Ping API for v3 stack.
|
|
312
|
-
void Ping(absl::AnyInvocable<void(absl::Status)> on_ack) override;
|
|
313
|
-
// Ping API for v1 stack.
|
|
314
|
-
// TODO(roth): Remove this when v3 migration is done.
|
|
315
|
-
absl::Status Ping(grpc_closure* on_initiate, grpc_closure* on_ack) override;
|
|
316
|
-
|
|
317
|
-
private:
|
|
318
|
-
// A linked list of ConnectivityStateWatcherInterfaces that are monitoring
|
|
319
|
-
// the subchannel's state.
|
|
320
|
-
class ConnectivityStateWatcherList final {
|
|
321
|
-
public:
|
|
322
|
-
explicit ConnectivityStateWatcherList(OldSubchannel* subchannel)
|
|
323
|
-
: subchannel_(subchannel) {}
|
|
324
|
-
|
|
325
|
-
~ConnectivityStateWatcherList() { Clear(); }
|
|
326
|
-
|
|
327
|
-
void AddWatcherLocked(
|
|
328
|
-
RefCountedPtr<ConnectivityStateWatcherInterface> watcher);
|
|
329
|
-
void RemoveWatcherLocked(ConnectivityStateWatcherInterface* watcher);
|
|
330
|
-
|
|
331
|
-
// Notifies all watchers in the list about a change to state.
|
|
332
|
-
void NotifyLocked(grpc_connectivity_state state,
|
|
333
|
-
const absl::Status& status);
|
|
334
|
-
|
|
335
|
-
// Notifies all watchers about a keepalive update.
|
|
336
|
-
void NotifyOnKeepaliveUpdateLocked(Duration new_keepalive_time);
|
|
337
|
-
|
|
338
|
-
void Clear() { watchers_.clear(); }
|
|
339
|
-
|
|
340
|
-
bool empty() const { return watchers_.empty(); }
|
|
341
|
-
|
|
342
|
-
uint32_t GetMaxConnectionsPerSubchannel() const;
|
|
343
|
-
|
|
344
|
-
private:
|
|
345
|
-
OldSubchannel* subchannel_;
|
|
346
|
-
absl::flat_hash_set<RefCountedPtr<ConnectivityStateWatcherInterface>,
|
|
347
|
-
RefCountedPtrHash<ConnectivityStateWatcherInterface>,
|
|
348
|
-
RefCountedPtrEq<ConnectivityStateWatcherInterface>>
|
|
349
|
-
watchers_;
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
// A ConnectedSubchannel represents a connection.
|
|
353
|
-
// There are concrete subclasses for the v1 and v3 stacks.
|
|
354
|
-
class ConnectedSubchannel;
|
|
355
|
-
class LegacyConnectedSubchannel;
|
|
356
|
-
class NewConnectedSubchannel;
|
|
357
|
-
|
|
358
|
-
class ConnectedSubchannelStateWatcher;
|
|
359
|
-
|
|
360
|
-
// Tears down any existing connection, and arranges for destruction
|
|
361
|
-
void Orphaned() override ABSL_LOCKS_EXCLUDED(mu_);
|
|
362
|
-
|
|
363
|
-
RefCountedPtr<ConnectedSubchannel> GetConnectedSubchannel();
|
|
364
|
-
|
|
365
|
-
// Sets the subchannel's connectivity state to \a state.
|
|
366
|
-
void SetConnectivityStateLocked(grpc_connectivity_state state,
|
|
367
|
-
const absl::Status& status)
|
|
368
|
-
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
|
369
|
-
|
|
370
|
-
void ThrottleKeepaliveTimeLocked(Duration new_keepalive_time)
|
|
371
|
-
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
|
372
|
-
|
|
373
|
-
// Methods for connection.
|
|
374
|
-
void OnRetryTimer() ABSL_LOCKS_EXCLUDED(mu_);
|
|
375
|
-
void OnRetryTimerLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
|
376
|
-
void StartConnectingLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
|
377
|
-
static void OnConnectingFinished(void* arg, grpc_error_handle error)
|
|
378
182
|
ABSL_LOCKS_EXCLUDED(mu_);
|
|
379
|
-
void OnConnectingFinishedLocked(grpc_error_handle error)
|
|
380
|
-
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
|
381
|
-
bool PublishTransportLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
|
382
|
-
|
|
383
|
-
// The subchannel pool this subchannel is in.
|
|
384
|
-
RefCountedPtr<SubchannelPoolInterface> subchannel_pool_;
|
|
385
|
-
// Subchannel key that identifies this subchannel in the subchannel pool.
|
|
386
|
-
const SubchannelKey key_;
|
|
387
|
-
// boolean value that identifies this subchannel is created from event engine
|
|
388
|
-
// endpoint.
|
|
389
|
-
const bool created_from_endpoint_;
|
|
390
|
-
// Actual address to connect to. May be different than the address in
|
|
391
|
-
// key_ if overridden by proxy mapper.
|
|
392
|
-
grpc_resolved_address address_for_connect_;
|
|
393
|
-
// Channel args.
|
|
394
|
-
ChannelArgs args_;
|
|
395
|
-
// pollset_set tracking who's interested in a connection being setup.
|
|
396
|
-
grpc_pollset_set* pollset_set_;
|
|
397
|
-
// Channelz tracking.
|
|
398
|
-
RefCountedPtr<channelz::SubchannelNode> channelz_node_;
|
|
399
|
-
// Minimum connection timeout.
|
|
400
|
-
Duration min_connect_timeout_;
|
|
401
|
-
|
|
402
|
-
// Connection state.
|
|
403
|
-
OrphanablePtr<SubchannelConnector> connector_;
|
|
404
|
-
SubchannelConnector::Result connecting_result_;
|
|
405
|
-
grpc_closure on_connecting_finished_;
|
|
406
|
-
|
|
407
|
-
// Protects the other members.
|
|
408
|
-
Mutex mu_;
|
|
409
|
-
|
|
410
|
-
bool shutdown_ ABSL_GUARDED_BY(mu_) = false;
|
|
411
|
-
|
|
412
|
-
// Connectivity state tracking.
|
|
413
|
-
// Note that the connectivity state implies the state of the
|
|
414
|
-
// Subchannel object:
|
|
415
|
-
// - IDLE: no retry timer pending, can start a connection attempt at any time
|
|
416
|
-
// - CONNECTING: connection attempt in progress
|
|
417
|
-
// - READY: connection attempt succeeded, connected_subchannel_ created
|
|
418
|
-
// - TRANSIENT_FAILURE: connection attempt failed, retry timer pending
|
|
419
|
-
grpc_connectivity_state state_ ABSL_GUARDED_BY(mu_) = GRPC_CHANNEL_IDLE;
|
|
420
|
-
absl::Status status_ ABSL_GUARDED_BY(mu_);
|
|
421
|
-
// The list of connectivity state watchers.
|
|
422
|
-
ConnectivityStateWatcherList watcher_list_ ABSL_GUARDED_BY(mu_);
|
|
423
|
-
// Used for sending connectivity state notifications.
|
|
424
|
-
WorkSerializer work_serializer_;
|
|
425
|
-
|
|
426
|
-
// Active connection, or null.
|
|
427
|
-
RefCountedPtr<ConnectedSubchannel> connected_subchannel_ ABSL_GUARDED_BY(mu_);
|
|
428
|
-
|
|
429
|
-
// Backoff state.
|
|
430
|
-
BackOff backoff_ ABSL_GUARDED_BY(mu_);
|
|
431
|
-
Timestamp next_attempt_time_ ABSL_GUARDED_BY(mu_);
|
|
432
|
-
grpc_event_engine::experimental::EventEngine::TaskHandle retry_timer_handle_
|
|
433
|
-
ABSL_GUARDED_BY(mu_);
|
|
434
|
-
|
|
435
|
-
// Keepalive time period
|
|
436
|
-
Duration keepalive_time_ ABSL_GUARDED_BY(mu_);
|
|
437
|
-
|
|
438
|
-
// Data producer map.
|
|
439
|
-
std::map<UniqueTypeName, DataProducerInterface*> data_producer_map_
|
|
440
|
-
ABSL_GUARDED_BY(mu_);
|
|
441
|
-
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine_;
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
class NewSubchannel final : public Subchannel {
|
|
445
|
-
public:
|
|
446
|
-
// Creates a subchannel.
|
|
447
|
-
static RefCountedPtr<Subchannel> Create(
|
|
448
|
-
OrphanablePtr<SubchannelConnector> connector,
|
|
449
|
-
const grpc_resolved_address& address, const ChannelArgs& args);
|
|
450
|
-
|
|
451
|
-
// The ctor and dtor are not intended to use directly.
|
|
452
|
-
NewSubchannel(SubchannelKey key, OrphanablePtr<SubchannelConnector> connector,
|
|
453
|
-
const ChannelArgs& args);
|
|
454
|
-
~NewSubchannel() override;
|
|
455
|
-
|
|
456
|
-
// Throttles keepalive time to \a new_keepalive_time iff \a new_keepalive_time
|
|
457
|
-
// is larger than the subchannel's current keepalive time. The updated value
|
|
458
|
-
// will have an affect when the subchannel creates a new ConnectedSubchannel.
|
|
459
|
-
void ThrottleKeepaliveTime(Duration new_keepalive_time) override
|
|
460
|
-
ABSL_LOCKS_EXCLUDED(mu_);
|
|
461
|
-
|
|
462
|
-
grpc_pollset_set* pollset_set() const override { return pollset_set_; }
|
|
463
|
-
|
|
464
|
-
channelz::SubchannelNode* channelz_node() override;
|
|
465
|
-
|
|
466
|
-
const ChannelArgs& args() const override { return args_; }
|
|
467
|
-
|
|
468
|
-
std::string address() const override {
|
|
469
|
-
return grpc_sockaddr_to_uri(&key_.address())
|
|
470
|
-
.value_or("<unknown address type>");
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// Starts watching the subchannel's connectivity state.
|
|
474
|
-
// The first callback to the watcher will be delivered ~immediately.
|
|
475
|
-
// Subsequent callbacks will be delivered as the subchannel's state
|
|
476
|
-
// changes.
|
|
477
|
-
// The watcher will be destroyed either when the subchannel is
|
|
478
|
-
// destroyed or when CancelConnectivityStateWatch() is called.
|
|
479
|
-
void WatchConnectivityState(
|
|
480
|
-
RefCountedPtr<ConnectivityStateWatcherInterface> watcher) override
|
|
481
|
-
ABSL_LOCKS_EXCLUDED(mu_);
|
|
482
|
-
|
|
483
|
-
// Cancels a connectivity state watch.
|
|
484
|
-
// If the watcher has already been destroyed, this is a no-op.
|
|
485
|
-
void CancelConnectivityStateWatch(ConnectivityStateWatcherInterface* watcher)
|
|
486
|
-
override ABSL_LOCKS_EXCLUDED(mu_);
|
|
487
183
|
|
|
488
184
|
// Starts a call in the v1 stack.
|
|
489
185
|
// Returns null if there is no connected subchannel.
|
|
490
|
-
|
|
491
|
-
|
|
186
|
+
struct CreateCallArgs {
|
|
187
|
+
grpc_polling_entity* pollent;
|
|
188
|
+
gpr_cycle_counter start_time;
|
|
189
|
+
Timestamp deadline;
|
|
190
|
+
Arena* arena;
|
|
191
|
+
CallCombiner* call_combiner;
|
|
192
|
+
};
|
|
193
|
+
RefCountedPtr<Call> CreateCall(CreateCallArgs args, grpc_error_handle* error);
|
|
492
194
|
|
|
493
195
|
// Used for calls in the v3 stack.
|
|
494
|
-
RefCountedPtr<UnstartedCallDestination> call_destination()
|
|
196
|
+
RefCountedPtr<UnstartedCallDestination> call_destination();
|
|
495
197
|
|
|
496
198
|
// Attempt to connect to the backend. Has no effect if already connected.
|
|
497
|
-
void RequestConnection()
|
|
199
|
+
void RequestConnection() ABSL_LOCKS_EXCLUDED(mu_);
|
|
498
200
|
|
|
499
201
|
// Resets the connection backoff of the subchannel.
|
|
500
|
-
void ResetBackoff()
|
|
202
|
+
void ResetBackoff() ABSL_LOCKS_EXCLUDED(mu_);
|
|
501
203
|
|
|
502
204
|
// Access to data producer map.
|
|
503
205
|
// We do not hold refs to the data producer; the implementation is
|
|
@@ -511,30 +213,35 @@ class NewSubchannel final : public Subchannel {
|
|
|
511
213
|
// a non-racy way.
|
|
512
214
|
void GetOrAddDataProducer(
|
|
513
215
|
UniqueTypeName type,
|
|
514
|
-
std::function<void(DataProducerInterface**)> get_or_add)
|
|
216
|
+
std::function<void(DataProducerInterface**)> get_or_add)
|
|
515
217
|
ABSL_LOCKS_EXCLUDED(mu_);
|
|
516
218
|
// Removes the data producer from the map, if the current producer for
|
|
517
219
|
// this type is the specified producer.
|
|
518
|
-
void RemoveDataProducer(DataProducerInterface* data_producer)
|
|
220
|
+
void RemoveDataProducer(DataProducerInterface* data_producer)
|
|
519
221
|
ABSL_LOCKS_EXCLUDED(mu_);
|
|
520
222
|
|
|
521
|
-
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine()
|
|
522
|
-
override {
|
|
223
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine() {
|
|
523
224
|
return event_engine_;
|
|
524
225
|
}
|
|
525
226
|
|
|
526
227
|
// Ping API for v3 stack.
|
|
527
|
-
void Ping(absl::AnyInvocable<void(absl::Status)> on_ack)
|
|
228
|
+
void Ping(absl::AnyInvocable<void(absl::Status)> on_ack);
|
|
528
229
|
// Ping API for v1 stack.
|
|
529
230
|
// TODO(roth): Remove this when v3 migration is done.
|
|
530
|
-
absl::Status Ping(grpc_closure* on_initiate, grpc_closure* on_ack)
|
|
231
|
+
absl::Status Ping(grpc_closure* on_initiate, grpc_closure* on_ack);
|
|
232
|
+
|
|
233
|
+
// Exposed for testing purposes only.
|
|
234
|
+
static ChannelArgs MakeSubchannelArgs(
|
|
235
|
+
const ChannelArgs& channel_args, const ChannelArgs& address_args,
|
|
236
|
+
const RefCountedPtr<SubchannelPoolInterface>& subchannel_pool,
|
|
237
|
+
const std::string& channel_default_authority);
|
|
531
238
|
|
|
532
239
|
private:
|
|
533
240
|
// A linked list of ConnectivityStateWatcherInterfaces that are monitoring
|
|
534
241
|
// the subchannel's state.
|
|
535
242
|
class ConnectivityStateWatcherList final {
|
|
536
243
|
public:
|
|
537
|
-
explicit ConnectivityStateWatcherList(
|
|
244
|
+
explicit ConnectivityStateWatcherList(Subchannel* subchannel)
|
|
538
245
|
: subchannel_(subchannel) {}
|
|
539
246
|
|
|
540
247
|
~ConnectivityStateWatcherList() { Clear(); }
|
|
@@ -557,7 +264,7 @@ class NewSubchannel final : public Subchannel {
|
|
|
557
264
|
uint32_t GetMaxConnectionsPerSubchannel() const;
|
|
558
265
|
|
|
559
266
|
private:
|
|
560
|
-
|
|
267
|
+
Subchannel* subchannel_;
|
|
561
268
|
absl::flat_hash_set<RefCountedPtr<ConnectivityStateWatcherInterface>,
|
|
562
269
|
RefCountedPtrHash<ConnectivityStateWatcherInterface>,
|
|
563
270
|
RefCountedPtrEq<ConnectivityStateWatcherInterface>>
|
|
@@ -681,6 +388,14 @@ class NewSubchannel final : public Subchannel {
|
|
|
681
388
|
// invalidated as entries are added or removed from the queue (i.e.,
|
|
682
389
|
// std::vector<> would not work).
|
|
683
390
|
std::deque<QueuedCall*> queued_calls_ ABSL_GUARDED_BY(mu_);
|
|
391
|
+
|
|
392
|
+
// Metrics and observability.
|
|
393
|
+
std::shared_ptr<GlobalStatsPluginRegistry::StatsPluginGroup>
|
|
394
|
+
stats_plugin_group_;
|
|
395
|
+
absl::string_view target_;
|
|
396
|
+
absl::string_view backend_service_;
|
|
397
|
+
absl::string_view locality_;
|
|
398
|
+
InstrumentStorageRefPtr<SubchannelMetricsDomainAttempts> attempts_storage_;
|
|
684
399
|
};
|
|
685
400
|
|
|
686
401
|
void TestOnlySetSubchannelAlwaysSendCallsToTransport(bool enabled);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 gRPC authors.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
#include "src/core/client_channel/subchannel_metrics.h"
|
|
18
|
+
|
|
19
|
+
#include "src/core/telemetry/instrument.h"
|
|
20
|
+
|
|
21
|
+
namespace grpc_core {
|
|
22
|
+
|
|
23
|
+
SubchannelMetricsDomainAttempts::CounterHandle
|
|
24
|
+
SubchannelMetricsDomainAttempts::kConnectionAttemptsSucceeded =
|
|
25
|
+
SubchannelMetricsDomainAttempts::RegisterCounter(
|
|
26
|
+
"grpc.subchannel.connection_attempts_succeeded",
|
|
27
|
+
"Number of successful connection attempts.", "attempt");
|
|
28
|
+
|
|
29
|
+
SubchannelMetricsDomainAttempts::CounterHandle
|
|
30
|
+
SubchannelMetricsDomainAttempts::kConnectionAttemptsFailed =
|
|
31
|
+
SubchannelMetricsDomainAttempts::RegisterCounter(
|
|
32
|
+
"grpc.subchannel.connection_attempts_failed",
|
|
33
|
+
"Number of failed connection attempts.", "attempt");
|
|
34
|
+
|
|
35
|
+
SubchannelMetricsDomainDisconnections::CounterHandle
|
|
36
|
+
SubchannelMetricsDomainDisconnections::kDisconnections =
|
|
37
|
+
SubchannelMetricsDomainDisconnections::RegisterCounter(
|
|
38
|
+
"grpc.subchannel.disconnections",
|
|
39
|
+
"Number of times the selected subchannel becomes disconnected.",
|
|
40
|
+
"disconnection");
|
|
41
|
+
|
|
42
|
+
SubchannelConnectionsDomainOpenConnections::UpDownCounterHandle
|
|
43
|
+
SubchannelConnectionsDomainOpenConnections::kOpenConnections =
|
|
44
|
+
SubchannelConnectionsDomainOpenConnections::RegisterUpDownCounter(
|
|
45
|
+
"grpc.subchannel.open_connections",
|
|
46
|
+
"Number of open subchannel connections.", "connection");
|
|
47
|
+
|
|
48
|
+
} // namespace grpc_core
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 gRPC authors.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
#ifndef GRPC_SRC_CORE_CLIENT_CHANNEL_SUBCHANNEL_METRICS_H
|
|
18
|
+
#define GRPC_SRC_CORE_CLIENT_CHANNEL_SUBCHANNEL_METRICS_H
|
|
19
|
+
|
|
20
|
+
#include "src/core/telemetry/instrument.h"
|
|
21
|
+
|
|
22
|
+
namespace grpc_core {
|
|
23
|
+
|
|
24
|
+
class SubchannelMetricsDomainAttempts final
|
|
25
|
+
: public InstrumentDomain<SubchannelMetricsDomainAttempts> {
|
|
26
|
+
public:
|
|
27
|
+
using Backend = LowContentionBackend;
|
|
28
|
+
static constexpr absl::string_view kName = "subchannel";
|
|
29
|
+
GRPC_INSTRUMENT_DOMAIN_LABELS("grpc.target", "grpc.lb.backend_service",
|
|
30
|
+
"grpc.lb.locality");
|
|
31
|
+
|
|
32
|
+
static CounterHandle kConnectionAttemptsSucceeded;
|
|
33
|
+
static CounterHandle kConnectionAttemptsFailed;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
class SubchannelMetricsDomainDisconnections final
|
|
37
|
+
: public InstrumentDomain<SubchannelMetricsDomainDisconnections> {
|
|
38
|
+
public:
|
|
39
|
+
using Backend = LowContentionBackend;
|
|
40
|
+
static constexpr absl::string_view kName = "subchannel";
|
|
41
|
+
GRPC_INSTRUMENT_DOMAIN_LABELS("grpc.target", "grpc.lb.backend_service",
|
|
42
|
+
"grpc.lb.locality", "grpc.disconnect_error");
|
|
43
|
+
|
|
44
|
+
static CounterHandle kDisconnections;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
class SubchannelConnectionsDomainOpenConnections final
|
|
48
|
+
: public InstrumentDomain<SubchannelConnectionsDomainOpenConnections> {
|
|
49
|
+
public:
|
|
50
|
+
using Backend = LowContentionBackend;
|
|
51
|
+
static constexpr absl::string_view kName = "subchannel";
|
|
52
|
+
GRPC_INSTRUMENT_DOMAIN_LABELS("grpc.target", "grpc.security_level",
|
|
53
|
+
"grpc.lb.backend_service", "grpc.lb.locality");
|
|
54
|
+
|
|
55
|
+
static UpDownCounterHandle kOpenConnections;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace grpc_core
|
|
59
|
+
|
|
60
|
+
#endif // GRPC_SRC_CORE_CLIENT_CHANNEL_SUBCHANNEL_METRICS_H
|
|
@@ -53,7 +53,7 @@ FileExternalAccountCredentials::FileFetchBody::FileFetchBody(
|
|
|
53
53
|
void FileExternalAccountCredentials::FileFetchBody::ReadFile() {
|
|
54
54
|
// To retrieve the subject token, we read the file every time we make a
|
|
55
55
|
// request because it may have changed since the last request.
|
|
56
|
-
auto content_slice = LoadFile(creds_->file_
|
|
56
|
+
auto content_slice = LoadFile(creds_->file_);
|
|
57
57
|
if (!content_slice.ok()) {
|
|
58
58
|
Finish(absl::UnavailableError(content_slice.status().message()));
|
|
59
59
|
return;
|
|
@@ -149,9 +149,8 @@ UrlExternalAccountCredentials::RetrieveSubjectToken(
|
|
|
149
149
|
URI::Create(url_.scheme(), url_.user_info(), url_.host_port(),
|
|
150
150
|
url_full_path_, {} /* query params */, "" /* fragment */);
|
|
151
151
|
if (!url_for_request.ok()) {
|
|
152
|
-
return MakeOrphanable<NoOpFetchBody>(
|
|
153
|
-
|
|
154
|
-
absl_status_to_grpc_error(url_for_request.status()));
|
|
152
|
+
return MakeOrphanable<NoOpFetchBody>(event_engine(), std::move(on_done),
|
|
153
|
+
url_for_request.status());
|
|
155
154
|
}
|
|
156
155
|
return MakeOrphanable<HttpFetchBody>(
|
|
157
156
|
[&](grpc_http_response* response, grpc_closure* on_http_response) {
|
|
@@ -37,30 +37,14 @@ namespace grpc_core {
|
|
|
37
37
|
// JwtTokenFetcherCallCredentials
|
|
38
38
|
//
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
JwtTokenFetcherCallCredentials::
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
[on_done = std::move(on_done)](
|
|
49
|
-
absl::StatusOr<grpc_http_response> response) mutable {
|
|
50
|
-
if (!response.ok()) {
|
|
51
|
-
on_done(response.status());
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
absl::string_view body(response->body, response->body_length);
|
|
55
|
-
auto expiration_time = GetJwtExpirationTime(body);
|
|
56
|
-
if (!expiration_time.ok()) {
|
|
57
|
-
on_done(expiration_time.status());
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
on_done(MakeRefCounted<Token>(
|
|
61
|
-
Slice::FromCopiedString(absl::StrCat("Bearer ", body)),
|
|
62
|
-
*expiration_time));
|
|
63
|
-
});
|
|
40
|
+
absl::StatusOr<RefCountedPtr<TokenFetcherCredentials::Token>>
|
|
41
|
+
JwtTokenFetcherCallCredentials::ExtractToken(
|
|
42
|
+
const grpc_http_response& response) {
|
|
43
|
+
absl::string_view body(response.body, response.body_length);
|
|
44
|
+
auto expiration_time = GetJwtExpirationTime(body);
|
|
45
|
+
if (!expiration_time.ok()) return expiration_time.status();
|
|
46
|
+
return MakeRefCounted<Token>(
|
|
47
|
+
Slice::FromCopiedString(absl::StrCat("Bearer ", body)), *expiration_time);
|
|
64
48
|
}
|
|
65
49
|
|
|
66
50
|
//
|
|
@@ -42,16 +42,13 @@ namespace grpc_core {
|
|
|
42
42
|
// Subclasses must implement StartHttpRequest().
|
|
43
43
|
class JwtTokenFetcherCallCredentials : public HttpTokenFetcherCredentials {
|
|
44
44
|
public:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
absl::AnyInvocable<
|
|
48
|
-
void(absl::StatusOr<RefCountedPtr<TokenFetcherCredentials::Token>>)>
|
|
49
|
-
on_done) final;
|
|
45
|
+
absl::StatusOr<RefCountedPtr<Token>> ExtractToken(
|
|
46
|
+
const grpc_http_response& response) final;
|
|
50
47
|
};
|
|
51
48
|
|
|
52
49
|
// GCP service account identity call credentials.
|
|
53
50
|
// See gRFC A83 (https://github.com/grpc/proposal/pull/438).
|
|
54
|
-
class GcpServiceAccountIdentityCallCredentials
|
|
51
|
+
class GcpServiceAccountIdentityCallCredentials final
|
|
55
52
|
: public JwtTokenFetcherCallCredentials {
|
|
56
53
|
public:
|
|
57
54
|
explicit GcpServiceAccountIdentityCallCredentials(absl::string_view audience)
|