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.
- checksums.yaml +4 -4
- data/Makefile +18 -5
- data/include/grpc/credentials.h +21 -5
- data/src/core/call/call_filters.cc +4 -4
- data/src/core/call/call_filters.h +36 -36
- data/src/core/call/call_spine.h +27 -27
- data/src/core/call/client_call.cc +6 -5
- data/src/core/call/filter_fusion.h +5 -5
- data/src/core/call/metadata_batch.h +3 -3
- data/src/core/call/security_context.cc +1 -1
- data/src/core/call/server_call.cc +4 -4
- data/src/core/call/server_call.h +1 -1
- data/src/core/channelz/channelz.cc +12 -18
- data/src/core/channelz/channelz.h +32 -16
- data/src/core/channelz/channelz_registry.h +11 -0
- data/src/core/channelz/property_list.cc +18 -0
- data/src/core/channelz/property_list.h +10 -1
- data/src/core/channelz/text_encode.cc +66 -0
- data/src/core/channelz/text_encode.h +29 -0
- data/src/core/channelz/v2tov1/convert.cc +11 -0
- data/src/core/channelz/v2tov1/legacy_api.cc +15 -8
- data/src/core/channelz/ztrace_collector.h +247 -86
- data/src/core/client_channel/backup_poller.cc +5 -6
- data/src/core/client_channel/client_channel.cc +20 -13
- data/src/core/client_channel/client_channel_filter.cc +53 -45
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_internal.h +3 -4
- data/src/core/client_channel/config_selector.h +3 -3
- data/src/core/client_channel/dynamic_filters.cc +3 -3
- data/src/core/client_channel/global_subchannel_pool.cc +0 -37
- data/src/core/client_channel/global_subchannel_pool.h +0 -27
- data/src/core/client_channel/load_balanced_call_destination.cc +7 -7
- data/src/core/client_channel/local_subchannel_pool.cc +4 -4
- data/src/core/client_channel/retry_filter.h +3 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -5
- data/src/core/client_channel/subchannel.cc +8 -8
- data/src/core/client_channel/subchannel_stream_client.cc +4 -4
- data/src/core/config/config_vars.cc +30 -1
- data/src/core/config/config_vars.h +21 -0
- data/src/core/config/core_configuration.cc +5 -5
- data/src/core/config/core_configuration.h +7 -7
- data/src/core/config/load_config.cc +12 -0
- data/src/core/config/load_config.h +2 -0
- data/src/core/credentials/call/call_credentials.h +2 -2
- data/src/core/credentials/call/call_creds_util.cc +4 -3
- data/src/core/credentials/call/composite/composite_call_credentials.cc +4 -4
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +3 -3
- data/src/core/credentials/call/external/external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/iam/iam_credentials.cc +4 -4
- data/src/core/credentials/call/jwt/json_token.cc +3 -3
- data/src/core/credentials/call/jwt/jwt_credentials.cc +2 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +14 -13
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +20 -12
- data/src/core/credentials/call/plugin/plugin_credentials.cc +2 -2
- data/src/core/credentials/transport/alts/alts_credentials.cc +4 -4
- data/src/core/credentials/transport/alts/alts_security_connector.cc +14 -12
- data/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc +22 -2
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.cc +10 -1
- data/src/core/credentials/transport/alts/grpc_alts_credentials_options.h +31 -0
- data/src/core/credentials/transport/alts/grpc_alts_credentials_server_options.cc +8 -3
- data/src/core/credentials/transport/composite/composite_channel_credentials.cc +5 -5
- data/src/core/credentials/transport/fake/fake_security_connector.cc +2 -2
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +78 -28
- data/src/core/credentials/transport/insecure/insecure_security_connector.cc +3 -3
- data/src/core/credentials/transport/local/local_security_connector.cc +8 -8
- data/src/core/credentials/transport/security_connector.cc +5 -5
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +12 -12
- data/src/core/credentials/transport/ssl/ssl_credentials.h +2 -2
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +3 -3
- data/src/core/credentials/transport/tls/certificate_provider_registry.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +24 -24
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +5 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.cc +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_verifier.h +2 -2
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +17 -17
- data/src/core/credentials/transport/tls/ssl_utils.cc +14 -9
- data/src/core/credentials/transport/tls/tls_credentials.cc +2 -2
- data/src/core/credentials/transport/tls/tls_security_connector.cc +11 -11
- data/src/core/credentials/transport/transport_credentials.cc +2 -2
- data/src/core/credentials/transport/transport_credentials.h +2 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +5 -5
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +2 -0
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +8 -8
- data/src/core/ext/filters/http/message_compress/compression_filter.h +3 -3
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +7 -7
- data/src/core/ext/transport/chttp2/alpn/alpn.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +10 -9
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +10 -7
- data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +96 -88
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/flow_control.h +12 -7
- data/src/core/ext/transport/chttp2/transport/flow_control_manager.h +60 -0
- data/src/core/ext/transport/chttp2/transport/frame.cc +32 -10
- data/src/core/ext/transport/chttp2/transport/frame.h +16 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +28 -12
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +4 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +8 -8
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +27 -27
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +543 -366
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +198 -277
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.cc +3 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_manager.h +11 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +179 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +51 -23
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +13 -6
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +115 -71
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -14
- data/src/core/ext/transport/chttp2/transport/message_assembler.h +7 -7
- data/src/core/ext/transport/chttp2/transport/parsing.cc +17 -15
- data/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +62 -26
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +58 -22
- data/src/core/ext/transport/chttp2/transport/stream.h +207 -0
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +328 -187
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +7 -7
- data/src/core/ext/transport/chttp2/transport/transport_common.cc +17 -1
- data/src/core/ext/transport/chttp2/transport/transport_common.h +52 -0
- data/src/core/ext/transport/chttp2/transport/varint.h +2 -2
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +181 -79
- data/src/core/ext/transport/chttp2/transport/write_size_policy.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +3 -3
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb.h +740 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.c +218 -0
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/service.upb_minitable.h +46 -0
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h +87 -55
- data/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c +23 -21
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.c +80 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/channelz.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.c +129 -0
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/service.upbdefs.h +72 -0
- data/src/core/filter/auth/server_auth_filter.cc +2 -2
- data/src/core/handshaker/handshaker.cc +3 -3
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +2 -2
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +2 -2
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +31 -8
- data/src/core/handshaker/security/secure_endpoint.cc +16 -6
- data/src/core/handshaker/security/security_handshaker.cc +3 -3
- data/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +2 -2
- data/src/core/lib/channel/channel_stack.cc +8 -5
- data/src/core/lib/channel/channel_stack.h +3 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -0
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/promise_based_filter.cc +69 -64
- data/src/core/lib/channel/promise_based_filter.h +16 -15
- data/src/core/lib/compression/compression_internal.cc +2 -2
- data/src/core/lib/compression/message_compress.cc +7 -7
- data/src/core/lib/event_engine/ares_resolver.cc +22 -20
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +2 -2
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +2 -2
- data/src/core/lib/event_engine/extensions/channelz.h +2 -2
- data/src/core/lib/event_engine/extensions/supports_fd.h +5 -5
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +8 -8
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +10 -10
- data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +23 -22
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +11 -11
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +168 -170
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +33 -54
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +4 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +5 -5
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +1 -1
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -1
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +3 -3
- data/src/core/lib/event_engine/resolved_address.cc +3 -3
- data/src/core/lib/event_engine/shim.cc +8 -11
- data/src/core/lib/event_engine/shim.h +2 -1
- data/src/core/lib/event_engine/slice.cc +2 -2
- data/src/core/lib/event_engine/tcp_socket_utils.cc +11 -11
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +7 -7
- data/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +31 -31
- data/src/core/lib/event_engine/windows/iocp.cc +10 -10
- data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -11
- data/src/core/lib/event_engine/windows/windows_engine.cc +16 -14
- data/src/core/lib/event_engine/windows/windows_listener.cc +7 -7
- data/src/core/lib/experiments/experiments.cc +105 -18
- data/src/core/lib/experiments/experiments.h +43 -11
- data/src/core/lib/iomgr/call_combiner.cc +3 -3
- data/src/core/lib/iomgr/endpoint_cfstream.cc +6 -6
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +5 -5
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +15 -14
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +15 -15
- data/src/core/lib/iomgr/ev_poll_posix.cc +11 -11
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +5 -4
- data/src/core/lib/iomgr/event_engine_shims/endpoint.h +1 -1
- data/src/core/lib/iomgr/iocp_windows.cc +8 -8
- data/src/core/lib/iomgr/iomgr_windows.cc +3 -3
- data/src/core/lib/iomgr/lockfree_event.cc +2 -2
- data/src/core/lib/iomgr/polling_entity.cc +3 -3
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +2 -2
- data/src/core/lib/iomgr/socket_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
- data/src/core/lib/iomgr/tcp_client_windows.cc +4 -4
- data/src/core/lib/iomgr/tcp_posix.cc +42 -42
- data/src/core/lib/iomgr/tcp_server.cc +5 -0
- data/src/core/lib/iomgr/tcp_server.h +7 -0
- data/src/core/lib/iomgr/tcp_server_posix.cc +47 -27
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -5
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +2 -2
- data/src/core/lib/iomgr/tcp_server_windows.cc +68 -29
- data/src/core/lib/iomgr/tcp_windows.cc +7 -7
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -2
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +2 -2
- data/src/core/lib/promise/activity.cc +2 -2
- data/src/core/lib/promise/activity.h +6 -6
- data/src/core/lib/promise/context.h +2 -2
- data/src/core/lib/promise/detail/join_state.h +9 -9
- data/src/core/lib/promise/detail/seq_state.h +13 -13
- data/src/core/lib/promise/detail/status.h +2 -2
- data/src/core/lib/promise/for_each.h +5 -5
- data/src/core/lib/promise/interceptor_list.h +2 -2
- data/src/core/lib/promise/latch.h +7 -7
- data/src/core/lib/promise/mpsc.cc +26 -26
- data/src/core/lib/promise/mpsc.h +2 -2
- data/src/core/lib/promise/observable.h +4 -4
- data/src/core/lib/promise/party.cc +32 -25
- data/src/core/lib/promise/party.h +16 -19
- data/src/core/lib/promise/pipe.h +15 -15
- data/src/core/lib/promise/poll.h +5 -4
- data/src/core/lib/promise/promise.h +0 -2
- data/src/core/lib/promise/sleep.cc +3 -1
- data/src/core/lib/promise/status_flag.h +7 -7
- data/src/core/lib/promise/try_join.h +2 -2
- data/src/core/lib/promise/try_seq.h +2 -2
- data/src/core/lib/resource_quota/arena.h +15 -2
- data/src/core/lib/resource_quota/connection_quota.cc +9 -7
- data/src/core/lib/resource_quota/memory_quota.cc +45 -24
- data/src/core/lib/resource_quota/memory_quota.h +48 -16
- data/src/core/lib/resource_quota/telemetry.h +54 -0
- data/src/core/lib/resource_quota/thread_quota.cc +2 -2
- data/src/core/lib/resource_tracker/resource_tracker.cc +33 -0
- data/src/core/lib/resource_tracker/resource_tracker.h +46 -0
- data/src/core/lib/security/authorization/audit_logging.cc +5 -5
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +2 -2
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/surface/byte_buffer_reader.cc +2 -2
- data/src/core/lib/surface/call.cc +16 -14
- data/src/core/lib/surface/call.h +1 -1
- data/src/core/lib/surface/call_utils.cc +2 -2
- data/src/core/lib/surface/call_utils.h +2 -2
- data/src/core/lib/surface/channel.cc +4 -4
- data/src/core/lib/surface/channel_create.cc +10 -6
- data/src/core/lib/surface/channel_init.cc +80 -23
- data/src/core/lib/surface/channel_init.h +26 -11
- data/src/core/lib/surface/completion_queue.cc +17 -16
- data/src/core/lib/surface/completion_queue_factory.cc +7 -7
- data/src/core/lib/surface/connection_context.h +45 -2
- data/src/core/lib/surface/filter_stack_call.cc +12 -23
- data/src/core/lib/surface/filter_stack_call.h +3 -4
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/validate_metadata.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.h +3 -3
- data/src/core/lib/transport/promise_endpoint.cc +3 -3
- data/src/core/lib/transport/promise_endpoint.h +8 -8
- data/src/core/lib/transport/timeout_encoding.cc +4 -4
- data/src/core/load_balancing/child_policy_handler.cc +4 -4
- data/src/core/load_balancing/endpoint_list.cc +2 -2
- data/src/core/load_balancing/grpclb/grpclb.cc +24 -24
- data/src/core/load_balancing/health_check_client.cc +4 -4
- data/src/core/load_balancing/health_check_client_internal.h +2 -2
- data/src/core/load_balancing/lb_policy_registry.cc +2 -2
- data/src/core/load_balancing/oob_backend_metric.cc +4 -4
- data/src/core/load_balancing/oob_backend_metric_internal.h +2 -2
- data/src/core/load_balancing/outlier_detection/outlier_detection.cc +2 -2
- data/src/core/load_balancing/pick_first/pick_first.cc +14 -14
- data/src/core/load_balancing/priority/priority.cc +23 -24
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -3
- data/src/core/load_balancing/rls/rls.cc +13 -13
- data/src/core/load_balancing/round_robin/round_robin.cc +9 -9
- data/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +3 -3
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -26
- data/src/core/load_balancing/weighted_target/weighted_target.cc +5 -5
- data/src/core/load_balancing/xds/cds.cc +76 -32
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +3 -3
- data/src/core/load_balancing/xds/xds_override_host.cc +4 -4
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +33 -33
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +10 -10
- data/src/core/resolver/dns/dns_resolver_plugin.cc +6 -3
- data/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +2 -2
- data/src/core/resolver/endpoint_addresses.cc +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +41 -54
- data/src/core/resolver/polling_resolver.cc +3 -3
- data/src/core/resolver/resolver_registry.cc +5 -4
- data/src/core/resolver/xds/xds_dependency_manager.cc +5 -5
- data/src/core/resolver/xds/xds_resolver.cc +9 -9
- data/src/core/server/server.cc +38 -38
- data/src/core/server/server_call_tracer_filter.h +4 -4
- data/src/core/server/server_config_selector_filter.cc +2 -2
- data/src/core/server/xds_server_config_fetcher.cc +9 -8
- data/src/core/service_config/service_config_impl.h +2 -2
- data/src/core/telemetry/call_tracer.cc +39 -49
- data/src/core/telemetry/call_tracer.h +199 -22
- data/src/core/telemetry/histogram.h +205 -0
- data/src/core/telemetry/instrument.cc +719 -0
- data/src/core/telemetry/instrument.h +932 -0
- data/src/core/telemetry/metrics.cc +13 -5
- data/src/core/telemetry/metrics.h +3 -1
- data/src/core/telemetry/stats_data.cc +0 -19
- data/src/core/telemetry/stats_data.h +0 -19
- data/src/core/transport/auth_context.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +78 -45
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +1 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +3 -3
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +39 -31
- data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.cc +3 -3
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +7 -7
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +3 -3
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/key_logging/ssl_key_logging.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +9 -9
- data/src/core/tsi/ssl/session_cache/ssl_session_openssl.cc +3 -3
- data/src/core/tsi/ssl_transport_security.cc +26 -25
- data/src/core/tsi/ssl_transport_security_utils.cc +9 -9
- data/src/core/util/chunked_vector.h +4 -4
- data/src/core/util/event_log.cc +2 -2
- data/src/core/util/gcp_metadata_query.cc +2 -2
- data/src/core/util/grpc_check.cc +22 -0
- data/src/core/util/grpc_check.h +103 -0
- data/src/core/util/http_client/httpcli.cc +3 -3
- data/src/core/util/http_client/parser.cc +4 -4
- data/src/core/util/latent_see.h +7 -4
- data/src/core/util/lru_cache.h +4 -4
- data/src/core/util/memory_usage.h +16 -0
- data/src/core/util/posix/directory_reader.cc +3 -2
- data/src/core/util/posix/sync.cc +24 -24
- data/src/core/util/postmortem_emit.cc +52 -0
- data/src/core/util/postmortem_emit.h +30 -0
- data/src/core/util/ref_counted_ptr.h +5 -0
- data/src/core/util/trie_lookup.h +170 -0
- data/src/core/util/unique_ptr_with_bitset.h +5 -5
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +6 -1
- data/src/core/xds/grpc/xds_certificate_provider.cc +3 -3
- data/src/core/xds/grpc/xds_client_grpc.cc +34 -15
- data/src/core/xds/grpc/xds_client_grpc.h +4 -1
- data/src/core/xds/grpc/xds_cluster_parser.cc +2 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +2 -2
- data/src/core/xds/grpc/xds_endpoint_parser.cc +2 -2
- data/src/core/xds/grpc/xds_http_filter_registry.cc +4 -3
- data/src/core/xds/grpc/xds_listener_parser.cc +3 -3
- data/src/core/xds/grpc/xds_matcher.cc +277 -0
- data/src/core/xds/grpc/xds_matcher.h +432 -0
- data/src/core/xds/grpc/xds_matcher_action.cc +47 -0
- data/src/core/xds/grpc/xds_matcher_action.h +48 -0
- data/src/core/xds/grpc/xds_matcher_context.cc +29 -0
- data/src/core/xds/grpc/xds_matcher_context.h +46 -0
- data/src/core/xds/grpc/xds_matcher_input.cc +79 -0
- data/src/core/xds/grpc/xds_matcher_input.h +105 -0
- data/src/core/xds/grpc/xds_matcher_parse.cc +356 -0
- data/src/core/xds/grpc/xds_matcher_parse.h +39 -0
- data/src/core/xds/grpc/xds_metadata.cc +4 -3
- data/src/core/xds/grpc/xds_route_config_parser.cc +6 -6
- data/src/core/xds/grpc/xds_routing.cc +3 -3
- data/src/core/xds/grpc/xds_transport_grpc.cc +10 -10
- data/src/core/xds/xds_client/lrs_client.cc +6 -6
- data/src/core/xds/xds_client/xds_client.cc +9 -9
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/abseil-cpp/absl/container/internal/node_slot_policy.h +95 -0
- data/third_party/abseil-cpp/absl/container/node_hash_map.h +687 -0
- metadata +37 -2
@@ -23,7 +23,6 @@
|
|
23
23
|
#include <type_traits>
|
24
24
|
#include <utility>
|
25
25
|
|
26
|
-
#include "absl/log/check.h"
|
27
26
|
#include "absl/log/log.h"
|
28
27
|
#include "absl/memory/memory.h"
|
29
28
|
#include "absl/status/status.h"
|
@@ -35,6 +34,7 @@
|
|
35
34
|
#include "src/core/lib/promise/promise.h"
|
36
35
|
#include "src/core/lib/transport/call_final_info.h"
|
37
36
|
#include "src/core/lib/transport/transport.h"
|
37
|
+
#include "src/core/util/grpc_check.h"
|
38
38
|
#include "src/core/util/manual_constructor.h"
|
39
39
|
#include "src/core/util/status_helper.h"
|
40
40
|
#include "src/core/util/type_list.h"
|
@@ -1021,14 +1021,14 @@ struct FilterWrapper<Typelist<Filter>> {
|
|
1021
1021
|
|
1022
1022
|
absl::Status status() const { return filter_.status(); }
|
1023
1023
|
bool StartTransportOp(grpc_transport_op* op) {
|
1024
|
-
|
1024
|
+
GRPC_CHECK(filter_.ok());
|
1025
1025
|
return (*filter_)->StartTransportOp(op);
|
1026
1026
|
}
|
1027
1027
|
|
1028
1028
|
Filter* get_filter() { return (*filter_).get(); }
|
1029
1029
|
|
1030
1030
|
bool GetChannelInfo(const grpc_channel_info* info) {
|
1031
|
-
|
1031
|
+
GRPC_CHECK(filter_.ok());
|
1032
1032
|
return (*filter_)->GetChannelInfo(info);
|
1033
1033
|
}
|
1034
1034
|
|
@@ -1053,13 +1053,13 @@ struct FilterWrapper<Typelist<Filter0, Filters...>>
|
|
1053
1053
|
Filter0* get_filter() { return (*filter0_).get(); }
|
1054
1054
|
|
1055
1055
|
bool StartTransportOp(grpc_transport_op* op) {
|
1056
|
-
|
1056
|
+
GRPC_CHECK(filter0_.ok());
|
1057
1057
|
return (*filter0_)->StartTransportOp(op) ||
|
1058
1058
|
FilterWrapper<Typelist<Filters...>>::StartTransportOp(op);
|
1059
1059
|
}
|
1060
1060
|
|
1061
1061
|
bool GetChannelInfo(const grpc_channel_info* info) {
|
1062
|
-
|
1062
|
+
GRPC_CHECK(filter0_.ok());
|
1063
1063
|
return (*filter0_)->GetChannelInfo(info) ||
|
1064
1064
|
FilterWrapper<Typelist<Filters...>>::GetChannelInfo(info);
|
1065
1065
|
}
|
@@ -32,7 +32,6 @@
|
|
32
32
|
|
33
33
|
#include "absl/container/inlined_vector.h"
|
34
34
|
#include "absl/functional/function_ref.h"
|
35
|
-
#include "absl/log/check.h"
|
36
35
|
#include "absl/meta/type_traits.h"
|
37
36
|
#include "absl/strings/numbers.h"
|
38
37
|
#include "absl/strings/string_view.h"
|
@@ -45,6 +44,7 @@
|
|
45
44
|
#include "src/core/lib/promise/poll.h"
|
46
45
|
#include "src/core/lib/slice/slice.h"
|
47
46
|
#include "src/core/util/chunked_vector.h"
|
47
|
+
#include "src/core/util/grpc_check.h"
|
48
48
|
#include "src/core/util/if_list.h"
|
49
49
|
#include "src/core/util/packed_table.h"
|
50
50
|
#include "src/core/util/time.h"
|
@@ -107,7 +107,7 @@ struct TeMetadata {
|
|
107
107
|
MetadataParseErrorFn on_error);
|
108
108
|
static ValueType MementoToValue(MementoType te) { return te; }
|
109
109
|
static StaticSlice Encode(ValueType x) {
|
110
|
-
|
110
|
+
GRPC_CHECK(x == kTrailers);
|
111
111
|
return StaticSlice::FromStaticString("trailers");
|
112
112
|
}
|
113
113
|
static const char* DisplayValue(ValueType te);
|
@@ -213,7 +213,7 @@ struct CompressionAlgorithmBasedMetadata {
|
|
213
213
|
MetadataParseErrorFn on_error);
|
214
214
|
static ValueType MementoToValue(MementoType x) { return x; }
|
215
215
|
static Slice Encode(ValueType x) {
|
216
|
-
|
216
|
+
GRPC_CHECK(x != GRPC_COMPRESS_ALGORITHMS_COUNT);
|
217
217
|
return Slice::FromStaticString(CompressionAlgorithmAsString(x));
|
218
218
|
}
|
219
219
|
static const char* DisplayValue(ValueType x) {
|
@@ -25,7 +25,6 @@
|
|
25
25
|
|
26
26
|
#include <algorithm>
|
27
27
|
|
28
|
-
#include "absl/log/check.h"
|
29
28
|
#include "absl/log/log.h"
|
30
29
|
#include "src/core/credentials/call/call_credentials.h"
|
31
30
|
#include "src/core/lib/channel/channel_args.h"
|
@@ -33,6 +32,7 @@
|
|
33
32
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
34
33
|
#include "src/core/lib/resource_quota/arena.h"
|
35
34
|
#include "src/core/lib/surface/call.h"
|
35
|
+
#include "src/core/util/grpc_check.h"
|
36
36
|
#include "src/core/util/ref_counted_ptr.h"
|
37
37
|
|
38
38
|
// --- grpc_call ---
|
@@ -37,7 +37,6 @@
|
|
37
37
|
#include <string>
|
38
38
|
#include <utility>
|
39
39
|
|
40
|
-
#include "absl/log/check.h"
|
41
40
|
#include "absl/strings/string_view.h"
|
42
41
|
#include "src/core/call/metadata.h"
|
43
42
|
#include "src/core/call/metadata_batch.h"
|
@@ -51,6 +50,7 @@
|
|
51
50
|
#include "src/core/lib/surface/completion_queue.h"
|
52
51
|
#include "src/core/server/server_interface.h"
|
53
52
|
#include "src/core/util/bitset.h"
|
53
|
+
#include "src/core/util/grpc_check.h"
|
54
54
|
#include "src/core/util/latent_see.h"
|
55
55
|
|
56
56
|
namespace grpc_core {
|
@@ -169,12 +169,12 @@ void ServerCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
|
|
169
169
|
// after passing it in, which shouldn't be a supported API.
|
170
170
|
metadata->Set(GrpcMessageMetadata(), Slice(grpc_slice_copy(*details)));
|
171
171
|
}
|
172
|
-
|
172
|
+
GRPC_CHECK(metadata != nullptr);
|
173
173
|
bool wait_for_initial_metadata_scheduled =
|
174
174
|
sent_server_initial_metadata_batch_.load(std::memory_order_relaxed);
|
175
175
|
return [this, metadata = std::move(metadata),
|
176
176
|
wait_for_initial_metadata_scheduled]() mutable {
|
177
|
-
|
177
|
+
GRPC_CHECK(metadata != nullptr);
|
178
178
|
// If there was a send initial metadata batch sent prior to this one, then
|
179
179
|
// make sure it's been scheduled first - otherwise we may accidentally
|
180
180
|
// treat this as trailers only.
|
@@ -184,7 +184,7 @@ void ServerCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag,
|
|
184
184
|
[this]() { return server_initial_metadata_scheduled_.Wait(); },
|
185
185
|
[]() { return Empty{}; }),
|
186
186
|
[this, metadata = std::move(metadata)]() mutable -> Poll<Success> {
|
187
|
-
|
187
|
+
GRPC_CHECK(metadata != nullptr);
|
188
188
|
call_handler_.PushServerTrailingMetadata(std::move(metadata));
|
189
189
|
return Success{};
|
190
190
|
});
|
data/src/core/call/server_call.h
CHANGED
@@ -39,7 +39,6 @@
|
|
39
39
|
#include <string>
|
40
40
|
#include <utility>
|
41
41
|
|
42
|
-
#include "absl/log/check.h"
|
43
42
|
#include "absl/status/status.h"
|
44
43
|
#include "absl/strings/str_format.h"
|
45
44
|
#include "absl/strings/string_view.h"
|
@@ -53,6 +52,7 @@
|
|
53
52
|
#include "src/core/telemetry/stats.h"
|
54
53
|
#include "src/core/telemetry/stats_data.h"
|
55
54
|
#include "src/core/util/crash.h"
|
55
|
+
#include "src/core/util/grpc_check.h"
|
56
56
|
#include "src/core/util/ref_counted.h"
|
57
57
|
#include "src/core/util/ref_counted_ptr.h"
|
58
58
|
|
@@ -138,20 +138,14 @@ Json::Object BaseNode::AdditionalInfo() {
|
|
138
138
|
return sink_impl->Finalize(!completed);
|
139
139
|
}
|
140
140
|
|
141
|
-
|
142
|
-
absl::string_view name,
|
143
|
-
std::map<std::string, std::string> args,
|
141
|
+
std::unique_ptr<ZTrace> BaseNode::RunZTrace(
|
142
|
+
absl::string_view name, ZTrace::Args args,
|
144
143
|
std::shared_ptr<grpc_event_engine::experimental::EventEngine> event_engine,
|
145
|
-
|
146
|
-
// Limit deadline to help contain potential resource exhaustion due to
|
147
|
-
// tracing.
|
148
|
-
deadline = std::min(deadline, Timestamp::Now() + Duration::Minutes(10));
|
144
|
+
ZTrace::Callback callback) {
|
149
145
|
auto fail = [&callback, event_engine](absl::Status status) {
|
150
146
|
event_engine->Run(
|
151
147
|
[callback = std::move(callback), status = std::move(status)]() mutable {
|
152
|
-
|
153
|
-
object["status"] = Json::FromString(status.ToString());
|
154
|
-
callback(Json::FromObject(std::move(object)));
|
148
|
+
callback(status);
|
155
149
|
});
|
156
150
|
};
|
157
151
|
std::unique_ptr<ZTrace> ztrace;
|
@@ -165,20 +159,21 @@ void BaseNode::RunZTrace(
|
|
165
159
|
} else {
|
166
160
|
fail(absl::InternalError(
|
167
161
|
absl::StrCat("Ambiguous ztrace handler: ", name)));
|
168
|
-
return;
|
162
|
+
return nullptr;
|
169
163
|
}
|
170
164
|
}
|
171
165
|
}
|
172
166
|
}
|
173
167
|
if (ztrace == nullptr) {
|
174
168
|
fail(absl::NotFoundError(absl::StrCat("ztrace not found: ", name)));
|
175
|
-
return;
|
169
|
+
return nullptr;
|
176
170
|
}
|
177
|
-
ztrace->Run(
|
171
|
+
ztrace->Run(std::move(args), event_engine, std::move(callback));
|
172
|
+
return ztrace;
|
178
173
|
}
|
179
174
|
|
180
175
|
void BaseNode::SerializeEntity(grpc_channelz_v2_Entity* entity,
|
181
|
-
upb_Arena* arena) {
|
176
|
+
upb_Arena* arena, absl::Duration timeout) {
|
182
177
|
grpc_channelz_v2_Entity_set_id(entity, uuid());
|
183
178
|
grpc_channelz_v2_Entity_set_kind(
|
184
179
|
entity, StdStringToUpbString(EntityTypeToKind(type_)));
|
@@ -208,8 +203,7 @@ void BaseNode::SerializeEntity(grpc_channelz_v2_Entity* entity,
|
|
208
203
|
}
|
209
204
|
make_data_sink().AddData("v1_compatibility",
|
210
205
|
PropertyList().Set("name", name()));
|
211
|
-
bool completed =
|
212
|
-
done->WaitForNotificationWithTimeout(absl::Milliseconds(100));
|
206
|
+
bool completed = done->WaitForNotificationWithTimeout(timeout);
|
213
207
|
sink_impl->Finalize(!completed, entity, arena);
|
214
208
|
|
215
209
|
trace_.Render(entity, arena);
|
@@ -219,11 +213,11 @@ void BaseNode::AddNodeSpecificData(DataSink) {
|
|
219
213
|
// Default implementation does nothing.
|
220
214
|
}
|
221
215
|
|
222
|
-
std::string BaseNode::SerializeEntityToString() {
|
216
|
+
std::string BaseNode::SerializeEntityToString(absl::Duration timeout) {
|
223
217
|
upb_Arena* arena = upb_Arena_New();
|
224
218
|
auto cleanup = absl::MakeCleanup([arena]() { upb_Arena_Free(arena); });
|
225
219
|
grpc_channelz_v2_Entity* entity = grpc_channelz_v2_Entity_new(arena);
|
226
|
-
SerializeEntity(entity, arena);
|
220
|
+
SerializeEntity(entity, arena, timeout);
|
227
221
|
size_t length;
|
228
222
|
auto* bytes = grpc_channelz_v2_Entity_serialize(entity, arena, &length);
|
229
223
|
return std::string(bytes, length);
|
@@ -52,6 +52,7 @@
|
|
52
52
|
#include "src/core/util/time_precise.h"
|
53
53
|
#include "src/core/util/useful.h"
|
54
54
|
#include "src/proto/grpc/channelz/v2/channelz.upb.h"
|
55
|
+
#include "src/proto/grpc/channelz/v2/service.upb.h"
|
55
56
|
|
56
57
|
// Channel arg key for channelz node.
|
57
58
|
#define GRPC_ARG_CHANNELZ_CHANNEL_NODE \
|
@@ -91,6 +92,29 @@ class CallCountingHelperPeer;
|
|
91
92
|
class SubchannelNodePeer;
|
92
93
|
} // namespace testing
|
93
94
|
|
95
|
+
class ZTrace {
|
96
|
+
public:
|
97
|
+
virtual ~ZTrace() = default;
|
98
|
+
|
99
|
+
using Args = std::map<std::string, std::variant<int64_t, std::string, bool>>;
|
100
|
+
// Callback is called periodically with the latest results from the ztrace.
|
101
|
+
// The format is a StatusOr<optional<string>>.
|
102
|
+
// - If the status is not-OK, then the ztrace encountered an error and this
|
103
|
+
// will be the last callback.
|
104
|
+
// - If the status is OK but the optional<string> is empty, then the ztrace is
|
105
|
+
// completed (successfully).
|
106
|
+
// - If the status is OK and the optional<string> is non-empty, then the
|
107
|
+
// ztrace is still running and the string is the latest output - a
|
108
|
+
// serialized QueryTraceResponse proto.
|
109
|
+
using Callback =
|
110
|
+
absl::AnyInvocable<void(absl::StatusOr<std::optional<std::string>>)>;
|
111
|
+
|
112
|
+
virtual void Run(Args args,
|
113
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
114
|
+
event_engine,
|
115
|
+
Callback callback) = 0;
|
116
|
+
};
|
117
|
+
|
94
118
|
// base class for all channelz entities
|
95
119
|
class BaseNode : public DualRefCounted<BaseNode> {
|
96
120
|
public:
|
@@ -210,11 +234,11 @@ class BaseNode : public DualRefCounted<BaseNode> {
|
|
210
234
|
}
|
211
235
|
const std::string& name() const { return name_; }
|
212
236
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
237
|
+
std::unique_ptr<ZTrace> RunZTrace(
|
238
|
+
absl::string_view name, ZTrace::Args args,
|
239
|
+
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
240
|
+
event_engine,
|
241
|
+
ZTrace::Callback callback);
|
218
242
|
Json::Object AdditionalInfo();
|
219
243
|
|
220
244
|
const ChannelTrace& trace() const { return trace_; }
|
@@ -224,9 +248,10 @@ class BaseNode : public DualRefCounted<BaseNode> {
|
|
224
248
|
}
|
225
249
|
ChannelTrace& mutable_trace() { return trace_; }
|
226
250
|
|
227
|
-
void SerializeEntity(grpc_channelz_v2_Entity* entity, upb_Arena* arena
|
251
|
+
void SerializeEntity(grpc_channelz_v2_Entity* entity, upb_Arena* arena,
|
252
|
+
absl::Duration timeout);
|
228
253
|
|
229
|
-
std::string SerializeEntityToString();
|
254
|
+
std::string SerializeEntityToString(absl::Duration timeout);
|
230
255
|
|
231
256
|
protected:
|
232
257
|
void PopulateJsonFromDataSources(Json::Object& json);
|
@@ -276,15 +301,6 @@ LogOutputFrom(const RefCountedPtr<N>& n) {
|
|
276
301
|
}
|
277
302
|
} // namespace detail
|
278
303
|
|
279
|
-
class ZTrace {
|
280
|
-
public:
|
281
|
-
virtual ~ZTrace() = default;
|
282
|
-
virtual void Run(Timestamp deadline, std::map<std::string, std::string> args,
|
283
|
-
std::shared_ptr<grpc_event_engine::experimental::EventEngine>
|
284
|
-
event_engine,
|
285
|
-
absl::AnyInvocable<void(Json)>) = 0;
|
286
|
-
};
|
287
|
-
|
288
304
|
// This class is used to collect additional information about the channelz
|
289
305
|
// node. It's the backing implementation for DataSink. channelz users should
|
290
306
|
// use DataSink instead of this class directly.
|
@@ -125,6 +125,11 @@ class ChannelzRegistry final {
|
|
125
125
|
return Default()->InternalGetNodesOfType(start_node, type, max_results);
|
126
126
|
}
|
127
127
|
|
128
|
+
static std::tuple<std::vector<WeakRefCountedPtr<BaseNode>>, bool> GetNodes(
|
129
|
+
intptr_t start_node, size_t max_results) {
|
130
|
+
return Default()->InternalGetNodes(start_node, max_results);
|
131
|
+
}
|
132
|
+
|
128
133
|
// Test only helper function to dump the JSON representation to std out.
|
129
134
|
// This can aid in debugging channelz code.
|
130
135
|
static void LogAllEntities() { Default()->InternalLogAllEntities(); }
|
@@ -245,6 +250,12 @@ class ChannelzRegistry final {
|
|
245
250
|
max_results);
|
246
251
|
}
|
247
252
|
|
253
|
+
std::tuple<std::vector<WeakRefCountedPtr<BaseNode>>, bool> InternalGetNodes(
|
254
|
+
intptr_t start_node, size_t max_results) {
|
255
|
+
return QueryNodes(
|
256
|
+
start_node, [](const BaseNode*) { return true; }, max_results);
|
257
|
+
}
|
258
|
+
|
248
259
|
template <typename T, BaseNode::EntityType entity_type>
|
249
260
|
WeakRefCountedPtr<T> InternalGetTyped(intptr_t uuid) {
|
250
261
|
WeakRefCountedPtr<BaseNode> node = InternalGet(uuid);
|
@@ -49,6 +49,14 @@ Json ToJson(const PropertyValue& value) {
|
|
49
49
|
return Json::FromString(
|
50
50
|
gpr_format_timespec(v.as_timespec(GPR_CLOCK_REALTIME)));
|
51
51
|
},
|
52
|
+
[](absl::Time v) {
|
53
|
+
gpr_timespec ts;
|
54
|
+
ts.clock_type = GPR_CLOCK_REALTIME;
|
55
|
+
auto osts = absl::ToTimespec(v);
|
56
|
+
ts.tv_sec = osts.tv_sec;
|
57
|
+
ts.tv_nsec = osts.tv_nsec;
|
58
|
+
return Json::FromString(gpr_format_timespec(ts));
|
59
|
+
},
|
52
60
|
[](absl::Status v) { return Json::FromString(v.ToString()); },
|
53
61
|
[](std::shared_ptr<OtherPropertyValue> v) {
|
54
62
|
return Json::FromObject(v->TakeJsonObject());
|
@@ -96,6 +104,16 @@ void FillUpbValue(const PropertyValue& value,
|
|
96
104
|
grpc_channelz_v2_PropertyValue_set_timestamp_value(proto,
|
97
105
|
timestamp_proto);
|
98
106
|
},
|
107
|
+
[proto, arena](absl::Time v) {
|
108
|
+
auto* timestamp_proto =
|
109
|
+
grpc_channelz_v2_PropertyValue_mutable_timestamp_value(proto,
|
110
|
+
arena);
|
111
|
+
auto ts = absl::ToTimespec(v);
|
112
|
+
google_protobuf_Timestamp_set_seconds(timestamp_proto, ts.tv_sec);
|
113
|
+
google_protobuf_Timestamp_set_nanos(timestamp_proto, ts.tv_nsec);
|
114
|
+
grpc_channelz_v2_PropertyValue_set_timestamp_value(proto,
|
115
|
+
timestamp_proto);
|
116
|
+
},
|
99
117
|
[proto, arena](absl::Status v) {
|
100
118
|
std::string text = v.ToString();
|
101
119
|
grpc_channelz_v2_PropertyValue_set_string_value(
|
@@ -23,6 +23,7 @@
|
|
23
23
|
#include "absl/container/flat_hash_map.h"
|
24
24
|
#include "absl/status/status.h"
|
25
25
|
#include "absl/strings/string_view.h"
|
26
|
+
#include "absl/time/time.h"
|
26
27
|
#include "google/protobuf/any.upb.h"
|
27
28
|
#include "src/core/util/json/json.h"
|
28
29
|
#include "src/core/util/string.h"
|
@@ -44,7 +45,7 @@ class OtherPropertyValue {
|
|
44
45
|
|
45
46
|
using PropertyValue =
|
46
47
|
std::variant<absl::string_view, std::string, int64_t, uint64_t, double,
|
47
|
-
bool, Duration, Timestamp, absl::Status,
|
48
|
+
bool, Duration, Timestamp, absl::Status, absl::Time,
|
48
49
|
std::shared_ptr<OtherPropertyValue>>;
|
49
50
|
|
50
51
|
namespace property_list_detail {
|
@@ -64,6 +65,14 @@ struct Wrapper<
|
|
64
65
|
}
|
65
66
|
};
|
66
67
|
|
68
|
+
template <typename T>
|
69
|
+
struct Wrapper<absl::StatusOr<T>> {
|
70
|
+
static std::optional<PropertyValue> Wrap(absl::StatusOr<T> value) {
|
71
|
+
if (value.ok()) return Wrapper<T>::Wrap(*std::move(value));
|
72
|
+
return PropertyValue(std::move(value).status());
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
67
76
|
template <typename T>
|
68
77
|
struct Wrapper<T,
|
69
78
|
std::enable_if_t<std::is_integral_v<T> && std::is_signed_v<T>>> {
|
@@ -0,0 +1,66 @@
|
|
1
|
+
// Copyright 2025 gRPC authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#include "src/core/channelz/text_encode.h"
|
16
|
+
|
17
|
+
#include <string>
|
18
|
+
|
19
|
+
#include "src/core/util/no_destruct.h"
|
20
|
+
#include "src/proto/grpc/channelz/v2/channelz.upbdefs.h"
|
21
|
+
#include "src/proto/grpc/channelz/v2/property_list.upbdefs.h"
|
22
|
+
#include "src/proto/grpc/channelz/v2/service.upbdefs.h"
|
23
|
+
#include "upb/mem/arena.h"
|
24
|
+
#include "upb/reflection/def.hpp"
|
25
|
+
#include "upb/text/encode.h"
|
26
|
+
|
27
|
+
namespace grpc_core::channelz {
|
28
|
+
|
29
|
+
namespace {
|
30
|
+
|
31
|
+
upb_DefPool* DefPool() {
|
32
|
+
static NoDestruct<upb::DefPool> def_pool{[]() {
|
33
|
+
upb::DefPool pool;
|
34
|
+
grpc_channelz_v2_Entity_getmsgdef(pool.ptr());
|
35
|
+
grpc_channelz_v2_PropertyList_getmsgdef(pool.ptr());
|
36
|
+
grpc_channelz_v2_PropertyGrid_getmsgdef(pool.ptr());
|
37
|
+
grpc_channelz_v2_PropertyTable_getmsgdef(pool.ptr());
|
38
|
+
grpc_channelz_v2_QueryEntitiesRequest_getmsgdef(pool.ptr());
|
39
|
+
grpc_channelz_v2_QueryEntitiesResponse_getmsgdef(pool.ptr());
|
40
|
+
grpc_channelz_v2_GetEntityRequest_getmsgdef(pool.ptr());
|
41
|
+
grpc_channelz_v2_GetEntityResponse_getmsgdef(pool.ptr());
|
42
|
+
grpc_channelz_v2_QueryTraceRequest_getmsgdef(pool.ptr());
|
43
|
+
grpc_channelz_v2_QueryTraceResponse_getmsgdef(pool.ptr());
|
44
|
+
grpc_channelz_v2_TraceEvent_getmsgdef(pool.ptr());
|
45
|
+
return pool;
|
46
|
+
}()};
|
47
|
+
return def_pool->ptr();
|
48
|
+
}
|
49
|
+
|
50
|
+
} // namespace
|
51
|
+
|
52
|
+
std::string TextEncode(upb_Message* message,
|
53
|
+
const upb_MessageDef* (*getmsgdef)(upb_DefPool*)) {
|
54
|
+
char buf[10240];
|
55
|
+
auto* def_pool = DefPool();
|
56
|
+
auto* def = getmsgdef(def_pool);
|
57
|
+
size_t size = upb_TextEncode(message, def, def_pool, 0, buf, sizeof(buf));
|
58
|
+
if (size < sizeof(buf)) return std::string(buf, size);
|
59
|
+
char* new_buf = new char[size];
|
60
|
+
upb_TextEncode(message, def, def_pool, 0, new_buf, size);
|
61
|
+
std::string result(new_buf, size);
|
62
|
+
delete[] new_buf;
|
63
|
+
return result;
|
64
|
+
}
|
65
|
+
|
66
|
+
} // namespace grpc_core::channelz
|
@@ -0,0 +1,29 @@
|
|
1
|
+
// Copyright 2025 gRPC authors.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
#ifndef GRPC_SRC_CORE_CHANNELZ_TEXT_ENCODE_H
|
16
|
+
#define GRPC_SRC_CORE_CHANNELZ_TEXT_ENCODE_H
|
17
|
+
|
18
|
+
#include <string>
|
19
|
+
|
20
|
+
#include "upb/text/encode.h"
|
21
|
+
|
22
|
+
namespace grpc_core::channelz {
|
23
|
+
|
24
|
+
std::string TextEncode(upb_Message* message,
|
25
|
+
const upb_MessageDef* (*getmsgdef)(upb_DefPool*));
|
26
|
+
|
27
|
+
} // namespace grpc_core::channelz
|
28
|
+
|
29
|
+
#endif // GRPC_SRC_CORE_CHANNELZ_TEXT_ENCODE_H
|
@@ -155,6 +155,17 @@ grpc_channelz_v1_ChannelConnectivityState_State ConnectivityStateFromString(
|
|
155
155
|
void PopulateV1Trace(const grpc_channelz_v2_TraceEvent* const* trace_events,
|
156
156
|
size_t num_events, upb_Arena* arena,
|
157
157
|
grpc_channelz_v1_ChannelTrace* trace) {
|
158
|
+
if (num_events > 0) {
|
159
|
+
const auto* ts = grpc_channelz_v2_TraceEvent_timestamp(trace_events[0]);
|
160
|
+
if (ts != nullptr) {
|
161
|
+
auto* v1_ts = grpc_channelz_v1_ChannelTrace_mutable_creation_timestamp(
|
162
|
+
trace, arena);
|
163
|
+
google_protobuf_Timestamp_set_seconds(
|
164
|
+
v1_ts, google_protobuf_Timestamp_seconds(ts));
|
165
|
+
google_protobuf_Timestamp_set_nanos(v1_ts,
|
166
|
+
google_protobuf_Timestamp_nanos(ts));
|
167
|
+
}
|
168
|
+
}
|
158
169
|
for (size_t i = 0; i < num_events; ++i) {
|
159
170
|
auto* v1_event = grpc_channelz_v1_ChannelTrace_add_events(trace, arena);
|
160
171
|
upb_StringView description =
|
@@ -23,6 +23,7 @@
|
|
23
23
|
#include "absl/log/log.h"
|
24
24
|
#include "absl/status/statusor.h"
|
25
25
|
#include "absl/strings/str_cat.h"
|
26
|
+
#include "absl/time/time.h"
|
26
27
|
#include "src/core/channelz/channelz_registry.h"
|
27
28
|
#include "src/core/channelz/v2tov1/convert.h"
|
28
29
|
#include "src/core/lib/experiments/experiments.h"
|
@@ -46,7 +47,7 @@ class RegistryEntityFetcher : public EntityFetcher {
|
|
46
47
|
if (node == nullptr) {
|
47
48
|
return absl::NotFoundError(absl::StrCat("Entity not found: ", id));
|
48
49
|
}
|
49
|
-
return node->SerializeEntityToString();
|
50
|
+
return node->SerializeEntityToString(absl::ZeroDuration());
|
50
51
|
}
|
51
52
|
|
52
53
|
absl::StatusOr<std::vector<std::string>> GetEntitiesWithParent(
|
@@ -62,7 +63,8 @@ class RegistryEntityFetcher : public EntityFetcher {
|
|
62
63
|
std::vector<std::string> children_str;
|
63
64
|
for (const auto& child_node : nodes) {
|
64
65
|
if (child_node == nullptr) continue;
|
65
|
-
children_str.push_back(
|
66
|
+
children_str.push_back(
|
67
|
+
child_node->SerializeEntityToString(absl::ZeroDuration()));
|
66
68
|
}
|
67
69
|
return children_str;
|
68
70
|
}
|
@@ -138,7 +140,8 @@ char* grpc_channelz_get_top_channels(intptr_t start_channel_id) {
|
|
138
140
|
grpc_core::Json::Array array;
|
139
141
|
for (const auto& channel_node : channels) {
|
140
142
|
if (channel_node == nullptr) continue;
|
141
|
-
auto serialized_v2 =
|
143
|
+
auto serialized_v2 =
|
144
|
+
channel_node->SerializeEntityToString(absl::ZeroDuration());
|
142
145
|
auto serialized_v1 = grpc_core::channelz::v2tov1::ConvertChannel(
|
143
146
|
serialized_v2, fetcher, true);
|
144
147
|
if (!serialized_v1.ok()) {
|
@@ -176,7 +179,8 @@ char* grpc_channelz_get_servers(intptr_t start_server_id) {
|
|
176
179
|
grpc_core::Json::Array array;
|
177
180
|
for (const auto& server_node : servers) {
|
178
181
|
if (server_node == nullptr) continue;
|
179
|
-
auto serialized_v2 =
|
182
|
+
auto serialized_v2 =
|
183
|
+
server_node->SerializeEntityToString(absl::ZeroDuration());
|
180
184
|
auto serialized_v1 = grpc_core::channelz::v2tov1::ConvertServer(
|
181
185
|
serialized_v2, fetcher, true);
|
182
186
|
if (!serialized_v1.ok()) {
|
@@ -211,7 +215,8 @@ char* grpc_channelz_get_server(intptr_t server_id) {
|
|
211
215
|
auto server_node = ChannelzRegistry::GetServer(server_id);
|
212
216
|
if (server_node == nullptr) return nullptr;
|
213
217
|
RegistryEntityFetcher fetcher;
|
214
|
-
auto serialized_v2 =
|
218
|
+
auto serialized_v2 =
|
219
|
+
server_node->SerializeEntityToString(absl::ZeroDuration());
|
215
220
|
auto serialized_v1 = grpc_core::channelz::v2tov1::ConvertServer(
|
216
221
|
serialized_v2, fetcher, true);
|
217
222
|
if (!serialized_v1.ok()) {
|
@@ -296,7 +301,8 @@ char* grpc_channelz_get_channel(intptr_t channel_id) {
|
|
296
301
|
auto channel_node = ChannelzRegistry::GetChannel(channel_id);
|
297
302
|
if (channel_node == nullptr) return nullptr;
|
298
303
|
RegistryEntityFetcher fetcher;
|
299
|
-
auto serialized_v2 =
|
304
|
+
auto serialized_v2 =
|
305
|
+
channel_node->SerializeEntityToString(absl::ZeroDuration());
|
300
306
|
auto serialized_v1 = grpc_core::channelz::v2tov1::ConvertChannel(
|
301
307
|
serialized_v2, fetcher, true);
|
302
308
|
if (!serialized_v1.ok()) {
|
@@ -337,7 +343,8 @@ char* grpc_channelz_get_subchannel(intptr_t subchannel_id) {
|
|
337
343
|
auto subchannel_node = ChannelzRegistry::GetSubchannel(subchannel_id);
|
338
344
|
if (subchannel_node == nullptr) return nullptr;
|
339
345
|
RegistryEntityFetcher fetcher;
|
340
|
-
auto serialized_v2 =
|
346
|
+
auto serialized_v2 =
|
347
|
+
subchannel_node->SerializeEntityToString(absl::ZeroDuration());
|
341
348
|
auto serialized_v1 = grpc_core::channelz::v2tov1::ConvertSubchannel(
|
342
349
|
serialized_v2, fetcher, true);
|
343
350
|
if (!serialized_v1.ok()) {
|
@@ -378,7 +385,7 @@ char* grpc_channelz_get_socket(intptr_t socket_id) {
|
|
378
385
|
auto node = ChannelzRegistry::GetNode(socket_id);
|
379
386
|
if (node == nullptr) return nullptr;
|
380
387
|
RegistryEntityFetcher fetcher;
|
381
|
-
auto serialized_v2 = node->SerializeEntityToString();
|
388
|
+
auto serialized_v2 = node->SerializeEntityToString(absl::ZeroDuration());
|
382
389
|
absl::StatusOr<std::string> serialized_v1;
|
383
390
|
if (node->type() == grpc_core::channelz::BaseNode::EntityType::kSocket) {
|
384
391
|
serialized_v1 = grpc_core::channelz::v2tov1::ConvertSocket(serialized_v2,
|