diff --git a/.bazelversion b/.bazelversion index a3fcc7121bb..643916c03f1 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.1.0 +7.3.1 diff --git a/BUILD b/BUILD index 7cd081fb527..f1efe67fdd1 100644 --- a/BUILD +++ b/BUILD @@ -2649,6 +2649,7 @@ grpc_cc_library( tags = ["nofixdeps"], visibility = ["@grpc:public"], deps = [ + "config_vars", "grpc++", "grpc++_config_proto", "//src/proto/grpc/reflection/v1:reflection_proto", @@ -3943,7 +3944,6 @@ grpc_cc_library( deps = [ "config", "debug_location", - "event_engine_base_hdrs", "exec_ctx", "gpr", "grpc_base", @@ -3955,16 +3955,17 @@ grpc_cc_library( "orphanable", "ref_counted_ptr", "resource_quota_api", + "sockaddr_utils", "uri_parser", "//src/core:channel_args", "//src/core:channel_args_preconditioning", "//src/core:closure", "//src/core:error", "//src/core:error_utils", - "//src/core:event_engine_tcp_socket_utils", "//src/core:handshaker_registry", "//src/core:iomgr_fwd", "//src/core:pollset_set", + "//src/core:resolved_address", "//src/core:resource_quota", "//src/core:slice", "//src/core:slice_refcount", diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 58203584d79..50bd830ef21 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -170,7 +170,7 @@ def grpc_cc_library( srcs: The source files. public_hdrs: The public headers. hdrs: The headers. - external_deps: External depdendencies to be resolved. + external_deps: External dependencies to be resolved. defines: Build defines to use. deps: cc_library deps. select_deps: deps included conditionally. @@ -529,7 +529,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. exec_properties: A dictionary of strings that will be added to the exec_properties of a platform selected for this target. shard_count: The number of shards for this test. @@ -660,7 +660,7 @@ def grpc_sh_test(name, srcs = [], args = [], data = [], uses_polling = True, siz timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. exec_properties: A dictionary of strings that will be added to the exec_properties of a platform selected for this target. shard_count: The number of shards for this test. diff --git a/bazel/protobuf.bzl b/bazel/protobuf.bzl index 9568e627a77..971af9e19a8 100644 --- a/bazel/protobuf.bzl +++ b/bazel/protobuf.bzl @@ -37,13 +37,13 @@ def well_known_proto_libs(): return ["@com_google_protobuf//:" + b for b in _WELL_KNOWN_PROTOS_BASE] def is_well_known(label): - # Bazel surfaces labels as their undelying identity, even if they are referenced + # Bazel surfaces labels as their underlying identity, even if they are referenced # via aliases. Bazel also does not currently provide a way to find the real label # underlying an alias. So the implementation detail that the WKTs present at the # top level of the protobuf repo are actually backed by targets in the # //src/google/protobuf package leaks through here. # We include both the alias path and the underlying path to be resilient to - # reversions of this change as well as for continuing compatiblity with repos + # reversions of this change as well as for continuing compatibility with repos # that happen to pull in older versions of protobuf. all_wkt_targets = (["@com_google_protobuf//:" + b for b in _WELL_KNOWN_PROTOS_BASE] + ["@com_google_protobuf//src/google/protobuf:" + b for b in _WELL_KNOWN_PROTOS_BASE]) diff --git a/bazel/supported_versions.txt b/bazel/supported_versions.txt index c8f25c10a24..79903bd050d 100644 --- a/bazel/supported_versions.txt +++ b/bazel/supported_versions.txt @@ -1,2 +1,2 @@ -7.1.0 +7.3.1 6.5.0 diff --git a/bazel/update_mirror.sh b/bazel/update_mirror.sh index 98d752a3cff..55ce055c1de 100755 --- a/bazel/update_mirror.sh +++ b/bazel/update_mirror.sh @@ -60,9 +60,9 @@ function upload { upload github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64 upload github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-darwin-x86_64 upload github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-windows-x86_64.exe -upload github.com/bazelbuild/bazel/releases/download/7.1.0/bazel-7.1.0-linux-x86_64 -upload github.com/bazelbuild/bazel/releases/download/7.1.0/bazel-7.1.0-darwin-x86_64 -upload github.com/bazelbuild/bazel/releases/download/7.1.0/bazel-7.1.0-windows-x86_64.exe +upload github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-linux-x86_64 +upload github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-darwin-x86_64 +upload github.com/bazelbuild/bazel/releases/download/7.3.1/bazel-7.3.1-windows-x86_64.exe # Collect the github archives to mirror from grpc_deps.bzl grep -o '"https://github.com/[^"]*"' bazel/grpc_deps.bzl | sed 's/^"https:\/\///' | sed 's/"$//' | while read -r line ; do diff --git a/doc/bazel_support.md b/doc/bazel_support.md index da84c49abc5..d1feef88eba 100644 --- a/doc/bazel_support.md +++ b/doc/bazel_support.md @@ -43,7 +43,7 @@ However individual releases may have a broader compatibility range. The currently supported versions are captured by the following list: -- [`7.1.0`](https://github.com/bazelbuild/bazel/releases/tag/7.1.0) +- [`7.3.1`](https://github.com/bazelbuild/bazel/releases/tag/7.3.1) - [`6.5.0`](https://github.com/bazelbuild/bazel/releases/tag/6.5.0) NOTE: gRPC doesn't support bzlmod yet. \ No newline at end of file diff --git a/doc/environment_variables.md b/doc/environment_variables.md index ef27e91f803..1edc76f45a4 100644 --- a/doc/environment_variables.md +++ b/doc/environment_variables.md @@ -60,7 +60,7 @@ some configuration as environment variables that can be set. - NONE - won't log any. GRPC_VERBOSITY will set verbosity of absl logging. - If the external application sets some other verbosity, then whatever is set later will be honoured. - - If nothing is set as GRPC_VERBOSITY, then the setting of the exernal application will be honoured. + - If nothing is set as GRPC_VERBOSITY, then the setting of the external application will be honoured. - If nothing is set by the external application also, the default set by absl will be honoured. diff --git a/doc/grpc_xds_bootstrap_format.md b/doc/grpc_xds_bootstrap_format.md index 7b46761f296..9607f321be0 100644 --- a/doc/grpc_xds_bootstrap_format.md +++ b/doc/grpc_xds_bootstrap_format.md @@ -8,7 +8,7 @@ gRPC expects the xDS bootstrap configuration to be specified as a JSON string. The xDS bootstrap file location may be specified using the environment variable `GRPC_XDS_BOOTSTRAP`. Alternatively, the bootstrap file contents may be specified using the environment variable `GRPC_XDS_BOOTSTRAP_CONFIG`. If both -are specified, the former takes precendence. +are specified, the former takes precedence. The xDS client inside of gRPC parses the bootstrap configuration specified by one of the above means when it is created to configure itself. diff --git a/doc/service_config.md b/doc/service_config.md index 6312cda7f62..99d3bad8f04 100644 --- a/doc/service_config.md +++ b/doc/service_config.md @@ -48,7 +48,7 @@ name, will return both the resolved addresses and the service config. The name resolver returns the service config to the gRPC client in JSON form. Individual resolver implementations determine where and in what format the -service config is stored. If the resolver implemention obtains the +service config is stored. If the resolver implementation obtains the service config in protobuf form, it must convert it to JSON. Alternatively, a resolver implementation may obtain the service config already in JSON form, in which case it may return it directly. Or it diff --git a/doc/xds-test-descriptions.md b/doc/xds-test-descriptions.md index f5e26192026..a6b5928d4cd 100644 --- a/doc/xds-test-descriptions.md +++ b/doc/xds-test-descriptions.md @@ -640,17 +640,17 @@ There are four sub-tests: 1. `app_timeout_exceeded` 1. Test client configured to send UnaryCall RPCs with a 1s application timeout, and metadata of `rpc-behavior: sleep-2`. - 1. Test driver asserts client recieves ~100% status `DEADLINE_EXCEEDED`. + 1. Test driver asserts client receives ~100% status `DEADLINE_EXCEEDED`. 1. `timeout_not_exceeded` 1. Test client configured to send UnaryCall RPCs with the default application timeout (20 seconds), and no metadata. - 1. Test driver asserts client recieves ~100% status `OK`. + 1. Test driver asserts client receives ~100% status `OK`. 1. `timeout_exceeded` (executed with the below test case) 1. `timeout_different_route` 1. Test client configured to send UnaryCall RPCs and EmptyCall RPCs with the default application timeout (20 seconds), and metadata of `rpc-behavior: sleep-4`. - 1. Test driver asserts client recieves ~100% status `OK` for EmptyCall + 1. Test driver asserts client receives ~100% status `OK` for EmptyCall and ~100% status `DEADLINE_EXCEEDED` for UnaryCall. ### api_listener diff --git a/examples/android/binder/java/io/grpc/binder/cpp/README.md b/examples/android/binder/java/io/grpc/binder/cpp/README.md index dbe8472b725..8a9ba6ec26f 100644 --- a/examples/android/binder/java/io/grpc/binder/cpp/README.md +++ b/examples/android/binder/java/io/grpc/binder/cpp/README.md @@ -3,7 +3,7 @@ ## Build Instruction 1. Install Android SDK and NDK. Only NDK version >= 25 is supported. We tested against SDK Platform `33` and NDK `26.2.11394342`. -2. Make sure Bazel is at least `7.0`. Use `export OVERRIDE_BAZEL_VERSION=7.1.0` to selected a supported version listed in `bazel/supported_versions.txt` if necessary. +2. Make sure Bazel is at least `7.0`. Use `export OVERRIDE_BAZEL_VERSION=7.3.1` to selected a supported version listed in `bazel/supported_versions.txt` if necessary. 3. Point environment variables to install locations of SDK and NDK ``` export ANDROID_HOME=$HOME/android-sdk diff --git a/examples/cpp/helloworld/greeter_async_client.cc b/examples/cpp/helloworld/greeter_async_client.cc index 5d2fd7eb303..25417269085 100644 --- a/examples/cpp/helloworld/greeter_async_client.cc +++ b/examples/cpp/helloworld/greeter_async_client.cc @@ -24,7 +24,6 @@ #include "absl/flags/parse.h" #include "absl/log/check.h" -#include #include #ifdef BAZEL_BUILD diff --git a/examples/cpp/helloworld/greeter_async_client2.cc b/examples/cpp/helloworld/greeter_async_client2.cc index 65f18cb1014..83662761837 100644 --- a/examples/cpp/helloworld/greeter_async_client2.cc +++ b/examples/cpp/helloworld/greeter_async_client2.cc @@ -25,7 +25,6 @@ #include "absl/flags/parse.h" #include "absl/log/check.h" -#include #include #ifdef BAZEL_BUILD diff --git a/examples/cpp/helloworld/greeter_async_server.cc b/examples/cpp/helloworld/greeter_async_server.cc index 9ba22844e6d..9adefedf7d9 100644 --- a/examples/cpp/helloworld/greeter_async_server.cc +++ b/examples/cpp/helloworld/greeter_async_server.cc @@ -26,7 +26,6 @@ #include "absl/log/check.h" #include "absl/strings/str_format.h" -#include #include #ifdef BAZEL_BUILD diff --git a/examples/cpp/xds/README.md b/examples/cpp/xds/README.md index 3f878a0f56d..7949c772db7 100644 --- a/examples/cpp/xds/README.md +++ b/examples/cpp/xds/README.md @@ -10,7 +10,7 @@ The client takes two command-line arguments - The server takes three command-line arguments - * port - Port on which the Hello World service is run. Defaults to 50051. -* mantenance_port - If secure mode is used (see below), the [Admin](https://github.com/grpc/proposal/blob/master/A38-admin-interface-api.md) service is exposed on this port. If secure mode is not used, `maintenance_port` is unused, and the Admin service is just exposed on `port`. Defaults to 50052. +* maintenance_port - If secure mode is used (see below), the [Admin](https://github.com/grpc/proposal/blob/master/A38-admin-interface-api.md) service is exposed on this port. If secure mode is not used, `maintenance_port` is unused, and the Admin service is just exposed on `port`. Defaults to 50052. * secure - Bool value, defaults to true. When this is set, [XdsServerCredentials](https://github.com/grpc/proposal/blob/master/A29-xds-tls-security.md) will be used with a fallback on `InsecureServerCredentials`. If unset, `InsecureServerCredentials` will be used. ## Running the example diff --git a/include/grpc/credentials.h b/include/grpc/credentials.h index c3a076991c6..b5814b913c4 100644 --- a/include/grpc/credentials.h +++ b/include/grpc/credentials.h @@ -103,7 +103,7 @@ GRPCAPI grpc_call_credentials* grpc_sts_credentials_create( /** Context that can be used by metadata credentials plugin in order to create auth related metadata. */ typedef struct { - /** The fully qualifed service url. */ + /** The fully qualified service url. */ const char* service_url; /** The method name of the RPC being called (not fully qualified). diff --git a/include/grpc/event_engine/README.md b/include/grpc/event_engine/README.md index b2d4fef83b3..ca7e346dab5 100644 --- a/include/grpc/event_engine/README.md +++ b/include/grpc/event_engine/README.md @@ -23,7 +23,7 @@ thresholds. To enable this feature, the memory allocation of read/write buffers within an EventEngine must be acquired in the form of Slices from SliceAllocators. This is covered more fully in the gRFC and code. -### Documentating expectations around callback execution +### Documenting expectations around callback execution Some callbacks may be expensive to run. EventEngines should decide on and document whether callback execution might block polling operations. This way, application developers can plan accordingly (e.g., run their expensive callbacks diff --git a/include/grpc/event_engine/internal/slice_cast.h b/include/grpc/event_engine/internal/slice_cast.h index 3f9593464cf..b6f3ae6277a 100644 --- a/include/grpc/event_engine/internal/slice_cast.h +++ b/include/grpc/event_engine/internal/slice_cast.h @@ -24,7 +24,7 @@ namespace internal { // with `SliceCast`. Both ways need to be declared (i.e. if // SliceCastable exists, you should declare // SliceCastable too). -// The type has no members, it's just the existance of the specialization that +// The type has no members, it's just the existence of the specialization that // unlocks SliceCast usage for a type pair. template struct SliceCastable; diff --git a/include/grpc/event_engine/slice.h b/include/grpc/event_engine/slice.h index 8153f983a40..f4009648dc1 100644 --- a/include/grpc/event_engine/slice.h +++ b/include/grpc/event_engine/slice.h @@ -25,7 +25,6 @@ #include #include -#include #include // This public slice definition largely based of the internal grpc_core::Slice diff --git a/include/grpc/event_engine/slice_buffer.h b/include/grpc/event_engine/slice_buffer.h index 0009089a6bc..724c3d07292 100644 --- a/include/grpc/event_engine/slice_buffer.h +++ b/include/grpc/event_engine/slice_buffer.h @@ -28,7 +28,6 @@ #include #include #include -#include #include namespace grpc_event_engine { diff --git a/include/grpc/grpc_crl_provider.h b/include/grpc/grpc_crl_provider.h index 35d6df6f939..968d10b0600 100644 --- a/include/grpc/grpc_crl_provider.h +++ b/include/grpc/grpc_crl_provider.h @@ -82,7 +82,7 @@ absl::StatusOr> CreateDirectoryReloaderCrlProvider( } // namespace experimental } // namespace grpc_core -// TODO(gtcooke94) - Mark with api macro when all wrapped langauges support C++ +// TODO(gtcooke94) - Mark with api macro when all wrapped languages support C++ // in core APIs /** * EXPERIMENTAL API - Subject to change diff --git a/include/grpc/impl/channel_arg_names.h b/include/grpc/impl/channel_arg_names.h index c47d928d5c1..aa973c21977 100644 --- a/include/grpc/impl/channel_arg_names.h +++ b/include/grpc/impl/channel_arg_names.h @@ -259,7 +259,7 @@ issued by the tcp_write(). By default, this is set to 4. */ #define GRPC_ARG_TCP_TX_ZEROCOPY_MAX_SIMULT_SENDS \ "grpc.experimental.tcp_tx_zerocopy_max_simultaneous_sends" -/* Overrides the TCP socket recieve buffer size, SO_RCVBUF. */ +/* Overrides the TCP socket receive buffer size, SO_RCVBUF. */ #define GRPC_ARG_TCP_RECEIVE_BUFFER_SIZE "grpc.tcp_receive_buffer_size" /* Timeout in milliseconds to use for calls to the grpclb load balancer. If 0 or unset, the balancer calls will have no deadline. */ diff --git a/include/grpcpp/client_context.h b/include/grpcpp/client_context.h index d0934dd0f54..af3b533ed1b 100644 --- a/include/grpcpp/client_context.h +++ b/include/grpcpp/client_context.h @@ -42,7 +42,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/completion_queue.h b/include/grpcpp/completion_queue.h index 63d202b0e2f..2bb391fccfc 100644 --- a/include/grpcpp/completion_queue.h +++ b/include/grpcpp/completion_queue.h @@ -38,7 +38,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/ext/call_metric_recorder.h b/include/grpcpp/ext/call_metric_recorder.h index 378a4594aff..303a35db14d 100644 --- a/include/grpcpp/ext/call_metric_recorder.h +++ b/include/grpcpp/ext/call_metric_recorder.h @@ -33,7 +33,7 @@ namespace experimental { /// Records call metrics for the purpose of load balancing. /// During an RPC, call \a ServerContext::ExperimentalGetCallMetricRecorder() -/// method to retrive the recorder for the current call. +/// method to retrieve the recorder for the current call. class CallMetricRecorder { public: virtual ~CallMetricRecorder() = default; diff --git a/include/grpcpp/impl/interceptor_common.h b/include/grpcpp/impl/interceptor_common.h index 7e3a566f6b3..2d4c56701d2 100644 --- a/include/grpcpp/impl/interceptor_common.h +++ b/include/grpcpp/impl/interceptor_common.h @@ -25,7 +25,6 @@ #include "absl/log/absl_check.h" #include -#include #include #include #include diff --git a/include/grpcpp/impl/metadata_map.h b/include/grpcpp/impl/metadata_map.h index 6ac9ed29844..6241df0c259 100644 --- a/include/grpcpp/impl/metadata_map.h +++ b/include/grpcpp/impl/metadata_map.h @@ -22,7 +22,6 @@ #include #include -#include #include namespace grpc { diff --git a/include/grpcpp/impl/proto_utils.h b/include/grpcpp/impl/proto_utils.h index f2cd8d21b76..d738ff3ab67 100644 --- a/include/grpcpp/impl/proto_utils.h +++ b/include/grpcpp/impl/proto_utils.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/include/grpcpp/impl/server_callback_handlers.h b/include/grpcpp/impl/server_callback_handlers.h index c097ab2ace2..7a4b6cf9aef 100644 --- a/include/grpcpp/impl/server_callback_handlers.h +++ b/include/grpcpp/impl/server_callback_handlers.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/impl/service_type.h b/include/grpcpp/impl/service_type.h index 3e40e08b297..b6af6e1fc98 100644 --- a/include/grpcpp/impl/service_type.h +++ b/include/grpcpp/impl/service_type.h @@ -21,7 +21,6 @@ #include "absl/log/absl_check.h" -#include #include #include #include diff --git a/include/grpcpp/impl/sync.h b/include/grpcpp/impl/sync.h index 132e376d7a9..a7ec965a009 100644 --- a/include/grpcpp/impl/sync.h +++ b/include/grpcpp/impl/sync.h @@ -30,7 +30,6 @@ #include "absl/log/absl_check.h" #include "absl/synchronization/mutex.h" -#include #include #include diff --git a/include/grpcpp/security/credentials.h b/include/grpcpp/security/credentials.h index 402dd9edb23..d1f8c22846a 100644 --- a/include/grpcpp/security/credentials.h +++ b/include/grpcpp/security/credentials.h @@ -247,7 +247,7 @@ class MetadataCredentialsPlugin { /// Type of credentials this plugin is implementing. virtual const char* GetType() const { return ""; } - /// Gets the auth metatada produced by this plugin. + /// Gets the auth metadata produced by this plugin. /// The fully qualified method name is: /// service_url + "/" + method_name. /// The channel_auth_context contains (among other things), the identity of @@ -295,7 +295,7 @@ grpc::Status StsCredentialsOptionsFromJson(const std::string& json_string, /// Creates STS credentials options from the $STS_CREDENTIALS environment /// variable. This environment variable points to the path of a JSON file -/// comforming to the schema described above. +/// conforming to the schema described above. grpc::Status StsCredentialsOptionsFromEnv(StsCredentialsOptions* options); std::shared_ptr StsCredentials( diff --git a/include/grpcpp/security/tls_certificate_provider.h b/include/grpcpp/security/tls_certificate_provider.h index 3e7c9523156..6b918fec0a1 100644 --- a/include/grpcpp/security/tls_certificate_provider.h +++ b/include/grpcpp/security/tls_certificate_provider.h @@ -24,7 +24,6 @@ #include #include #include -#include #include namespace grpc { diff --git a/include/grpcpp/security/tls_certificate_verifier.h b/include/grpcpp/security/tls_certificate_verifier.h index 61c0acb0fb3..5b87b1a42c6 100644 --- a/include/grpcpp/security/tls_certificate_verifier.h +++ b/include/grpcpp/security/tls_certificate_verifier.h @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/security/tls_credentials_options.h b/include/grpcpp/security/tls_credentials_options.h index 11c40f04086..c47f348ccaa 100644 --- a/include/grpcpp/security/tls_credentials_options.h +++ b/include/grpcpp/security/tls_credentials_options.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/include/grpcpp/server_builder.h b/include/grpcpp/server_builder.h index e66ca4301cd..787cb20af7d 100644 --- a/include/grpcpp/server_builder.h +++ b/include/grpcpp/server_builder.h @@ -297,7 +297,7 @@ class ServerBuilder { // Creates a passive listener for Server Endpoint injection. /// - /// \a PasiveListener lets applications provide pre-established connections + /// \a PassiveListener lets applications provide pre-established connections /// to gRPC Servers. The server will behave as if it accepted the connection /// itself on its own listening addresses. /// diff --git a/include/grpcpp/server_interface.h b/include/grpcpp/server_interface.h index 266b85313c8..9791ee3589c 100644 --- a/include/grpcpp/server_interface.h +++ b/include/grpcpp/server_interface.h @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/support/async_stream.h b/include/grpcpp/support/async_stream.h index ca849fd348a..c4cbb9dbb43 100644 --- a/include/grpcpp/support/async_stream.h +++ b/include/grpcpp/support/async_stream.h @@ -22,7 +22,6 @@ #include "absl/log/absl_check.h" #include -#include #include #include #include diff --git a/include/grpcpp/support/async_unary_call.h b/include/grpcpp/support/async_unary_call.h index 715093fa772..a03a9b28382 100644 --- a/include/grpcpp/support/async_unary_call.h +++ b/include/grpcpp/support/async_unary_call.h @@ -22,7 +22,6 @@ #include "absl/log/absl_check.h" #include -#include #include #include #include diff --git a/include/grpcpp/support/byte_buffer.h b/include/grpcpp/support/byte_buffer.h index 5bbfb664961..676d3cfad7e 100644 --- a/include/grpcpp/support/byte_buffer.h +++ b/include/grpcpp/support/byte_buffer.h @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -59,7 +58,7 @@ class GrpcByteBufferPeer; /// A sequence of bytes. class ByteBuffer final { public: - /// Constuct an empty buffer. + /// Construct an empty buffer. ByteBuffer() : buffer_(nullptr) {} /// Construct buffer from \a slices, of which there are \a nslices. diff --git a/include/grpcpp/support/callback_common.h b/include/grpcpp/support/callback_common.h index a333407bb4e..49eaa56172a 100644 --- a/include/grpcpp/support/callback_common.h +++ b/include/grpcpp/support/callback_common.h @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/support/client_callback.h b/include/grpcpp/support/client_callback.h index f306b26b96b..692dff6b8d1 100644 --- a/include/grpcpp/support/client_callback.h +++ b/include/grpcpp/support/client_callback.h @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/include/grpcpp/support/client_interceptor.h b/include/grpcpp/support/client_interceptor.h index 67aee26ec3b..fbf554437bf 100644 --- a/include/grpcpp/support/client_interceptor.h +++ b/include/grpcpp/support/client_interceptor.h @@ -24,7 +24,6 @@ #include "absl/log/absl_check.h" -#include #include #include #include diff --git a/include/grpcpp/support/config.h b/include/grpcpp/support/config.h index c846c43c6e6..a491328785d 100644 --- a/include/grpcpp/support/config.h +++ b/include/grpcpp/support/config.h @@ -35,7 +35,7 @@ namespace grpc { // Using grpc::string and grpc::to_string is discouraged in favor of // std::string and std::to_string. This is only for legacy code using -// them explictly. +// them explicitly. using std::string; // deprecated // NOLINT(misc-unused-using-decls) using std::to_string; // deprecated // NOLINT(misc-unused-using-decls) diff --git a/include/grpcpp/support/interceptor.h b/include/grpcpp/support/interceptor.h index 9248fbb28c7..1e4d66610f6 100644 --- a/include/grpcpp/support/interceptor.h +++ b/include/grpcpp/support/interceptor.h @@ -133,7 +133,7 @@ class InterceptorBatchMethods { /// means that the payload would be available in the serialized form only /// unless an interceptor replaces the payload with ModifySendMessage. - /// Returns a modifable ByteBuffer holding the serialized form of the message + /// Returns a modifiable ByteBuffer holding the serialized form of the message /// that is going to be sent. Valid for PRE_SEND_MESSAGE interceptions. /// A return value of nullptr indicates that this ByteBuffer is not valid. virtual ByteBuffer* GetSerializedSendMessage() = 0; diff --git a/include/grpcpp/support/method_handler.h b/include/grpcpp/support/method_handler.h index 6a2d2b22d2d..081401b187b 100644 --- a/include/grpcpp/support/method_handler.h +++ b/include/grpcpp/support/method_handler.h @@ -22,7 +22,6 @@ #include "absl/log/absl_check.h" #include -#include #include #include #include diff --git a/include/grpcpp/support/proto_buffer_reader.h b/include/grpcpp/support/proto_buffer_reader.h index e5ede7a09a2..7bdf8d13d72 100644 --- a/include/grpcpp/support/proto_buffer_reader.h +++ b/include/grpcpp/support/proto_buffer_reader.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/include/grpcpp/support/proto_buffer_writer.h b/include/grpcpp/support/proto_buffer_writer.h index e695f14ae11..1417a619911 100644 --- a/include/grpcpp/support/proto_buffer_writer.h +++ b/include/grpcpp/support/proto_buffer_writer.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/include/grpcpp/support/server_interceptor.h b/include/grpcpp/support/server_interceptor.h index 1147235b6b1..de875a347f1 100644 --- a/include/grpcpp/support/server_interceptor.h +++ b/include/grpcpp/support/server_interceptor.h @@ -24,7 +24,6 @@ #include "absl/log/absl_check.h" -#include #include #include #include diff --git a/include/grpcpp/support/sync_stream.h b/include/grpcpp/support/sync_stream.h index 9b16b070130..7479adb25c1 100644 --- a/include/grpcpp/support/sync_stream.h +++ b/include/grpcpp/support/sync_stream.h @@ -21,7 +21,6 @@ #include "absl/log/absl_check.h" -#include #include #include #include diff --git a/src/core/BUILD b/src/core/BUILD index ce616aff0d9..641ba363ab8 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -142,6 +142,8 @@ grpc_cc_library( "util/latent_see.h", ], external_deps = [ + "absl/base:core_headers", + "absl/functional:any_invocable", "absl/log", "absl/strings", "absl/types:optional", @@ -952,6 +954,7 @@ grpc_cc_library( grpc_cc_library( name = "seq", + external_deps = ["absl/log:log"], language = "c++", public_hdrs = [ "lib/promise/seq.h", @@ -5454,6 +5457,7 @@ grpc_cc_library( "xds/grpc/xds_cluster.h", ], external_deps = [ + "absl/container:flat_hash_map", "absl/strings", "absl/types:optional", "absl/types:variant", diff --git a/src/core/channelz/channelz.cc b/src/core/channelz/channelz.cc index 1baf851ed6a..9487b9161ef 100644 --- a/src/core/channelz/channelz.cc +++ b/src/core/channelz/channelz.cc @@ -29,7 +29,6 @@ #include "absl/strings/strip.h" #include -#include #include #include diff --git a/src/core/channelz/channelz_registry.cc b/src/core/channelz/channelz_registry.cc index 8089cc273bf..63f6e557c7f 100644 --- a/src/core/channelz/channelz_registry.cc +++ b/src/core/channelz/channelz_registry.cc @@ -29,7 +29,6 @@ #include #include -#include #include #include diff --git a/src/core/client_channel/client_channel_internal.h b/src/core/client_channel/client_channel_internal.h index f1982b65370..b9acdd883ec 100644 --- a/src/core/client_channel/client_channel_internal.h +++ b/src/core/client_channel/client_channel_internal.h @@ -24,8 +24,6 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" -#include - #include "src/core/lib/gprpp/down_cast.h" #include "src/core/lib/gprpp/unique_type_name.h" #include "src/core/lib/resource_quota/arena.h" diff --git a/src/core/client_channel/config_selector.h b/src/core/client_channel/config_selector.h index d049ae95836..1fb1ddab78a 100644 --- a/src/core/client_channel/config_selector.h +++ b/src/core/client_channel/config_selector.h @@ -29,7 +29,6 @@ #include "absl/strings/string_view.h" #include -#include #include "src/core/client_channel/client_channel_internal.h" #include "src/core/lib/channel/channel_fwd.h" diff --git a/src/core/client_channel/dynamic_filters.cc b/src/core/client_channel/dynamic_filters.cc index 1e33da2105c..f6658343e0a 100644 --- a/src/core/client_channel/dynamic_filters.cc +++ b/src/core/client_channel/dynamic_filters.cc @@ -27,8 +27,6 @@ #include "absl/log/log.h" #include "absl/status/statusor.h" -#include - #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/channel_stack_builder_impl.h" diff --git a/src/core/client_channel/local_subchannel_pool.cc b/src/core/client_channel/local_subchannel_pool.cc index f3aa73d7bd7..878d3547b96 100644 --- a/src/core/client_channel/local_subchannel_pool.cc +++ b/src/core/client_channel/local_subchannel_pool.cc @@ -24,8 +24,6 @@ #include "absl/log/check.h" -#include - #include "src/core/client_channel/subchannel.h" namespace grpc_core { diff --git a/src/core/client_channel/retry_filter.h b/src/core/client_channel/retry_filter.h index 153e2f1f004..8e30d1e7b66 100644 --- a/src/core/client_channel/retry_filter.h +++ b/src/core/client_channel/retry_filter.h @@ -30,7 +30,6 @@ #include #include #include -#include #include "src/core/client_channel/client_channel_filter.h" #include "src/core/client_channel/retry_service_config.h" diff --git a/src/core/client_channel/retry_filter_legacy_call_data.cc b/src/core/client_channel/retry_filter_legacy_call_data.cc index f3b96a9d977..dd0267d7c5b 100644 --- a/src/core/client_channel/retry_filter_legacy_call_data.cc +++ b/src/core/client_channel/retry_filter_legacy_call_data.cc @@ -230,12 +230,11 @@ void RetryFilter::LegacyCallData::CallAttempt::MaybeSwitchToFastPath() { // yet seen that op from the surface, we can't switch yet. if (recv_trailing_metadata_internal_batch_ != nullptr) return; // Switch to fast path. - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld_->chand_ << " calld=" << calld_ - << " attempt=" << this - << ": retry state no longer needed; " - "moving LB call to parent and unreffing the call attempt"; - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld_->chand_ << " calld=" << calld_ + << " attempt=" << this + << ": retry state no longer needed; " + "moving LB call to parent and unreffing the call attempt"; calld_->committed_call_ = std::move(lb_call_); calld_->call_attempt_.reset(DEBUG_LOCATION, "MaybeSwitchToFastPath"); } @@ -249,12 +248,10 @@ RetryFilter::LegacyCallData::CallAttempt::MaybeCreateBatchForReplay() { // send_initial_metadata. if (calld_->seen_send_initial_metadata_ && !started_send_initial_metadata_ && !calld_->pending_send_initial_metadata_) { - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld_->chand_ << " calld=" << calld_ - << " attempt=" << this - << ": replaying previously completed " - "send_initial_metadata op"; - } + GRPC_TRACE_LOG(retry, INFO) << "chand=" << calld_->chand_ + << " calld=" << calld_ << " attempt=" << this + << ": replaying previously completed " + "send_initial_metadata op"; replay_batch_data = CreateBatch(1, true /* set_on_complete */); replay_batch_data->AddRetriableSendInitialMetadataOp(); } @@ -263,12 +260,10 @@ RetryFilter::LegacyCallData::CallAttempt::MaybeCreateBatchForReplay() { if (started_send_message_count_ < calld_->send_messages_.size() && started_send_message_count_ == completed_send_message_count_ && !calld_->pending_send_message_) { - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld_->chand_ << " calld=" << calld_ - << " attempt=" << this - << ": replaying previously completed " - "send_message op"; - } + GRPC_TRACE_LOG(retry, INFO) << "chand=" << calld_->chand_ + << " calld=" << calld_ << " attempt=" << this + << ": replaying previously completed " + "send_message op"; if (replay_batch_data == nullptr) { replay_batch_data = CreateBatch(1, true /* set_on_complete */); } @@ -282,12 +277,10 @@ RetryFilter::LegacyCallData::CallAttempt::MaybeCreateBatchForReplay() { started_send_message_count_ == calld_->send_messages_.size() && !started_send_trailing_metadata_ && !calld_->pending_send_trailing_metadata_) { - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld_->chand_ << " calld=" << calld_ - << " attempt=" << this - << ": replaying previously completed " - "send_trailing_metadata op"; - } + GRPC_TRACE_LOG(retry, INFO) << "chand=" << calld_->chand_ + << " calld=" << calld_ << " attempt=" << this + << ": replaying previously completed " + "send_trailing_metadata op"; if (replay_batch_data == nullptr) { replay_batch_data = CreateBatch(1, true /* set_on_complete */); } @@ -325,12 +318,11 @@ void RetryFilter::LegacyCallData::CallAttempt::AddClosureForBatch( void RetryFilter::LegacyCallData::CallAttempt:: AddBatchForInternalRecvTrailingMetadata(CallCombinerClosureList* closures) { - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld_->chand_ << " calld=" << calld_ - << " attempt=" << this - << ": call failed but recv_trailing_metadata not started; " - "starting it internally"; - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld_->chand_ << " calld=" << calld_ + << " attempt=" << this + << ": call failed but recv_trailing_metadata not started; " + "starting it internally"; // Create batch_data with 2 refs, since this batch will be unreffed twice: // once for the recv_trailing_metadata_ready callback when the batch // completes, and again when we actually get a recv_trailing_metadata @@ -556,12 +548,11 @@ bool RetryFilter::LegacyCallData::CallAttempt::ShouldRetry( } // Status is not OK. Check whether the status is retryable. if (!calld_->retry_policy_->retryable_status_codes().Contains(*status)) { - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld_->chand_ << " calld=" << calld_ - << " attempt=" << this << ": status " - << grpc_status_code_to_string(*status) - << " not configured as retryable"; - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld_->chand_ << " calld=" << calld_ + << " attempt=" << this << ": status " + << grpc_status_code_to_string(*status) + << " not configured as retryable"; return false; } } @@ -651,14 +642,12 @@ void RetryFilter::LegacyCallData::CallAttempt::OnPerAttemptRecvTimerLocked( void* arg, grpc_error_handle error) { auto* call_attempt = static_cast(arg); auto* calld = call_attempt->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << ": perAttemptRecvTimeout timer fired: error=" - << StatusToString(error) - << ", per_attempt_recv_timer_handle_.has_value()=" - << call_attempt->per_attempt_recv_timer_handle_.has_value(); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt + << ": perAttemptRecvTimeout timer fired: error=" << StatusToString(error) + << ", per_attempt_recv_timer_handle_.has_value()=" + << call_attempt->per_attempt_recv_timer_handle_.has_value(); CallCombinerClosureList closures; call_attempt->per_attempt_recv_timer_handle_.reset(); // Cancel this attempt. @@ -804,13 +793,10 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData:: RefCountedPtr batch_data(static_cast(arg)); CallAttempt* call_attempt = batch_data->call_attempt_; RetryFilter::LegacyCallData* calld = call_attempt->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << " batch_data=" << batch_data.get() - << ": got recv_initial_metadata_ready, error=" - << StatusToString(error); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt << " batch_data=" << batch_data.get() + << ": got recv_initial_metadata_ready, error=" << StatusToString(error); call_attempt->completed_recv_initial_metadata_ = true; // If this attempt has been abandoned, then we're not going to use the // result of this recv_initial_metadata op, so do nothing. @@ -901,12 +887,10 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::RecvMessageReady( RefCountedPtr batch_data(static_cast(arg)); CallAttempt* call_attempt = batch_data->call_attempt_; RetryFilter::LegacyCallData* calld = call_attempt->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << " batch_data=" << batch_data.get() - << ": got recv_message_ready, error=" << StatusToString(error); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt << " batch_data=" << batch_data.get() + << ": got recv_message_ready, error=" << StatusToString(error); ++call_attempt->completed_recv_message_count_; // If this attempt has been abandoned, then we're not going to use the // result of this recv_message op, so do nothing. @@ -930,12 +914,11 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::RecvMessageReady( if (GPR_UNLIKELY( (!call_attempt->recv_message_.has_value() || !error.ok()) && !call_attempt->completed_recv_trailing_metadata_)) { - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << ": deferring recv_message_ready (nullptr message and " - "recv_trailing_metadata pending)"; - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt + << ": deferring recv_message_ready (nullptr message and " + "recv_trailing_metadata pending)"; call_attempt->recv_message_ready_deferred_batch_ = std::move(batch_data); call_attempt->recv_message_error_ = error; CallCombinerClosureList closures; @@ -1094,13 +1077,10 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData:: RefCountedPtr batch_data(static_cast(arg)); CallAttempt* call_attempt = batch_data->call_attempt_; RetryFilter::LegacyCallData* calld = call_attempt->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << " batch_data=" << batch_data.get() - << ": got recv_trailing_metadata_ready, error=" - << StatusToString(error); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt << " batch_data=" << batch_data.get() + << ": got recv_trailing_metadata_ready, error=" << StatusToString(error); call_attempt->completed_recv_trailing_metadata_ = true; // If this attempt has been abandoned, then we're not going to use the // result of this recv_trailing_metadata op, so do nothing. @@ -1121,17 +1101,15 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData:: batch_data->batch_.payload->recv_trailing_metadata.recv_trailing_metadata; GetCallStatus(calld->deadline_, md_batch, error, &status, &server_pushback, &is_lb_drop, &stream_network_state); - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt << ": call finished, status=" - << grpc_status_code_to_string(status) << " server_pushback=" - << (server_pushback.has_value() ? server_pushback->ToString() - : "N/A") - << " is_lb_drop=" << is_lb_drop << " stream_network_state=" - << (stream_network_state.has_value() - ? absl::StrCat(*stream_network_state) - : "N/A"); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt + << ": call finished, status=" << grpc_status_code_to_string(status) + << " server_pushback=" + << (server_pushback.has_value() ? server_pushback->ToString() : "N/A") + << " is_lb_drop=" << is_lb_drop << " stream_network_state=" + << (stream_network_state.has_value() ? absl::StrCat(*stream_network_state) + : "N/A"); // Check if we should retry. if (!is_lb_drop) { // Never retry on LB drops. enum { kNoRetry, kTransparentRetry, kConfigurableRetry } retry = kNoRetry; @@ -1253,15 +1231,11 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::OnComplete( RefCountedPtr batch_data(static_cast(arg)); CallAttempt* call_attempt = batch_data->call_attempt_; RetryFilter::LegacyCallData* calld = call_attempt->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << " batch_data=" << batch_data.get() - << ": got on_complete, error=" << StatusToString(error) - << ", batch=" - << grpc_transport_stream_op_batch_string(&batch_data->batch_, - false); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt << " batch_data=" << batch_data.get() + << ": got on_complete, error=" << StatusToString(error) << ", batch=" + << grpc_transport_stream_op_batch_string(&batch_data->batch_, false); // If this attempt has been abandoned, then we're not going to propagate // the completion of this batch, so do nothing. if (call_attempt->abandoned_) { @@ -1328,15 +1302,12 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData::OnCompleteForCancelOp( RefCountedPtr batch_data(static_cast(arg)); CallAttempt* call_attempt = batch_data->call_attempt_; RetryFilter::LegacyCallData* calld = call_attempt->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt - << " batch_data=" << batch_data.get() - << ": got on_complete for cancel_stream batch, error=" - << StatusToString(error) << ", batch=" - << grpc_transport_stream_op_batch_string(&batch_data->batch_, - false); - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt << " batch_data=" << batch_data.get() + << ": got on_complete for cancel_stream batch, error=" + << StatusToString(error) << ", batch=" + << grpc_transport_stream_op_batch_string(&batch_data->batch_, false); GRPC_CALL_COMBINER_STOP( calld->call_combiner_, "on_complete for internally generated cancel_stream op"); @@ -1371,12 +1342,10 @@ void RetryFilter::LegacyCallData::CallAttempt::BatchData:: void RetryFilter::LegacyCallData::CallAttempt::BatchData:: AddRetriableSendMessageOp() { auto* calld = call_attempt_->calld_; - if (GRPC_TRACE_FLAG_ENABLED(retry)) { - LOG(INFO) << "chand=" << calld->chand_ << " calld=" << calld - << " attempt=" << call_attempt_ - << ": starting calld->send_messages[" - << call_attempt_->started_send_message_count_ << "]"; - } + GRPC_TRACE_LOG(retry, INFO) + << "chand=" << calld->chand_ << " calld=" << calld + << " attempt=" << call_attempt_ << ": starting calld->send_messages[" + << call_attempt_->started_send_message_count_ << "]"; CachedSendMessage cache = calld->send_messages_[call_attempt_->started_send_message_count_]; ++call_attempt_->started_send_message_count_; diff --git a/src/core/client_channel/subchannel.cc b/src/core/client_channel/subchannel.cc index 5a313c9646b..35ec507c4d2 100644 --- a/src/core/client_channel/subchannel.cc +++ b/src/core/client_channel/subchannel.cc @@ -417,12 +417,11 @@ class Subchannel::ConnectedSubchannelStateWatcher final if (c->connected_subchannel_ == nullptr) return; if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE || new_state == GRPC_CHANNEL_SHUTDOWN) { - if (GRPC_TRACE_FLAG_ENABLED(subchannel)) { - LOG(INFO) << "subchannel " << c << " " << c->key_.ToString() - << ": Connected subchannel " - << c->connected_subchannel_.get() << " reports " - << ConnectivityStateName(new_state) << ": " << status; - } + GRPC_TRACE_LOG(subchannel, INFO) + << "subchannel " << c << " " << c->key_.ToString() + << ": Connected subchannel " << c->connected_subchannel_.get() + << " reports " << ConnectivityStateName(new_state) << ": " + << status; c->connected_subchannel_.reset(); if (c->channelz_node() != nullptr) { c->channelz_node()->SetChildSocket(nullptr); @@ -803,12 +802,10 @@ void Subchannel::OnConnectingFinishedLocked(grpc_error_handle error) { if (connecting_result_.transport == nullptr || !PublishTransportLocked()) { const Duration time_until_next_attempt = next_attempt_time_ - Timestamp::Now(); - if (GRPC_TRACE_FLAG_ENABLED(subchannel)) { - LOG(INFO) << "subchannel " << this << " " << key_.ToString() - << ": connect failed (" << StatusToString(error) - << "), backing off for " << time_until_next_attempt.millis() - << " ms"; - } + GRPC_TRACE_LOG(subchannel, INFO) + << "subchannel " << this << " " << key_.ToString() + << ": connect failed (" << StatusToString(error) + << "), backing off for " << time_until_next_attempt.millis() << " ms"; SetConnectivityStateLocked(GRPC_CHANNEL_TRANSIENT_FAILURE, grpc_error_to_absl_status(error)); retry_timer_handle_ = event_engine_->RunAfter( diff --git a/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc b/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc index 6d16ac68b7d..b560b92f59c 100644 --- a/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +++ b/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc @@ -29,7 +29,6 @@ #include "absl/types/optional.h" #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/promise_based_filter.h" diff --git a/src/core/ext/filters/stateful_session/stateful_session_filter.cc b/src/core/ext/filters/stateful_session/stateful_session_filter.cc index c677bd2cc1d..cf83e5db1ff 100644 --- a/src/core/ext/filters/stateful_session/stateful_session_filter.cc +++ b/src/core/ext/filters/stateful_session/stateful_session_filter.cc @@ -37,8 +37,6 @@ #include "absl/strings/strip.h" #include "absl/types/optional.h" -#include - #include "src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/config/core_configuration.h" diff --git a/src/core/ext/transport/chaotic_good/chaotic_good_transport.h b/src/core/ext/transport/chaotic_good/chaotic_good_transport.h index 903b8024a6f..b3df1ceb1e6 100644 --- a/src/core/ext/transport/chaotic_good/chaotic_good_transport.h +++ b/src/core/ext/transport/chaotic_good/chaotic_good_transport.h @@ -56,12 +56,11 @@ class ChaoticGoodTransport : public RefCounted { bool saw_encoding_errors = false; auto buffers = frame.Serialize(&encoder_, saw_encoding_errors); // ignore encoding errors: they will be logged separately already - if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) { - LOG(INFO) << "CHAOTIC_GOOD: WriteFrame to:" - << ResolvedAddressToString(control_endpoint_.GetPeerAddress()) - .value_or("<>") - << " " << frame.ToString(); - } + GRPC_TRACE_LOG(chaotic_good, INFO) + << "CHAOTIC_GOOD: WriteFrame to:" + << ResolvedAddressToString(control_endpoint_.GetPeerAddress()) + .value_or("<>") + << " " << frame.ToString(); return TryJoin( control_endpoint_.Write(std::move(buffers.control)), data_endpoint_.Write(std::move(buffers.data))); @@ -76,15 +75,13 @@ class ChaoticGoodTransport : public RefCounted { auto frame_header = FrameHeader::Parse(reinterpret_cast( GRPC_SLICE_START_PTR(read_buffer.c_slice()))); - if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) { - LOG(INFO) << "CHAOTIC_GOOD: ReadHeader from:" - << ResolvedAddressToString( - control_endpoint_.GetPeerAddress()) - .value_or("<>") - << " " - << (frame_header.ok() ? frame_header->ToString() - : frame_header.status().ToString()); - } + GRPC_TRACE_LOG(chaotic_good, INFO) + << "CHAOTIC_GOOD: ReadHeader from:" + << ResolvedAddressToString(control_endpoint_.GetPeerAddress()) + .value_or("<>") + << " " + << (frame_header.ok() ? frame_header->ToString() + : frame_header.status().ToString()); // Read header and trailers from control endpoint. // Read message padding and message from data endpoint. return If( diff --git a/src/core/ext/transport/chaotic_good/frame.cc b/src/core/ext/transport/chaotic_good/frame.cc index 4a165e9aa89..243d8ef4ca2 100644 --- a/src/core/ext/transport/chaotic_good/frame.cc +++ b/src/core/ext/transport/chaotic_good/frame.cc @@ -25,7 +25,6 @@ #include "absl/status/statusor.h" #include -#include #include #include "src/core/ext/transport/chaotic_good/frame_header.h" diff --git a/src/core/ext/transport/chaotic_good/frame_header.cc b/src/core/ext/transport/chaotic_good/frame_header.cc index b4c27074ce1..903e4646419 100644 --- a/src/core/ext/transport/chaotic_good/frame_header.cc +++ b/src/core/ext/transport/chaotic_good/frame_header.cc @@ -19,7 +19,6 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" -#include #include namespace grpc_core { diff --git a/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc b/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc index 43549036622..2a707602920 100644 --- a/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc +++ b/src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc @@ -300,12 +300,10 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState:: }, [self](PromiseEndpoint ret) -> absl::Status { MutexLock lock(&self->connection_->listener_->mu_); - if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) { - LOG(INFO) << self->connection_.get() - << " Data endpoint setup done: shutdown=" - << (self->connection_->listener_->shutdown_ ? "true" - : "false"); - } + GRPC_TRACE_LOG(chaotic_good, INFO) + << self->connection_.get() + << " Data endpoint setup done: shutdown=" + << (self->connection_->listener_->shutdown_ ? "true" : "false"); if (self->connection_->listener_->shutdown_) { return absl::UnavailableError("Server shutdown"); } @@ -458,6 +456,7 @@ void ChaoticGoodServerListener::Orphan() { absl::flat_hash_set> connection_list; MutexLock lock(&mu_); connection_list = std::move(connection_list_); + connection_list_.clear(); shutdown_ = true; } ee_listener_.reset(); diff --git a/src/core/ext/transport/chaotic_good/server_transport.cc b/src/core/ext/transport/chaotic_good/server_transport.cc index 67f1eca4ee6..6ffb6b7f067 100644 --- a/src/core/ext/transport/chaotic_good/server_transport.cc +++ b/src/core/ext/transport/chaotic_good/server_transport.cc @@ -203,10 +203,9 @@ auto ChaoticGoodServerTransport::CallOutboundLoop( Map(SendCallInitialMetadataAndBody(stream_id, outgoing_frames, call_initiator), [stream_id](absl::Status main_body_result) { - if (GRPC_TRACE_FLAG_ENABLED(chaotic_good)) { - VLOG(2) << "CHAOTIC_GOOD: CallOutboundLoop: stream_id=" - << stream_id << " main_body_result=" << main_body_result; - } + GRPC_TRACE_VLOG(chaotic_good, 2) + << "CHAOTIC_GOOD: CallOutboundLoop: stream_id=" << stream_id + << " main_body_result=" << main_body_result; return Empty{}; }), call_initiator.PullServerTrailingMetadata(), diff --git a/src/core/ext/transport/chaotic_good/server_transport.h b/src/core/ext/transport/chaotic_good/server_transport.h index e343b245506..246b25f7313 100644 --- a/src/core/ext/transport/chaotic_good/server_transport.h +++ b/src/core/ext/transport/chaotic_good/server_transport.h @@ -42,7 +42,6 @@ #include #include #include -#include #include #include "src/core/ext/transport/chaotic_good/chaotic_good_transport.h" diff --git a/src/core/ext/transport/chttp2/alpn/alpn.cc b/src/core/ext/transport/chttp2/alpn/alpn.cc index cb9c2d6e34d..75f17402335 100644 --- a/src/core/ext/transport/chttp2/alpn/alpn.cc +++ b/src/core/ext/transport/chttp2/alpn/alpn.cc @@ -20,7 +20,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/util/useful.h" diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.cc b/src/core/ext/transport/chttp2/transport/bin_encoder.cc index cf024f03d49..4063d1d5491 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -23,7 +23,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/ext/transport/chttp2/transport/huffsyms.h" diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 5c48b14746c..d3c5d994c1d 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1308,15 +1308,14 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t, return; } closure->next_data.scratch -= CLOSURE_BARRIER_FIRST_REF_BIT; - if (GRPC_TRACE_FLAG_ENABLED(http)) { - LOG(INFO) << "complete_closure_step: t=" << t << " " << closure << " refs=" - << (closure->next_data.scratch / CLOSURE_BARRIER_FIRST_REF_BIT) - << " flags=" - << (closure->next_data.scratch % CLOSURE_BARRIER_FIRST_REF_BIT) - << " desc=" << desc << " err=" << grpc_core::StatusToString(error) - << " write_state=" << write_state_name(t->write_state) - << " whence=" << whence.file() << ":" << whence.line(); - } + GRPC_TRACE_LOG(http, INFO) + << "complete_closure_step: t=" << t << " " << closure << " refs=" + << (closure->next_data.scratch / CLOSURE_BARRIER_FIRST_REF_BIT) + << " flags=" + << (closure->next_data.scratch % CLOSURE_BARRIER_FIRST_REF_BIT) + << " desc=" << desc << " err=" << grpc_core::StatusToString(error) + << " write_state=" << write_state_name(t->write_state) + << " whence=" << whence.file() << ":" << whence.line(); if (!error.ok()) { grpc_error_handle cl_err = @@ -1362,6 +1361,241 @@ static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id, }); } +static void send_initial_metadata_locked( + grpc_transport_stream_op_batch* op, grpc_chttp2_stream* s, + grpc_transport_stream_op_batch_payload* op_payload, + grpc_chttp2_transport* t, grpc_closure* on_complete) { + if (!grpc_core::IsCallTracerInTransportEnabled()) { + if (s->call_tracer != nullptr) { + s->call_tracer->RecordAnnotation( + grpc_core::HttpAnnotation(grpc_core::HttpAnnotation::Type::kStart, + gpr_now(GPR_CLOCK_REALTIME)) + .Add(s->t->flow_control.stats()) + .Add(s->flow_control.stats())); + } + } else if (grpc_core::IsTraceRecordCallopsEnabled()) { + auto* call_tracer = s->arena->GetContext(); + if (call_tracer != nullptr && call_tracer->IsSampled()) { + call_tracer->RecordAnnotation( + grpc_core::HttpAnnotation(grpc_core::HttpAnnotation::Type::kStart, + gpr_now(GPR_CLOCK_REALTIME)) + .Add(s->t->flow_control.stats()) + .Add(s->flow_control.stats())); + } + } + if (t->is_client && t->channelz_socket != nullptr) { + t->channelz_socket->RecordStreamStartedFromLocal(); + } + CHECK_EQ(s->send_initial_metadata_finished, nullptr); + on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; + + s->send_initial_metadata_finished = add_closure_barrier(on_complete); + s->send_initial_metadata = + op_payload->send_initial_metadata.send_initial_metadata; + if (t->is_client) { + s->deadline = + std::min(s->deadline, + s->send_initial_metadata->get(grpc_core::GrpcTimeoutMetadata()) + .value_or(grpc_core::Timestamp::InfFuture())); + } + if (contains_non_ok_status(s->send_initial_metadata)) { + s->seen_error = true; + } + if (!s->write_closed) { + if (t->is_client) { + if (t->closed_with_error.ok()) { + CHECK_EQ(s->id, 0u); + grpc_chttp2_list_add_waiting_for_concurrency(t, s); + maybe_start_some_streams(t); + } else { + s->trailing_metadata_buffer.Set( + grpc_core::GrpcStreamNetworkState(), + grpc_core::GrpcStreamNetworkState::kNotSentOnWire); + grpc_chttp2_cancel_stream( + t, s, + grpc_error_set_int( + GRPC_ERROR_CREATE_REFERENCING("Transport closed", + &t->closed_with_error, 1), + grpc_core::StatusIntProperty::kRpcStatus, + GRPC_STATUS_UNAVAILABLE), + false); + } + } else { + CHECK_NE(s->id, 0u); + grpc_chttp2_mark_stream_writable(t, s); + if (!(op->send_message && + (op->payload->send_message.flags & GRPC_WRITE_BUFFER_HINT))) { + grpc_chttp2_initiate_write( + t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA); + } + } + } else { + s->send_initial_metadata = nullptr; + grpc_chttp2_complete_closure_step( + t, &s->send_initial_metadata_finished, + GRPC_ERROR_CREATE_REFERENCING( + "Attempt to send initial metadata after stream was closed", + &s->write_closed_error, 1), + "send_initial_metadata_finished"); + } +} + +static void send_message_locked( + grpc_transport_stream_op_batch* op, grpc_chttp2_stream* s, + grpc_transport_stream_op_batch_payload* op_payload, + grpc_chttp2_transport* t, grpc_closure* on_complete) { + t->num_messages_in_next_write++; + grpc_core::global_stats().IncrementHttp2SendMessageSize( + op->payload->send_message.send_message->Length()); + on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; + s->send_message_finished = add_closure_barrier(op->on_complete); + const uint32_t flags = op_payload->send_message.flags; + if (s->write_closed) { + op->payload->send_message.stream_write_closed = true; + // We should NOT return an error here, so as to avoid a cancel OP being + // started. The surface layer will notice that the stream has been closed + // for writes and fail the send message op. + grpc_chttp2_complete_closure_step(t, &s->send_message_finished, + absl::OkStatus(), + "fetching_send_message_finished"); + } else { + uint8_t* frame_hdr = grpc_slice_buffer_tiny_add(&s->flow_controlled_buffer, + GRPC_HEADER_SIZE_IN_BYTES); + frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0; + size_t len = op_payload->send_message.send_message->Length(); + frame_hdr[1] = static_cast(len >> 24); + frame_hdr[2] = static_cast(len >> 16); + frame_hdr[3] = static_cast(len >> 8); + frame_hdr[4] = static_cast(len); + + s->call_tracer_wrapper.RecordOutgoingBytes( + {GRPC_HEADER_SIZE_IN_BYTES, len, 0}); + s->next_message_end_offset = + s->flow_controlled_bytes_written + + static_cast(s->flow_controlled_buffer.length) + + static_cast(len); + if (flags & GRPC_WRITE_BUFFER_HINT) { + s->next_message_end_offset -= t->write_buffer_size; + s->write_buffering = true; + } else { + s->write_buffering = false; + } + + grpc_slice* const slices = + op_payload->send_message.send_message->c_slice_buffer()->slices; + grpc_slice* const end = + slices + op_payload->send_message.send_message->Count(); + for (grpc_slice* slice = slices; slice != end; slice++) { + grpc_slice_buffer_add(&s->flow_controlled_buffer, + grpc_core::CSliceRef(*slice)); + } + + int64_t notify_offset = s->next_message_end_offset; + if (notify_offset <= s->flow_controlled_bytes_written) { + grpc_chttp2_complete_closure_step(t, &s->send_message_finished, + absl::OkStatus(), + "fetching_send_message_finished"); + } else { + grpc_chttp2_write_cb* cb = t->write_cb_pool; + if (cb == nullptr) { + cb = static_cast(gpr_malloc(sizeof(*cb))); + } else { + t->write_cb_pool = cb->next; + } + cb->call_at_byte = notify_offset; + cb->closure = s->send_message_finished; + s->send_message_finished = nullptr; + grpc_chttp2_write_cb** list = flags & GRPC_WRITE_THROUGH + ? &s->on_write_finished_cbs + : &s->on_flow_controlled_cbs; + cb->next = *list; + *list = cb; + } + + if (s->id != 0 && (!s->write_buffering || s->flow_controlled_buffer.length > + t->write_buffer_size)) { + grpc_chttp2_mark_stream_writable(t, s); + grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE); + } + } +} + +static void send_trailing_metadata_locked( + grpc_transport_stream_op_batch* op, grpc_chttp2_stream* s, + grpc_transport_stream_op_batch_payload* op_payload, + grpc_chttp2_transport* t, grpc_closure* on_complete) { + CHECK_EQ(s->send_trailing_metadata_finished, nullptr); + on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; + s->send_trailing_metadata_finished = add_closure_barrier(on_complete); + s->send_trailing_metadata = + op_payload->send_trailing_metadata.send_trailing_metadata; + s->sent_trailing_metadata_op = op_payload->send_trailing_metadata.sent; + s->write_buffering = false; + if (contains_non_ok_status(s->send_trailing_metadata)) { + s->seen_error = true; + } + if (s->write_closed) { + s->send_trailing_metadata = nullptr; + s->sent_trailing_metadata_op = nullptr; + grpc_chttp2_complete_closure_step( + t, &s->send_trailing_metadata_finished, + op->payload->send_trailing_metadata.send_trailing_metadata->empty() + ? absl::OkStatus() + : GRPC_ERROR_CREATE("Attempt to send trailing metadata after " + "stream was closed"), + "send_trailing_metadata_finished"); + } else if (s->id != 0) { + // TODO(ctiller): check if there's flow control for any outstanding + // bytes before going writable + grpc_chttp2_mark_stream_writable(t, s); + grpc_chttp2_initiate_write( + t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA); + } +} + +static void recv_initial_metadata_locked( + grpc_chttp2_stream* s, grpc_transport_stream_op_batch_payload* op_payload, + grpc_chttp2_transport* t) { + CHECK_EQ(s->recv_initial_metadata_ready, nullptr); + s->recv_initial_metadata_ready = + op_payload->recv_initial_metadata.recv_initial_metadata_ready; + s->recv_initial_metadata = + op_payload->recv_initial_metadata.recv_initial_metadata; + s->trailing_metadata_available = + op_payload->recv_initial_metadata.trailing_metadata_available; + if (s->parsed_trailers_only && s->trailing_metadata_available != nullptr) { + *s->trailing_metadata_available = true; + } + grpc_chttp2_maybe_complete_recv_initial_metadata(t, s); +} + +static void recv_message_locked( + grpc_chttp2_stream* s, grpc_transport_stream_op_batch_payload* op_payload, + grpc_chttp2_transport* t) { + CHECK_EQ(s->recv_message_ready, nullptr); + s->recv_message_ready = op_payload->recv_message.recv_message_ready; + s->recv_message = op_payload->recv_message.recv_message; + s->recv_message->emplace(); + s->recv_message_flags = op_payload->recv_message.flags; + s->call_failed_before_recv_message = + op_payload->recv_message.call_failed_before_recv_message; + grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s); +} + +static void recv_trailing_metadata_locked( + grpc_chttp2_stream* s, grpc_transport_stream_op_batch_payload* op_payload, + grpc_chttp2_transport* t) { + CHECK_EQ(s->collecting_stats, nullptr); + s->collecting_stats = op_payload->recv_trailing_metadata.collect_stats; + CHECK_EQ(s->recv_trailing_metadata_finished, nullptr); + s->recv_trailing_metadata_finished = + op_payload->recv_trailing_metadata.recv_trailing_metadata_ready; + s->recv_trailing_metadata = + op_payload->recv_trailing_metadata.recv_trailing_metadata; + s->final_metadata_requested = true; + grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s); +} + static void perform_stream_op_locked(void* stream_op, grpc_error_handle /*error_ignored*/) { grpc_transport_stream_op_batch* op = @@ -1405,225 +1639,27 @@ static void perform_stream_op_locked(void* stream_op, } if (op->send_initial_metadata) { - if (!grpc_core::IsCallTracerInTransportEnabled()) { - if (s->call_tracer != nullptr) { - s->call_tracer->RecordAnnotation( - grpc_core::HttpAnnotation(grpc_core::HttpAnnotation::Type::kStart, - gpr_now(GPR_CLOCK_REALTIME)) - .Add(s->t->flow_control.stats()) - .Add(s->flow_control.stats())); - } - } else if (grpc_core::IsTraceRecordCallopsEnabled()) { - auto* call_tracer = - s->arena->GetContext(); - if (call_tracer != nullptr && call_tracer->IsSampled()) { - call_tracer->RecordAnnotation( - grpc_core::HttpAnnotation(grpc_core::HttpAnnotation::Type::kStart, - gpr_now(GPR_CLOCK_REALTIME)) - .Add(s->t->flow_control.stats()) - .Add(s->flow_control.stats())); - } - } - if (t->is_client && t->channelz_socket != nullptr) { - t->channelz_socket->RecordStreamStartedFromLocal(); - } - CHECK_EQ(s->send_initial_metadata_finished, nullptr); - on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; - - s->send_initial_metadata_finished = add_closure_barrier(on_complete); - s->send_initial_metadata = - op_payload->send_initial_metadata.send_initial_metadata; - if (t->is_client) { - s->deadline = std::min( - s->deadline, - s->send_initial_metadata->get(grpc_core::GrpcTimeoutMetadata()) - .value_or(grpc_core::Timestamp::InfFuture())); - } - if (contains_non_ok_status(s->send_initial_metadata)) { - s->seen_error = true; - } - if (!s->write_closed) { - if (t->is_client) { - if (t->closed_with_error.ok()) { - CHECK_EQ(s->id, 0u); - grpc_chttp2_list_add_waiting_for_concurrency(t, s); - maybe_start_some_streams(t); - } else { - s->trailing_metadata_buffer.Set( - grpc_core::GrpcStreamNetworkState(), - grpc_core::GrpcStreamNetworkState::kNotSentOnWire); - grpc_chttp2_cancel_stream( - t, s, - grpc_error_set_int( - GRPC_ERROR_CREATE_REFERENCING("Transport closed", - &t->closed_with_error, 1), - grpc_core::StatusIntProperty::kRpcStatus, - GRPC_STATUS_UNAVAILABLE), - false); - } - } else { - CHECK_NE(s->id, 0u); - grpc_chttp2_mark_stream_writable(t, s); - if (!(op->send_message && - (op->payload->send_message.flags & GRPC_WRITE_BUFFER_HINT))) { - grpc_chttp2_initiate_write( - t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA); - } - } - } else { - s->send_initial_metadata = nullptr; - grpc_chttp2_complete_closure_step( - t, &s->send_initial_metadata_finished, - GRPC_ERROR_CREATE_REFERENCING( - "Attempt to send initial metadata after stream was closed", - &s->write_closed_error, 1), - "send_initial_metadata_finished"); - } + send_initial_metadata_locked(op, s, op_payload, t, on_complete); } if (op->send_message) { - t->num_messages_in_next_write++; - grpc_core::global_stats().IncrementHttp2SendMessageSize( - op->payload->send_message.send_message->Length()); - on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; - s->send_message_finished = add_closure_barrier(op->on_complete); - const uint32_t flags = op_payload->send_message.flags; - if (s->write_closed) { - op->payload->send_message.stream_write_closed = true; - // We should NOT return an error here, so as to avoid a cancel OP being - // started. The surface layer will notice that the stream has been closed - // for writes and fail the send message op. - grpc_chttp2_complete_closure_step(t, &s->send_message_finished, - absl::OkStatus(), - "fetching_send_message_finished"); - } else { - uint8_t* frame_hdr = grpc_slice_buffer_tiny_add( - &s->flow_controlled_buffer, GRPC_HEADER_SIZE_IN_BYTES); - frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0; - size_t len = op_payload->send_message.send_message->Length(); - frame_hdr[1] = static_cast(len >> 24); - frame_hdr[2] = static_cast(len >> 16); - frame_hdr[3] = static_cast(len >> 8); - frame_hdr[4] = static_cast(len); - - s->call_tracer_wrapper.RecordOutgoingBytes( - {GRPC_HEADER_SIZE_IN_BYTES, len, 0}); - s->next_message_end_offset = - s->flow_controlled_bytes_written + - static_cast(s->flow_controlled_buffer.length) + - static_cast(len); - if (flags & GRPC_WRITE_BUFFER_HINT) { - s->next_message_end_offset -= t->write_buffer_size; - s->write_buffering = true; - } else { - s->write_buffering = false; - } - - grpc_slice* const slices = - op_payload->send_message.send_message->c_slice_buffer()->slices; - grpc_slice* const end = - slices + op_payload->send_message.send_message->Count(); - for (grpc_slice* slice = slices; slice != end; slice++) { - grpc_slice_buffer_add(&s->flow_controlled_buffer, - grpc_core::CSliceRef(*slice)); - } - - int64_t notify_offset = s->next_message_end_offset; - if (notify_offset <= s->flow_controlled_bytes_written) { - grpc_chttp2_complete_closure_step(t, &s->send_message_finished, - absl::OkStatus(), - "fetching_send_message_finished"); - } else { - grpc_chttp2_write_cb* cb = t->write_cb_pool; - if (cb == nullptr) { - cb = static_cast(gpr_malloc(sizeof(*cb))); - } else { - t->write_cb_pool = cb->next; - } - cb->call_at_byte = notify_offset; - cb->closure = s->send_message_finished; - s->send_message_finished = nullptr; - grpc_chttp2_write_cb** list = flags & GRPC_WRITE_THROUGH - ? &s->on_write_finished_cbs - : &s->on_flow_controlled_cbs; - cb->next = *list; - *list = cb; - } - - if (s->id != 0 && - (!s->write_buffering || - s->flow_controlled_buffer.length > t->write_buffer_size)) { - grpc_chttp2_mark_stream_writable(t, s); - grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE); - } - } + send_message_locked(op, s, op_payload, t, on_complete); } if (op->send_trailing_metadata) { - CHECK_EQ(s->send_trailing_metadata_finished, nullptr); - on_complete->next_data.scratch |= t->closure_barrier_may_cover_write; - s->send_trailing_metadata_finished = add_closure_barrier(on_complete); - s->send_trailing_metadata = - op_payload->send_trailing_metadata.send_trailing_metadata; - s->sent_trailing_metadata_op = op_payload->send_trailing_metadata.sent; - s->write_buffering = false; - if (contains_non_ok_status(s->send_trailing_metadata)) { - s->seen_error = true; - } - if (s->write_closed) { - s->send_trailing_metadata = nullptr; - s->sent_trailing_metadata_op = nullptr; - grpc_chttp2_complete_closure_step( - t, &s->send_trailing_metadata_finished, - op->payload->send_trailing_metadata.send_trailing_metadata->empty() - ? absl::OkStatus() - : GRPC_ERROR_CREATE("Attempt to send trailing metadata after " - "stream was closed"), - "send_trailing_metadata_finished"); - } else if (s->id != 0) { - // TODO(ctiller): check if there's flow control for any outstanding - // bytes before going writable - grpc_chttp2_mark_stream_writable(t, s); - grpc_chttp2_initiate_write( - t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA); - } + send_trailing_metadata_locked(op, s, op_payload, t, on_complete); } if (op->recv_initial_metadata) { - CHECK_EQ(s->recv_initial_metadata_ready, nullptr); - s->recv_initial_metadata_ready = - op_payload->recv_initial_metadata.recv_initial_metadata_ready; - s->recv_initial_metadata = - op_payload->recv_initial_metadata.recv_initial_metadata; - s->trailing_metadata_available = - op_payload->recv_initial_metadata.trailing_metadata_available; - if (s->parsed_trailers_only && s->trailing_metadata_available != nullptr) { - *s->trailing_metadata_available = true; - } - grpc_chttp2_maybe_complete_recv_initial_metadata(t, s); + recv_initial_metadata_locked(s, op_payload, t); } if (op->recv_message) { - CHECK_EQ(s->recv_message_ready, nullptr); - s->recv_message_ready = op_payload->recv_message.recv_message_ready; - s->recv_message = op_payload->recv_message.recv_message; - s->recv_message->emplace(); - s->recv_message_flags = op_payload->recv_message.flags; - s->call_failed_before_recv_message = - op_payload->recv_message.call_failed_before_recv_message; - grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s); + recv_message_locked(s, op_payload, t); } if (op->recv_trailing_metadata) { - CHECK_EQ(s->collecting_stats, nullptr); - s->collecting_stats = op_payload->recv_trailing_metadata.collect_stats; - CHECK_EQ(s->recv_trailing_metadata_finished, nullptr); - s->recv_trailing_metadata_finished = - op_payload->recv_trailing_metadata.recv_trailing_metadata_ready; - s->recv_trailing_metadata = - op_payload->recv_trailing_metadata.recv_trailing_metadata; - s->final_metadata_requested = true; - grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s); + recv_trailing_metadata_locked(s, op_payload, t); } if (on_complete != nullptr) { @@ -2048,11 +2084,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t, // Lambda is immediately invoked as a big scoped section that can be // exited out of at any point by returning. [&]() { - if (GRPC_TRACE_FLAG_ENABLED(http)) { - VLOG(2) << "maybe_complete_recv_message " << s - << " final_metadata_requested=" << s->final_metadata_requested - << " seen_error=" << s->seen_error; - } + GRPC_TRACE_VLOG(http, 2) + << "maybe_complete_recv_message " << s + << " final_metadata_requested=" << s->final_metadata_requested + << " seen_error=" << s->seen_error; if (s->final_metadata_requested && s->seen_error) { grpc_slice_buffer_reset_and_unref(&s->frame_storage); s->recv_message->reset(); @@ -2063,11 +2098,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t, int64_t min_progress_size; auto r = grpc_deframe_unprocessed_incoming_frames( s, &min_progress_size, &**s->recv_message, s->recv_message_flags); - if (GRPC_TRACE_FLAG_ENABLED(http)) { - VLOG(2) << "Deframe data frame: " - << grpc_core::PollToString( - r, [](absl::Status r) { return r.ToString(); }); - } + GRPC_TRACE_VLOG(http, 2) + << "Deframe data frame: " + << grpc_core::PollToString( + r, [](absl::Status r) { return r.ToString(); }); if (r.pending()) { if (s->read_closed) { grpc_slice_buffer_reset_and_unref(&s->frame_storage); @@ -2118,13 +2152,12 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t, void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t, grpc_chttp2_stream* s) { grpc_chttp2_maybe_complete_recv_message(t, s); - if (GRPC_TRACE_FLAG_ENABLED(http)) { - VLOG(2) << "maybe_complete_recv_trailing_metadata cli=" << t->is_client - << " s=" << s << " closure=" << s->recv_trailing_metadata_finished - << " read_closed=" << s->read_closed - << " write_closed=" << s->write_closed << " " - << s->frame_storage.length; - } + GRPC_TRACE_VLOG(http, 2) << "maybe_complete_recv_trailing_metadata cli=" + << t->is_client << " s=" << s + << " closure=" << s->recv_trailing_metadata_finished + << " read_closed=" << s->read_closed + << " write_closed=" << s->write_closed << " " + << s->frame_storage.length; if (s->recv_trailing_metadata_finished != nullptr && s->read_closed && s->write_closed) { if (s->seen_error || !t->is_client) { @@ -2328,15 +2361,12 @@ grpc_chttp2_transport::RemovedStreamHandle grpc_chttp2_mark_stream_closed( grpc_chttp2_transport* t, grpc_chttp2_stream* s, int close_reads, int close_writes, grpc_error_handle error) { grpc_chttp2_transport::RemovedStreamHandle rsh; - if (GRPC_TRACE_FLAG_ENABLED(http)) { - VLOG(2) << "MARK_STREAM_CLOSED: t=" << t << " s=" << s << "(id=" << s->id - << ") " - << ((close_reads && close_writes) - ? "read+write" - : (close_reads ? "read" - : (close_writes ? "write" : "nothing??"))) - << " [" << grpc_core::StatusToString(error) << "]"; - } + GRPC_TRACE_VLOG(http, 2) + << "MARK_STREAM_CLOSED: t=" << t << " s=" << s << "(id=" << s->id << ") " + << ((close_reads && close_writes) + ? "read+write" + : (close_reads ? "read" : (close_writes ? "write" : "nothing??"))) + << " [" << grpc_core::StatusToString(error) << "]"; if (s->read_closed && s->write_closed) { // already closed, but we should still fake the status if needed. grpc_error_handle overall_error = removal_error(error, s, "Stream removed"); diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h index a0bd6323b0e..b15e8603c22 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.h +++ b/src/core/ext/transport/chttp2/transport/flow_control.h @@ -32,7 +32,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" -#include #include #include "src/core/ext/transport/chttp2/transport/http2_settings.h" diff --git a/src/core/ext/transport/chttp2/transport/frame.cc b/src/core/ext/transport/chttp2/transport/frame.cc index 9e05cf6d854..92788903f15 100644 --- a/src/core/ext/transport/chttp2/transport/frame.cc +++ b/src/core/ext/transport/chttp2/transport/frame.cc @@ -23,7 +23,6 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc index e16965c4478..77739c30883 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.cc +++ b/src/core/ext/transport/chttp2/transport/frame_data.cc @@ -25,7 +25,6 @@ #include "absl/strings/str_format.h" #include -#include #include #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.cc b/src/core/ext/transport/chttp2/transport/frame_goaway.cc index fadce901392..31e7c76ba39 100644 --- a/src/core/ext/transport/chttp2/transport/frame_goaway.cc +++ b/src/core/ext/transport/chttp2/transport/frame_goaway.cc @@ -28,7 +28,6 @@ #include #include -#include #include #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc index ebf74b21142..e0a12218cab 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.cc +++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc @@ -187,12 +187,11 @@ grpc_error_handle grpc_chttp2_settings_parser_parse(void* p, "invalid value %u passed for %s", parser->value, grpc_core::Http2Settings::WireIdToName(parser->id).c_str())); } - if (GRPC_TRACE_FLAG_ENABLED(http)) { - LOG(INFO) << "CHTTP2:" << (t->is_client ? "CLI" : "SVR") << ":" - << t->peer_string.as_string_view() << ": got setting " - << grpc_core::Http2Settings::WireIdToName(parser->id) - << " = " << parser->value; - } + GRPC_TRACE_LOG(http, INFO) + << "CHTTP2:" << (t->is_client ? "CLI" : "SVR") << ":" + << t->peer_string.as_string_view() << ": got setting " + << grpc_core::Http2Settings::WireIdToName(parser->id) << " = " + << parser->value; } break; } } diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.cc b/src/core/ext/transport/chttp2/transport/frame_window_update.cc index efae1615eb9..6dafd5318b2 100644 --- a/src/core/ext/transport/chttp2/transport/frame_window_update.cc +++ b/src/core/ext/transport/chttp2/transport/frame_window_update.cc @@ -25,7 +25,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" -#include #include #include "src/core/ext/transport/chttp2/transport/flow_control.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc index 3492fd5982b..143781dca32 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc @@ -18,7 +18,6 @@ #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/hpack_parse_result.h b/src/core/ext/transport/chttp2/transport/hpack_parse_result.h index 0d3a57ad3df..b810264a367 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parse_result.h @@ -27,7 +27,6 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index 070294b2cf4..d8c1680c3b2 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -331,13 +331,11 @@ absl::variant grpc_chttp2_perform_read( case GRPC_DTS_FH_8: DCHECK_LT(cur, end); t->incoming_stream_id |= (static_cast(*cur)); - if (GRPC_TRACE_FLAG_ENABLED(http)) { - LOG(INFO) << "INCOMING[" << t << "]: " - << FrameTypeString(t->incoming_frame_type, - t->incoming_frame_flags) - << " len:" << t->incoming_frame_size - << absl::StrFormat(" id:0x%08x", t->incoming_stream_id); - } + GRPC_TRACE_LOG(http, INFO) + << "INCOMING[" << t << "]: " + << FrameTypeString(t->incoming_frame_type, t->incoming_frame_flags) + << " len:" << t->incoming_frame_size + << absl::StrFormat(" id:0x%08x", t->incoming_stream_id); t->deframe_state = GRPC_DTS_FRAME; err = init_frame_parser(t, requests_started); if (!err.ok()) { @@ -453,10 +451,9 @@ static grpc_error_handle init_frame_parser(grpc_chttp2_transport* t, case GRPC_CHTTP2_FRAME_GOAWAY: return init_goaway_parser(t); default: - if (GRPC_TRACE_FLAG_ENABLED(http)) { - LOG(ERROR) << "Unknown frame type " - << absl::StrFormat("%02x", t->incoming_frame_type); - } + GRPC_TRACE_LOG(http, ERROR) + << "Unknown frame type " + << absl::StrFormat("%02x", t->incoming_frame_type); return init_non_header_skip_frame_parser(t); } } @@ -790,10 +787,8 @@ static grpc_error_handle init_window_update_frame_parser( grpc_chttp2_stream* s = t->incoming_stream = grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id); if (s == nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(http)) { - LOG(ERROR) << "Stream " << t->incoming_stream_id - << " not found, ignoring WINDOW_UPDATE"; - } + GRPC_TRACE_LOG(http, ERROR) << "Stream " << t->incoming_stream_id + << " not found, ignoring WINDOW_UPDATE"; return init_non_header_skip_frame_parser(t); } s->call_tracer_wrapper.RecordIncomingBytes({9, 0, 0}); @@ -888,10 +883,8 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t, if (GPR_LIKELY(err.ok())) { return err; } - if (GRPC_TRACE_FLAG_ENABLED(http)) { - LOG(ERROR) << "INCOMING[" << t << ";" << s << "]: Parse failed with " - << err; - } + GRPC_TRACE_LOG(http, ERROR) + << "INCOMING[" << t << ";" << s << "]: Parse failed with " << err; if (grpc_error_get_int(err, grpc_core::StatusIntProperty::kStreamId, &unused)) { grpc_chttp2_parsing_become_skip_parser(t); diff --git a/src/core/ext/transport/chttp2/transport/ping_callbacks.cc b/src/core/ext/transport/chttp2/transport/ping_callbacks.cc index b568ad860a7..4bd16e1fbb4 100644 --- a/src/core/ext/transport/chttp2/transport/ping_callbacks.cc +++ b/src/core/ext/transport/chttp2/transport/ping_callbacks.cc @@ -20,7 +20,6 @@ #include "absl/meta/type_traits.h" #include "absl/random/distributions.h" -#include #include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/varint.h b/src/core/ext/transport/chttp2/transport/varint.h index c02d5d10313..3dcf32aa609 100644 --- a/src/core/ext/transport/chttp2/transport/varint.h +++ b/src/core/ext/transport/chttp2/transport/varint.h @@ -24,7 +24,6 @@ #include "absl/log/check.h" -#include #include // Helpers for hpack varint encoding diff --git a/src/core/ext/transport/chttp2/transport/write_size_policy.cc b/src/core/ext/transport/chttp2/transport/write_size_policy.cc index f8ec481d7fe..63e8d2b7e25 100644 --- a/src/core/ext/transport/chttp2/transport/write_size_policy.cc +++ b/src/core/ext/transport/chttp2/transport/write_size_policy.cc @@ -18,7 +18,6 @@ #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index 029608120cc..29c3b67e82a 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -204,24 +204,21 @@ static bool update_list(grpc_chttp2_transport* t, int64_t send_bytes, static void report_stall(grpc_chttp2_transport* t, grpc_chttp2_stream* s, const char* staller) { - if (GRPC_TRACE_FLAG_ENABLED(flowctl)) { - VLOG(2) << t->peer_string.as_string_view() << ":" << t << " stream " - << s->id << " moved to stalled list by " << staller - << ". This is FULLY expected to happen in a healthy program that " - "is not seeing flow control stalls. However, if you know that " - "there are unwanted stalls, here is some helpful data: " - "[fc:pending=" - << s->flow_controlled_buffer.length - << ":flowed=" << s->flow_controlled_bytes_flowed - << ":peer_initwin=" << t->settings.acked().initial_window_size() - << ":t_win=" << t->flow_control.remote_window() << ":s_win=" - << static_cast( - std::max(int64_t{0}, - s->flow_control.remote_window_delta() + - static_cast( - t->settings.peer().initial_window_size()))) - << ":s_delta=" << s->flow_control.remote_window_delta() << "]"; - } + GRPC_TRACE_VLOG(flowctl, 2) + << t->peer_string.as_string_view() << ":" << t << " stream " << s->id + << " moved to stalled list by " << staller + << ". This is FULLY expected to happen in a healthy program that is not " + "seeing flow control stalls. However, if you know that there are " + "unwanted stalls, here is some helpful data: [fc:pending=" + << s->flow_controlled_buffer.length + << ":flowed=" << s->flow_controlled_bytes_flowed + << ":peer_initwin=" << t->settings.acked().initial_window_size() + << ":t_win=" << t->flow_control.remote_window() << ":s_win=" + << static_cast(std::max( + int64_t{0}, s->flow_control.remote_window_delta() + + static_cast( + t->settings.peer().initial_window_size()))) + << ":s_delta=" << s->flow_control.remote_window_delta() << "]"; } namespace { diff --git a/src/core/ext/transport/cronet/transport/cronet_api_phony.cc b/src/core/ext/transport/cronet/transport/cronet_api_phony.cc index 57afb811468..f0befc2faa1 100644 --- a/src/core/ext/transport/cronet/transport/cronet_api_phony.cc +++ b/src/core/ext/transport/cronet/transport/cronet_api_phony.cc @@ -22,7 +22,6 @@ #include "absl/log/check.h" #include "third_party/objective_c/Cronet/bidirectional_stream_c.h" -#include #include #ifdef GRPC_COMPILE_WITH_CRONET diff --git a/src/core/handshaker/handshaker.cc b/src/core/handshaker/handshaker.cc index 263628cab01..3949dccbe59 100644 --- a/src/core/handshaker/handshaker.cc +++ b/src/core/handshaker/handshaker.cc @@ -166,12 +166,10 @@ void HandshakeManager::CallNextHandshakerLocked(absl::Status error) { error = GRPC_ERROR_CREATE("handshaker shutdown"); args_.endpoint.reset(); } - if (GRPC_TRACE_FLAG_ENABLED(handshaker)) { - LOG(INFO) << "handshake_manager " << this - << ": handshaking complete -- scheduling " - "on_handshake_done with error=" - << error; - } + GRPC_TRACE_LOG(handshaker, INFO) << "handshake_manager " << this + << ": handshaking complete -- scheduling " + "on_handshake_done with error=" + << error; // Cancel deadline timer, since we're invoking the on_handshake_done // callback now. args_.event_engine->Cancel(deadline_timer_handle_); diff --git a/src/core/handshaker/security/security_handshaker.cc b/src/core/handshaker/security/security_handshaker.cc index ad3df9b94ef..e54735e53a6 100644 --- a/src/core/handshaker/security/security_handshaker.cc +++ b/src/core/handshaker/security/security_handshaker.cc @@ -41,7 +41,6 @@ #include #include #include -#include #include #include "src/core/channelz/channelz.h" diff --git a/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc b/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc index 7822a5cebea..77ae19ef7db 100644 --- a/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc +++ b/src/core/handshaker/tcp_connect/tcp_connect_handshaker.cc @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "src/core/handshaker/handshaker.h" diff --git a/src/core/lib/channel/channel_stack.cc b/src/core/lib/channel/channel_stack.cc index 36e3461700a..2590ab4590d 100644 --- a/src/core/lib/channel/channel_stack.cc +++ b/src/core/lib/channel/channel_stack.cc @@ -26,7 +26,6 @@ #include "absl/log/check.h" #include "absl/log/log.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index f21c1dc0d8e..451cba6be90 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -53,7 +53,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/channel/channel_stack_builder_impl.cc b/src/core/lib/channel/channel_stack_builder_impl.cc index 7db444474e9..a5d93d81edc 100644 --- a/src/core/lib/channel/channel_stack_builder_impl.cc +++ b/src/core/lib/channel/channel_stack_builder_impl.cc @@ -33,7 +33,6 @@ #include "absl/strings/str_cat.h" #include -#include #include #include "src/core/lib/channel/channel_fwd.h" diff --git a/src/core/lib/channel/connected_channel.cc b/src/core/lib/channel/connected_channel.cc index f24304bac89..9977ecdabfe 100644 --- a/src/core/lib/channel/connected_channel.cc +++ b/src/core/lib/channel/connected_channel.cc @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/call_finalization.h" diff --git a/src/core/lib/channel/promise_based_filter.cc b/src/core/lib/channel/promise_based_filter.cc index 6af8436b187..5f0879dda27 100644 --- a/src/core/lib/channel/promise_based_filter.cc +++ b/src/core/lib/channel/promise_based_filter.cc @@ -468,13 +468,12 @@ void BaseCallData::SendMessage::Done(const ServerMetadata& metadata, void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher, bool allow_push_to_pipe) { - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << base_->LogTag() - << " SendMessage.WakeInsideCombiner st=" << StateString(state_) - << (state_ == State::kBatchCompleted - ? absl::StrCat(" status=", completed_status_.ToString()) - : ""); - } + GRPC_TRACE_LOG(channel, INFO) + << base_->LogTag() + << " SendMessage.WakeInsideCombiner st=" << StateString(state_) + << (state_ == State::kBatchCompleted + ? absl::StrCat(" status=", completed_status_.ToString()) + : ""); switch (state_) { case State::kInitial: case State::kIdle: @@ -502,12 +501,11 @@ void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher, CHECK(push_.has_value()); auto r_push = (*push_)(); if (auto* p = r_push.value_if_ready()) { - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << base_->LogTag() - << " SendMessage.WakeInsideCombiner push complete, " - "result=" - << (*p ? "true" : "false"); - } + GRPC_TRACE_LOG(channel, INFO) + << base_->LogTag() + << " SendMessage.WakeInsideCombiner push complete, " + "result=" + << (*p ? "true" : "false"); // We haven't pulled through yet, so this certainly shouldn't succeed. CHECK(!*p); state_ = State::kCancelled; @@ -517,12 +515,11 @@ void BaseCallData::SendMessage::WakeInsideCombiner(Flusher* flusher, CHECK(next_.has_value()); auto r_next = (*next_)(); if (auto* p = r_next.value_if_ready()) { - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << base_->LogTag() - << " SendMessage.WakeInsideCombiner next complete, " - "result.has_value=" - << (p->has_value() ? "true" : "false"); - } + GRPC_TRACE_LOG(channel, INFO) + << base_->LogTag() + << " SendMessage.WakeInsideCombiner next complete, " + "result.has_value=" + << (p->has_value() ? "true" : "false"); if (p->has_value()) { batch_->payload->send_message.send_message->Swap((**p)->payload()); batch_->payload->send_message.flags = (**p)->flags(); @@ -774,13 +771,12 @@ void BaseCallData::ReceiveMessage::Done(const ServerMetadata& metadata, void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher, bool allow_push_to_pipe) { - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << base_->LogTag() - << " ReceiveMessage.WakeInsideCombiner st=" << StateString(state_) - << " push?=" << (push_.has_value() ? "yes" : "no") - << " next?=" << (next_.has_value() ? "yes" : "no") - << " allow_push_to_pipe=" << (allow_push_to_pipe ? "yes" : "no"); - } + GRPC_TRACE_LOG(channel, INFO) + << base_->LogTag() + << " ReceiveMessage.WakeInsideCombiner st=" << StateString(state_) + << " push?=" << (push_.has_value() ? "yes" : "no") + << " next?=" << (next_.has_value() ? "yes" : "no") + << " allow_push_to_pipe=" << (allow_push_to_pipe ? "yes" : "no"); switch (state_) { case State::kInitial: case State::kIdle: @@ -865,12 +861,11 @@ void BaseCallData::ReceiveMessage::WakeInsideCombiner(Flusher* flusher, p->cancelled() ? absl::CancelledError() : absl::OkStatus(), "recv_message"); } - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << base_->LogTag() - << " ReceiveMessage.WakeInsideCombiner next complete: " - << (p->has_value() ? "got message" : "end of stream") - << " new_state=" << StateString(state_); - } + GRPC_TRACE_LOG(channel, INFO) + << base_->LogTag() + << " ReceiveMessage.WakeInsideCombiner next complete: " + << (p->has_value() ? "got message" : "end of stream") + << " new_state=" << StateString(state_); } if (state_ != State::kPulledFromPipe && state_ != State::kCompletedWhilePulledFromPipe) { @@ -1079,15 +1074,14 @@ class ClientCallData::PollContext { case SendInitialState::kForwarded: { // Poll the promise once since we're waiting for it. Poll poll = self_->promise_(); - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << self_->LogTag() - << " ClientCallData.PollContext.Run: poll=" - << PollToString(poll, - [](const ServerMetadataHandle& h) { - return h->DebugString(); - }) - << "; " << self_->DebugString(); - } + GRPC_TRACE_LOG(channel, INFO) + << self_->LogTag() << " ClientCallData.PollContext.Run: poll=" + << PollToString(poll, + [](const ServerMetadataHandle& h) { + return h->DebugString(); + }) + << "; " << self_->DebugString(); + if (auto* r = poll.value_if_ready()) { auto md = std::move(*r); if (self_->send_message() != nullptr) { @@ -1749,12 +1743,10 @@ void ClientCallData::RecvTrailingMetadataReadyCallback( void ClientCallData::RecvTrailingMetadataReady(grpc_error_handle error) { Flusher flusher(this); - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << LogTag() << " ClientCallData.RecvTrailingMetadataReady " - << "recv_trailing_state=" << StateString(recv_trailing_state_) - << " error=" << error - << " md=" << recv_trailing_metadata_->DebugString(); - } + GRPC_TRACE_LOG(channel, INFO) + << LogTag() << " ClientCallData.RecvTrailingMetadataReady " + << "recv_trailing_state=" << StateString(recv_trailing_state_) + << " error=" << error << " md=" << recv_trailing_metadata_->DebugString(); // If we were cancelled prior to receiving this callback, we should simply // forward the callback up with the same error. if (recv_trailing_state_ == RecvTrailingState::kCancelled) { @@ -2119,15 +2111,13 @@ void ServerCallData::StartBatch(grpc_transport_stream_op_batch* b) { // Handle cancellation. void ServerCallData::Completed(grpc_error_handle error, bool tarpit_cancellation, Flusher* flusher) { - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - VLOG(2) << LogTag() << "ServerCallData::Completed: send_trailing_state=" - << StateString(send_trailing_state_) << " send_initial_state=" - << (send_initial_metadata_ == nullptr - ? "null" - : SendInitialMetadata::StateString( - send_initial_metadata_->state)) - << " error=" << error; - } + GRPC_TRACE_VLOG(channel, 2) + << LogTag() << "ServerCallData::Completed: send_trailing_state=" + << StateString(send_trailing_state_) << " send_initial_state=" + << (send_initial_metadata_ == nullptr + ? "null" + : SendInitialMetadata::StateString(send_initial_metadata_->state)) + << " error=" << error; // Track the latest reason for cancellation. cancelled_error_ = error; // Stop running the promise. @@ -2396,11 +2386,10 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) { flusher, send_initial_metadata_ == nullptr || send_initial_metadata_->state == SendInitialMetadata::kForwarded); - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - VLOG(2) << LogTag() << ": After send_message WakeInsideCombiner " - << DebugString() << " is_idle=" << send_message()->IsIdle() - << " is_forwarded=" << send_message()->IsForwarded(); - } + GRPC_TRACE_VLOG(channel, 2) + << LogTag() << ": After send_message WakeInsideCombiner " + << DebugString() << " is_idle=" << send_message()->IsIdle() + << " is_forwarded=" << send_message()->IsForwarded(); if (send_trailing_state_ == SendTrailingState::kQueuedBehindSendMessage && (send_message()->IsIdle() || (send_trailing_metadata_batch_->send_message && @@ -2422,34 +2411,30 @@ void ServerCallData::WakeInsideCombiner(Flusher* flusher) { if (promise_.has_value()) { Poll poll; poll = promise_(); - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << LogTag() << ": WakeInsideCombiner poll=" - << PollToString(poll, - [](const ServerMetadataHandle& h) { - return h->DebugString(); - }) - .c_str() - << "; send_initial_metadata=" - << (send_initial_metadata_ == nullptr - ? "null" - : SendInitialMetadata::StateString( - send_initial_metadata_->state)) - << " send_trailing_metadata=" - << StateString(send_trailing_state_); - } + GRPC_TRACE_LOG(channel, INFO) + << LogTag() << ": WakeInsideCombiner poll=" + << PollToString( + poll, + [](const ServerMetadataHandle& h) { return h->DebugString(); }) + .c_str() + << "; send_initial_metadata=" + << (send_initial_metadata_ == nullptr + ? "null" + : SendInitialMetadata::StateString( + send_initial_metadata_->state)) + << " send_trailing_metadata=" << StateString(send_trailing_state_); + if (send_initial_metadata_ != nullptr && send_initial_metadata_->state == SendInitialMetadata::kQueuedAndPushedToPipe) { CHECK(send_initial_metadata_->metadata_next_.has_value()); auto p = (*send_initial_metadata_->metadata_next_)(); - if (GRPC_TRACE_FLAG_ENABLED(channel)) { - LOG(INFO) << LogTag() - << ": WakeInsideCombiner send_initial_metadata poll=" - << PollToString( - p, [](const NextResult& h) { - return (*h)->DebugString(); - }); - } + GRPC_TRACE_LOG(channel, INFO) + << LogTag() << ": WakeInsideCombiner send_initial_metadata poll=" + << PollToString(p, [](const NextResult& h) { + return (*h)->DebugString(); + }); + if (auto* nr = p.value_if_ready()) { ServerMetadataHandle md = std::move(nr->value()); if (send_initial_metadata_->batch->payload->send_initial_metadata diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc index 6a2883f4883..c643b1cd817 100644 --- a/src/core/lib/compression/compression_internal.cc +++ b/src/core/lib/compression/compression_internal.cc @@ -29,7 +29,6 @@ #include "absl/strings/str_split.h" #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/config/config_vars.cc b/src/core/lib/config/config_vars.cc index c1bba0e4aaa..e0db62f5d09 100644 --- a/src/core/lib/config/config_vars.cc +++ b/src/core/lib/config/config_vars.cc @@ -72,6 +72,10 @@ ABSL_FLAG(absl::optional, grpc_not_use_system_ssl_roots, {}, "Disable loading system root certificates."); ABSL_FLAG(absl::optional, grpc_ssl_cipher_suites, {}, "A colon separated list of cipher suites to use with OpenSSL"); +ABSL_FLAG(absl::optional, grpc_cpp_experimental_disable_reflection, {}, + "EXPERIMENTAL. Only respected when there is a dependency on " + ":grpc++_reflection. If true, no reflection server will be " + "automatically added."); namespace grpc_core { @@ -89,6 +93,10 @@ ConfigVars::ConfigVars(const Overrides& overrides) not_use_system_ssl_roots_(LoadConfig( FLAGS_grpc_not_use_system_ssl_roots, "GRPC_NOT_USE_SYSTEM_SSL_ROOTS", overrides.not_use_system_ssl_roots, false)), + cpp_experimental_disable_reflection_( + LoadConfig(FLAGS_grpc_cpp_experimental_disable_reflection, + "GRPC_CPP_EXPERIMENTAL_DISABLE_REFLECTION", + overrides.cpp_experimental_disable_reflection, false)), dns_resolver_(LoadConfig(FLAGS_grpc_dns_resolver, "GRPC_DNS_RESOLVER", overrides.dns_resolver, "")), verbosity_(LoadConfig(FLAGS_grpc_verbosity, "GRPC_VERBOSITY", @@ -136,7 +144,9 @@ std::string ConfigVars::ToString() const { "\"", ", default_ssl_roots_file_path: ", "\"", absl::CEscape(DefaultSslRootsFilePath()), "\"", ", not_use_system_ssl_roots: ", NotUseSystemSslRoots() ? "true" : "false", - ", ssl_cipher_suites: ", "\"", absl::CEscape(SslCipherSuites()), "\""); + ", ssl_cipher_suites: ", "\"", absl::CEscape(SslCipherSuites()), "\"", + ", cpp_experimental_disable_reflection: ", + CppExperimentalDisableReflection() ? "true" : "false"); } } // namespace grpc_core diff --git a/src/core/lib/config/config_vars.h b/src/core/lib/config/config_vars.h index a9410d9b768..32220cd1f17 100644 --- a/src/core/lib/config/config_vars.h +++ b/src/core/lib/config/config_vars.h @@ -38,6 +38,7 @@ class GPR_DLL ConfigVars { absl::optional enable_fork_support; absl::optional abort_on_leaks; absl::optional not_use_system_ssl_roots; + absl::optional cpp_experimental_disable_reflection; absl::optional dns_resolver; absl::optional verbosity; absl::optional poll_strategy; @@ -97,6 +98,12 @@ class GPR_DLL ConfigVars { bool NotUseSystemSslRoots() const { return not_use_system_ssl_roots_; } // A colon separated list of cipher suites to use with OpenSSL absl::string_view SslCipherSuites() const { return ssl_cipher_suites_; } + // EXPERIMENTAL. Only respected when there is a dependency on + // :grpc++_reflection. If true, no reflection server will be automatically + // added. + bool CppExperimentalDisableReflection() const { + return cpp_experimental_disable_reflection_; + } private: explicit ConfigVars(const Overrides& overrides); @@ -106,6 +113,7 @@ class GPR_DLL ConfigVars { bool enable_fork_support_; bool abort_on_leaks_; bool not_use_system_ssl_roots_; + bool cpp_experimental_disable_reflection_; std::string dns_resolver_; std::string verbosity_; std::string poll_strategy_; diff --git a/src/core/lib/config/config_vars.yaml b/src/core/lib/config/config_vars.yaml index 492bfb92025..7246d8ba8ba 100644 --- a/src/core/lib/config/config_vars.yaml +++ b/src/core/lib/config/config_vars.yaml @@ -120,3 +120,7 @@ ECDHE-ECDSA-AES256-GCM-SHA384:\ ECDHE-RSA-AES128-GCM-SHA256:\ ECDHE-RSA-AES256-GCM-SHA384" +- name: cpp_experimental_disable_reflection + type: bool + description: "EXPERIMENTAL. Only respected when there is a dependency on :grpc++_reflection. If true, no reflection server will be automatically added." + default: false diff --git a/src/core/lib/config/core_configuration.cc b/src/core/lib/config/core_configuration.cc index 7baa803bb47..474ec3b56c4 100644 --- a/src/core/lib/config/core_configuration.cc +++ b/src/core/lib/config/core_configuration.cc @@ -20,7 +20,6 @@ #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/config/core_configuration.h b/src/core/lib/config/core_configuration.h index 0d8b268cdda..400278bd5ea 100644 --- a/src/core/lib/config/core_configuration.h +++ b/src/core/lib/config/core_configuration.h @@ -20,7 +20,6 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" -#include #include #include "src/core/handshaker/handshaker_registry.h" diff --git a/src/core/lib/debug/event_log.cc b/src/core/lib/debug/event_log.cc index 76edac8584b..48dbb5809a8 100644 --- a/src/core/lib/debug/event_log.cc +++ b/src/core/lib/debug/event_log.cc @@ -21,7 +21,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/event_engine/ares_resolver.cc b/src/core/lib/event_engine/ares_resolver.cc index 9824408dc4e..1cd7c73f54e 100644 --- a/src/core/lib/event_engine/ares_resolver.cc +++ b/src/core/lib/event_engine/ares_resolver.cc @@ -61,7 +61,6 @@ #include "absl/types/optional.h" #include -#include #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/address_utils/sockaddr_utils.h" diff --git a/src/core/lib/event_engine/ares_resolver.h b/src/core/lib/event_engine/ares_resolver.h index da2395b3acd..c36cf49f767 100644 --- a/src/core/lib/event_engine/ares_resolver.h +++ b/src/core/lib/event_engine/ares_resolver.h @@ -37,7 +37,6 @@ #include "absl/types/variant.h" #include -#include #include "src/core/lib/event_engine/grpc_polled_fd.h" #include "src/core/lib/event_engine/ref_counted_dns_resolver_interface.h" diff --git a/src/core/lib/event_engine/forkable.cc b/src/core/lib/event_engine/forkable.cc index c096ceb7782..0034cbbd92e 100644 --- a/src/core/lib/event_engine/forkable.cc +++ b/src/core/lib/event_engine/forkable.cc @@ -16,7 +16,6 @@ #include "absl/log/check.h" -#include #include #ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK diff --git a/src/core/lib/event_engine/forkable.h b/src/core/lib/event_engine/forkable.h index cf8edac8e64..414947b7515 100644 --- a/src/core/lib/event_engine/forkable.h +++ b/src/core/lib/event_engine/forkable.h @@ -17,7 +17,6 @@ #include #include -#include #include #include "src/core/lib/debug/trace.h" diff --git a/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc b/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc index 3f383e663bd..e573be30642 100644 --- a/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +++ b/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/src/core/lib/event_engine/posix_engine/lockfree_event.cc b/src/core/lib/event_engine/posix_engine/lockfree_event.cc index f95969bc69c..dc7900646a0 100644 --- a/src/core/lib/event_engine/posix_engine/lockfree_event.cc +++ b/src/core/lib/event_engine/posix_engine/lockfree_event.cc @@ -20,7 +20,6 @@ #include "absl/status/status.h" #include -#include #include #include "src/core/lib/event_engine/posix_engine/event_poller.h" diff --git a/src/core/lib/event_engine/posix_engine/posix_endpoint.cc b/src/core/lib/event_engine/posix_engine/posix_endpoint.cc index 41fcc89a8b8..7634bb1334b 100644 --- a/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +++ b/src/core/lib/event_engine/posix_engine/posix_endpoint.cc @@ -348,7 +348,6 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) { // We have read something in previous reads. We need to deliver those bytes // to the upper layer. if (read_bytes <= 0 && total_read_bytes >= 1) { - inq_ = 1; break; } @@ -410,6 +409,12 @@ bool PosixEndpointImpl::TcpDoRead(absl::Status& status) { if (inq_ == 0) { FinishEstimate(); + // If this is using the epoll poller, then it is edge-triggered. + // Since this read did not consume the edge (i.e., did not get EAGAIN), the + // next read on this endpoint must assume there is something to read. + // Otherwise, assuming there is nothing to read and waiting for an epoll + // edge event could cause the next read to wait indefinitely. + inq_ = 1; } DCHECK_GT(total_read_bytes, 0u); diff --git a/src/core/lib/event_engine/posix_engine/posix_endpoint.h b/src/core/lib/event_engine/posix_engine/posix_endpoint.h index 0c42a5467c0..80964556b0c 100644 --- a/src/core/lib/event_engine/posix_engine/posix_endpoint.h +++ b/src/core/lib/event_engine/posix_engine/posix_endpoint.h @@ -38,7 +38,6 @@ #include #include #include -#include #include "src/core/lib/event_engine/extensions/supports_fd.h" #include "src/core/lib/event_engine/posix.h" diff --git a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h index 15f6c5d88d7..6eb6742e339 100644 --- a/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +++ b/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/ref_counted_ptr.h" diff --git a/src/core/lib/event_engine/posix_engine/timer_manager.cc b/src/core/lib/event_engine/posix_engine/timer_manager.cc index 3ab3eb75f4c..8a0373cf86b 100644 --- a/src/core/lib/event_engine/posix_engine/timer_manager.cc +++ b/src/core/lib/event_engine/posix_engine/timer_manager.cc @@ -118,17 +118,13 @@ void TimerManager::Shutdown() { { grpc_core::MutexLock lock(&mu_); if (shutdown_) return; - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << "TimerManager::" << this << " shutting down"; - } + GRPC_TRACE_VLOG(timer, 2) << "TimerManager::" << this << " shutting down"; shutdown_ = true; // Wait on the main loop to exit. cv_wait_.Signal(); } main_loop_exit_signal_->WaitForNotification(); - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << "TimerManager::" << this << " shutdown complete"; - } + GRPC_TRACE_VLOG(timer, 2) << "TimerManager::" << this << " shutdown complete"; } TimerManager::~TimerManager() { Shutdown(); } @@ -144,9 +140,8 @@ void TimerManager::Kick() { void TimerManager::RestartPostFork() { grpc_core::MutexLock lock(&mu_); CHECK(GPR_LIKELY(shutdown_)); - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << "TimerManager::" << this << " restarting after shutdown"; - } + GRPC_TRACE_VLOG(timer, 2) + << "TimerManager::" << this << " restarting after shutdown"; shutdown_ = false; main_loop_exit_signal_.emplace(); thread_pool_->Run([this]() { MainLoop(); }); diff --git a/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc b/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc index 1171cb76624..d4cdfac8b7f 100644 --- a/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +++ b/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc @@ -24,7 +24,6 @@ #include "absl/functional/any_invocable.h" #include "absl/log/log.h" -#include #include #include diff --git a/src/core/lib/event_engine/resolved_address.cc b/src/core/lib/event_engine/resolved_address.cc index d6e01da006c..95c37586ae2 100644 --- a/src/core/lib/event_engine/resolved_address.cc +++ b/src/core/lib/event_engine/resolved_address.cc @@ -19,7 +19,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/event_engine/resolved_address_internal.h" diff --git a/src/core/lib/event_engine/slice.cc b/src/core/lib/event_engine/slice.cc index 51563f4a0c5..7d4a6c4a051 100644 --- a/src/core/lib/event_engine/slice.cc +++ b/src/core/lib/event_engine/slice.cc @@ -23,7 +23,6 @@ #include #include -#include #include #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/event_engine/thread_pool/thread_count.cc b/src/core/lib/event_engine/thread_pool/thread_count.cc index 9148b1a5d23..6fc6a43c213 100644 --- a/src/core/lib/event_engine/thread_pool/thread_count.cc +++ b/src/core/lib/event_engine/thread_pool/thread_count.cc @@ -23,7 +23,6 @@ #include "absl/time/clock.h" #include "absl/time/time.h" -#include #include #include "src/core/lib/gprpp/time.h" diff --git a/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc b/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc index 28abb9c2aa6..6116fc65853 100644 --- a/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc +++ b/src/core/lib/event_engine/windows/grpc_polled_fd_windows.cc @@ -53,14 +53,6 @@ namespace grpc_event_engine { namespace experimental { namespace { -#define GRPC_ARES_RESOLVER_TRACE_LOG(format, ...) \ - do { \ - if (GRPC_TRACE_FLAG_ENABLED(cares_resolver)) { \ - LOG(INFO) << "(EventEngine c-ares resolver) " \ - << absl::StrFormat(format, __VA_ARGS__); \ - } \ - } while (0) - constexpr int kRecvFromSourceAddrSize = 200; constexpr int kReadBufferSize = 4192; @@ -136,9 +128,9 @@ class GrpcPolledFdWindows : public GrpcPolledFd { event_engine_(event_engine) {} ~GrpcPolledFdWindows() override { - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| ~GrpcPolledFdWindows shutdown_called_: %d ", GetName(), - shutdown_called_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| ~GrpcPolledFdWindows shutdown_called_: " << shutdown_called_; grpc_core::CSliceUnref(read_buf_); grpc_core::CSliceUnref(write_buf_); CHECK(read_closure_ == nullptr); @@ -166,14 +158,16 @@ class GrpcPolledFdWindows : public GrpcPolledFd { void RegisterForOnWriteableLocked( absl::AnyInvocable write_closure) override { if (socket_type_ == SOCK_DGRAM) { - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| RegisterForOnWriteableLocked called", GetName()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| RegisterForOnWriteableLocked called"; } else { CHECK(socket_type_ == SOCK_STREAM); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| RegisterForOnWriteableLocked called tcp_write_state_: %d " - "connect_done_: %d", - GetName(), tcp_write_state_, connect_done_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| RegisterForOnWriteableLocked called tcp_write_state_: " + << static_cast(tcp_write_state_) + << " connect_done_: " << connect_done_; } CHECK(write_closure_ == nullptr); write_closure_ = std::move(write_closure); @@ -192,7 +186,8 @@ class GrpcPolledFdWindows : public GrpcPolledFd { if (!absl::IsCancelled(error)) { return false; } - GRPC_ARES_RESOLVER_TRACE_LOG("fd:|%s| ShutdownLocked", GetName()); + GRPC_TRACE_LOG(cares_resolver, INFO) << "(EventEngine c-ares resolver) fd:|" + << GetName() << "| ShutdownLocked"; shutdown_called_ = true; // The socket is disconnected and closed here since this is an external // cancel request, e.g. a timeout. c-ares shouldn't do anything on the @@ -211,10 +206,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { ares_ssize_t RecvFrom(WSAErrorContext* wsa_error_ctx, void* data, ares_socket_t data_len, int /* flags */, struct sockaddr* from, ares_socklen_t* from_len) { - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| RecvFrom called read_buf_has_data:%d Current read buf " - "length:|%d|", - GetName(), read_buf_has_data_, GRPC_SLICE_LENGTH(read_buf_)); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " RecvFrom called read_buf_has_data:" << read_buf_has_data_ + << " Current read buf length:" << GRPC_SLICE_LENGTH(read_buf_); if (!read_buf_has_data_) { wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK); return -1; @@ -241,9 +236,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { ares_ssize_t SendV(WSAErrorContext* wsa_error_ctx, const struct iovec* iov, int iov_count) { - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| SendV called connect_done_:%d wsa_connect_error_:%d", - GetName(), connect_done_, wsa_connect_error_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| SendV called connect_done_:" << connect_done_ + << " wsa_connect_error_:" << wsa_connect_error_; if (!connect_done_) { wsa_error_ctx->SetWSAError(WSAEWOULDBLOCK); return -1; @@ -296,10 +292,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { } void ContinueRegisterForOnReadableLocked() { - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| ContinueRegisterForOnReadableLocked " - "wsa_connect_error_:%d", - GetName(), wsa_connect_error_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| ContinueRegisterForOnReadableLocked wsa_connect_error_:" + << wsa_connect_error_; CHECK(connect_done_); if (wsa_connect_error_ != 0) { ScheduleAndNullReadClosure(GRPC_WSA_ERROR(wsa_connect_error_, "connect")); @@ -317,11 +313,11 @@ class GrpcPolledFdWindows : public GrpcPolledFd { winsocket_->read_info()->overlapped(), nullptr) != 0) { int wsa_last_error = WSAGetLastError(); char* msg = gpr_format_message(wsa_last_error); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| ContinueRegisterForOnReadableLocked WSARecvFrom error " - "code:|%d| " - "msg:|%s|", - GetName(), wsa_last_error, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " ContinueRegisterForOnReadableLocked WSARecvFrom error " + "code:" + << wsa_last_error << " msg:" << msg; gpr_free(msg); if (wsa_last_error != WSA_IO_PENDING) { winsocket_->UnregisterReadCallback(); @@ -333,10 +329,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { } void ContinueRegisterForOnWriteableLocked() { - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| ContinueRegisterForOnWriteableLocked " - "wsa_connect_error_:%d", - GetName(), wsa_connect_error_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| ContinueRegisterForOnWriteableLocked wsa_connect_error_:" + << wsa_connect_error_; CHECK(connect_done_); if (wsa_connect_error_ != 0) { ScheduleAndNullWriteClosure( @@ -380,12 +376,12 @@ class GrpcPolledFdWindows : public GrpcPolledFd { int out = WSASend(winsocket_->raw_socket(), &buf, 1, bytes_sent_ptr, flags, overlapped, nullptr); *wsa_error_code = WSAGetLastError(); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| SendWriteBuf WSASend buf.len:%d *bytes_sent_ptr:%d " - "overlapped:%p " - "return:%d *wsa_error_code:%d", - GetName(), buf.len, bytes_sent_ptr != nullptr ? *bytes_sent_ptr : 0, - overlapped, out, *wsa_error_code); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " SendWriteBuf WSASend buf.len:" << buf.len << " *bytes_sent_ptr:" + << (bytes_sent_ptr != nullptr ? *bytes_sent_ptr : 0) + << " overlapped:" << overlapped << " return:" << out + << " *wsa_error_code:" << *wsa_error_code; return out; } @@ -394,7 +390,8 @@ class GrpcPolledFdWindows : public GrpcPolledFd { // c-ares doesn't handle retryable errors on writes of UDP sockets. // Therefore, the sendv handler for UDP sockets must only attempt // to write everything inline. - GRPC_ARES_RESOLVER_TRACE_LOG("fd:|%s| SendVUDP called", GetName()); + GRPC_TRACE_LOG(cares_resolver, INFO) << "(EventEngine c-ares resolver) fd:|" + << GetName() << "| SendVUDP called"; CHECK_EQ(GRPC_SLICE_LENGTH(write_buf_), 0); grpc_core::CSliceUnref(write_buf_); write_buf_ = FlattenIovec(iov, iov_count); @@ -405,9 +402,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { write_buf_ = grpc_empty_slice(); wsa_error_ctx->SetWSAError(wsa_error_code); char* msg = gpr_format_message(wsa_error_code); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| SendVUDP SendWriteBuf error code:%d msg:|%s|", GetName(), - wsa_error_code, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| SendVUDP SendWriteBuf error code:" << wsa_error_code << " msg:|" + << msg << "|"; gpr_free(msg); return -1; } @@ -423,8 +421,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { // out in the background, and making further send progress in general, will // happen as long as c-ares continues to show interest in writeability on // this fd. - GRPC_ARES_RESOLVER_TRACE_LOG("fd:|%s| SendVTCP called tcp_write_state_:%d", - GetName(), tcp_write_state_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| SendVTCP called tcp_write_state_:" + << static_cast(tcp_write_state_); switch (tcp_write_state_) { case WRITE_IDLE: tcp_write_state_ = WRITE_REQUESTED; @@ -461,12 +461,12 @@ class GrpcPolledFdWindows : public GrpcPolledFd { void OnTcpConnect() { grpc_core::MutexLock lock(mu_); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:%s InnerOnTcpConnectLocked " - "pending_register_for_readable:%d" - " pending_register_for_writeable:%d", - GetName(), pending_continue_register_for_on_readable_locked_, - pending_continue_register_for_on_writeable_locked_); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " InnerOnTcpConnectLocked pending_register_for_readable:" + << pending_continue_register_for_on_readable_locked_ + << " pending_register_for_writeable:" + << pending_continue_register_for_on_writeable_locked_; CHECK(!connect_done_); connect_done_ = true; CHECK_EQ(wsa_connect_error_, 0); @@ -482,10 +482,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { if (!wsa_success) { wsa_connect_error_ = WSAGetLastError(); char* msg = gpr_format_message(wsa_connect_error_); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:%s InnerOnTcpConnectLocked WSA overlapped result code:%d " - "msg:|%s|", - GetName(), wsa_connect_error_, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " InnerOnTcpConnectLocked WSA overlapped result code:" + << wsa_connect_error_ << " msg:|" << msg << "|"; gpr_free(msg); } } @@ -499,7 +499,8 @@ class GrpcPolledFdWindows : public GrpcPolledFd { int ConnectUDP(WSAErrorContext* wsa_error_ctx, const struct sockaddr* target, ares_socklen_t target_len) { - GRPC_ARES_RESOLVER_TRACE_LOG("fd:%s ConnectUDP", GetName()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() << " ConnectUDP"; CHECK(!connect_done_); CHECK_EQ(wsa_connect_error_, 0); SOCKET s = winsocket_->raw_socket(); @@ -509,8 +510,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { wsa_error_ctx->SetWSAError(wsa_connect_error_); connect_done_ = true; char* msg = gpr_format_message(wsa_connect_error_); - GRPC_ARES_RESOLVER_TRACE_LOG("fd:%s WSAConnect error code:|%d| msg:|%s|", - GetName(), wsa_connect_error_, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " WSAConnect error code:|" << wsa_connect_error_ << "| msg:|" << msg + << "|"; gpr_free(msg); // c-ares expects a posix-style connect API return out == 0 ? 0 : -1; @@ -518,7 +521,8 @@ class GrpcPolledFdWindows : public GrpcPolledFd { int ConnectTCP(WSAErrorContext* wsa_error_ctx, const struct sockaddr* target, ares_socklen_t target_len) { - GRPC_ARES_RESOLVER_TRACE_LOG("fd:%s ConnectTCP", GetName()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() << " ConnectTCP"; LPFN_CONNECTEX ConnectEx; GUID guid = WSAID_CONNECTEX; DWORD ioctl_num_bytes; @@ -529,10 +533,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { int wsa_last_error = WSAGetLastError(); wsa_error_ctx->SetWSAError(wsa_last_error); char* msg = gpr_format_message(wsa_last_error); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:%s WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER) error code:%d " - "msg:|%s|", - GetName(), wsa_last_error, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER) error code:" + << wsa_last_error << " msg:|" << msg << "|"; gpr_free(msg); connect_done_ = true; wsa_connect_error_ = wsa_last_error; @@ -552,8 +556,9 @@ class GrpcPolledFdWindows : public GrpcPolledFd { int wsa_last_error = WSAGetLastError(); wsa_error_ctx->SetWSAError(wsa_last_error); char* msg = gpr_format_message(wsa_last_error); - GRPC_ARES_RESOLVER_TRACE_LOG("fd:%s bind error code:%d msg:|%s|", - GetName(), wsa_last_error, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " bind error code:" << wsa_last_error << " msg:|" << msg << "|"; gpr_free(msg); connect_done_ = true; wsa_connect_error_ = wsa_last_error; @@ -569,8 +574,10 @@ class GrpcPolledFdWindows : public GrpcPolledFd { int wsa_last_error = WSAGetLastError(); wsa_error_ctx->SetWSAError(wsa_last_error); char* msg = gpr_format_message(wsa_last_error); - GRPC_ARES_RESOLVER_TRACE_LOG("fd:%s ConnectEx error code:%d msg:|%s|", - GetName(), wsa_last_error, msg); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << GetName() + << " ConnectEx error code:" << wsa_last_error << " msg:|" << msg + << "|"; gpr_free(msg); if (wsa_last_error == WSA_IO_PENDING) { // c-ares only understands WSAEINPROGRESS and EWOULDBLOCK error codes on @@ -605,11 +612,12 @@ class GrpcPolledFdWindows : public GrpcPolledFd { if (winsocket_->read_info()->result().wsa_error != WSAEMSGSIZE) { error = GRPC_WSA_ERROR(winsocket_->read_info()->result().wsa_error, "OnIocpReadableInner"); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| OnIocpReadableInner winsocket_->read_info.wsa_error " - "code:|%d| msg:|%s|", - GetName(), winsocket_->read_info()->result().wsa_error, - grpc_core::StatusToString(error).c_str()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| OnIocpReadableInner winsocket_->read_info.wsa_error " + "code:|" + << winsocket_->read_info()->result().wsa_error << "| msg:|" + << grpc_core::StatusToString(error) << "|"; } } if (error.ok()) { @@ -620,34 +628,40 @@ class GrpcPolledFdWindows : public GrpcPolledFd { grpc_core::CSliceUnref(read_buf_); read_buf_ = grpc_empty_slice(); } - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| OnIocpReadable finishing. read buf length now:|%d|", GetName(), - GRPC_SLICE_LENGTH(read_buf_)); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| OnIocpReadable finishing. read buf length now:|" + << GRPC_SLICE_LENGTH(read_buf_) << "|"; ScheduleAndNullReadClosure(error); } void OnIocpWriteable() { grpc_core::MutexLock lock(mu_); - GRPC_ARES_RESOLVER_TRACE_LOG("OnIocpWriteableInner. fd:|%s|", GetName()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) OnIocpWriteableInner. fd:|" + << GetName() << "|"; CHECK(socket_type_ == SOCK_STREAM); absl::Status error; if (winsocket_->write_info()->result().wsa_error != 0) { error = GRPC_WSA_ERROR(winsocket_->write_info()->result().wsa_error, "OnIocpWriteableInner"); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| OnIocpWriteableInner. winsocket_->write_info.wsa_error " - "code:|%d| msg:|%s|", - GetName(), winsocket_->write_info()->result().wsa_error, - grpc_core::StatusToString(error).c_str()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| OnIocpWriteableInner. winsocket_->write_info.wsa_error " + "code:|" + << winsocket_->write_info()->result().wsa_error << "| msg:|" + << grpc_core::StatusToString(error) << "|"; } CHECK(tcp_write_state_ == WRITE_PENDING); if (error.ok()) { tcp_write_state_ = WRITE_WAITING_FOR_VERIFICATION_UPON_RETRY; write_buf_ = grpc_slice_sub_no_ref( write_buf_, 0, winsocket_->write_info()->result().bytes_transferred); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| OnIocpWriteableInner. bytes transferred:%d", GetName(), - winsocket_->write_info()->result().bytes_transferred); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:|" << GetName() + << "| OnIocpWriteableInner. bytes transferred:" + << winsocket_->write_info()->result().bytes_transferred; + } else { grpc_core::CSliceUnref(write_buf_); write_buf_ = grpc_empty_slice(); @@ -694,8 +708,10 @@ class CustomSockFuncs { public: static ares_socket_t Socket(int af, int type, int protocol, void* user_data) { if (type != SOCK_DGRAM && type != SOCK_STREAM) { - GRPC_ARES_RESOLVER_TRACE_LOG("Socket called with invalid socket type:%d", - type); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) Socket called with invalid socket " + "type:" + << type; return INVALID_SOCKET; } GrpcPolledFdFactoryWindows* self = @@ -703,24 +719,26 @@ class CustomSockFuncs { SOCKET s = WSASocket(af, type, protocol, nullptr, 0, IOCP::GetDefaultSocketFlags()); if (s == INVALID_SOCKET) { - GRPC_ARES_RESOLVER_TRACE_LOG( - "WSASocket failed with params af:%d type:%d protocol:%d", af, type, - protocol); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) WSASocket failed with params af:" + << af << " type:" << type << " protocol:" << protocol; return INVALID_SOCKET; } if (type == SOCK_STREAM) { absl::Status error = PrepareSocket(s); if (!error.ok()) { - GRPC_ARES_RESOLVER_TRACE_LOG("WSAIoctl failed with error: %s", - grpc_core::StatusToString(error).c_str()); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) WSAIoctl failed with error: " + << grpc_core::StatusToString(error); return INVALID_SOCKET; } } auto polled_fd = std::make_unique( self->iocp_->Watch(s), self->mu_, af, type, self->event_engine_); - GRPC_ARES_RESOLVER_TRACE_LOG( - "fd:|%s| created with params af:%d type:%d protocol:%d", - polled_fd->GetName(), af, type, protocol); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) fd:" << polled_fd->GetName() + << " created with params af:" << af << " type:" << type + << " protocol:" << protocol; CHECK(self->sockets_.insert({s, std::move(polled_fd)}).second); return s; } @@ -758,7 +776,9 @@ class CustomSockFuncs { } static int CloseSocket(SOCKET s, void*) { - GRPC_ARES_RESOLVER_TRACE_LOG("c-ares socket: %d CloseSocket", s); + GRPC_TRACE_LOG(cares_resolver, INFO) + << "(EventEngine c-ares resolver) c-ares socket: " << s + << " CloseSocket"; return 0; } }; diff --git a/src/core/lib/experiments/experiments.yaml b/src/core/lib/experiments/experiments.yaml index 13c466a7a34..fb2c0447a65 100644 --- a/src/core/lib/experiments/experiments.yaml +++ b/src/core/lib/experiments/experiments.yaml @@ -148,7 +148,7 @@ test_tags: [] - name: unconstrained_max_quota_buffer_size description: Discard the cap on the max free pool size for one memory allocator - expiry: 2024/09/01 + expiry: 2024/09/09 owner: ctiller@google.com test_tags: [resource_quota_test] - name: work_serializer_clears_time_cache diff --git a/src/core/lib/gprpp/chunked_vector.h b/src/core/lib/gprpp/chunked_vector.h index b60bdac65ad..a90f455d46c 100644 --- a/src/core/lib/gprpp/chunked_vector.h +++ b/src/core/lib/gprpp/chunked_vector.h @@ -21,7 +21,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/manual_constructor.h" diff --git a/src/core/lib/gprpp/down_cast.h b/src/core/lib/gprpp/down_cast.h index f9f72509ad9..e7c05bf4b78 100644 --- a/src/core/lib/gprpp/down_cast.h +++ b/src/core/lib/gprpp/down_cast.h @@ -20,7 +20,6 @@ #include "absl/base/config.h" #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/gprpp/host_port.cc b/src/core/lib/gprpp/host_port.cc index 7e5ae646ca7..fec43151109 100644 --- a/src/core/lib/gprpp/host_port.cc +++ b/src/core/lib/gprpp/host_port.cc @@ -24,7 +24,6 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/gprpp/load_file.cc b/src/core/lib/gprpp/load_file.cc index 01cb7798de2..dd15004570a 100644 --- a/src/core/lib/gprpp/load_file.cc +++ b/src/core/lib/gprpp/load_file.cc @@ -24,7 +24,6 @@ #include #include -#include #include namespace grpc_core { diff --git a/src/core/lib/gprpp/mpscq.h b/src/core/lib/gprpp/mpscq.h index c33d34ffa13..f6306d46822 100644 --- a/src/core/lib/gprpp/mpscq.h +++ b/src/core/lib/gprpp/mpscq.h @@ -23,7 +23,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/lib/gprpp/single_set_ptr.h b/src/core/lib/gprpp/single_set_ptr.h index a8e1f278ba4..016967b5f49 100644 --- a/src/core/lib/gprpp/single_set_ptr.h +++ b/src/core/lib/gprpp/single_set_ptr.h @@ -20,7 +20,6 @@ #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/gprpp/status_helper.cc b/src/core/lib/gprpp/status_helper.cc index a2a5160e2f1..b3563592b55 100644 --- a/src/core/lib/gprpp/status_helper.cc +++ b/src/core/lib/gprpp/status_helper.cc @@ -35,7 +35,6 @@ #include "upb/base/string_view.h" #include "upb/mem/arena.hpp" -#include #include #include "src/core/lib/slice/percent_encoding.h" diff --git a/src/core/lib/gprpp/sync.h b/src/core/lib/gprpp/sync.h index 16efe619cd5..3b80a7bc91e 100644 --- a/src/core/lib/gprpp/sync.h +++ b/src/core/lib/gprpp/sync.h @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include "absl/synchronization/mutex.h" -#include #include #include diff --git a/src/core/lib/gprpp/thd.h b/src/core/lib/gprpp/thd.h index 44ff3b22e3c..6662610cd68 100644 --- a/src/core/lib/gprpp/thd.h +++ b/src/core/lib/gprpp/thd.h @@ -29,7 +29,6 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" -#include #include #include diff --git a/src/core/lib/gprpp/time.h b/src/core/lib/gprpp/time.h index 2f1be5fa6f3..0e57349b781 100644 --- a/src/core/lib/gprpp/time.h +++ b/src/core/lib/gprpp/time.h @@ -24,7 +24,6 @@ #include "absl/types/optional.h" #include -#include #include #include diff --git a/src/core/lib/gprpp/time_util.cc b/src/core/lib/gprpp/time_util.cc index 3a1cd376370..94ca4e08d88 100644 --- a/src/core/lib/gprpp/time_util.cc +++ b/src/core/lib/gprpp/time_util.cc @@ -21,7 +21,6 @@ #include "absl/log/check.h" -#include #include #include diff --git a/src/core/lib/gprpp/windows/directory_reader.cc b/src/core/lib/gprpp/windows/directory_reader.cc index 3d45ee6532d..2deedb8ca5a 100644 --- a/src/core/lib/gprpp/windows/directory_reader.cc +++ b/src/core/lib/gprpp/windows/directory_reader.cc @@ -30,8 +30,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include - #include "src/core/lib/gprpp/directory_reader.h" namespace grpc_core { diff --git a/src/core/lib/gprpp/windows/thd.cc b/src/core/lib/gprpp/windows/thd.cc index b5c6368cf40..1e754e916b9 100644 --- a/src/core/lib/gprpp/windows/thd.cc +++ b/src/core/lib/gprpp/windows/thd.cc @@ -27,7 +27,6 @@ #include "absl/log/log.h" #include -#include #include #include #include diff --git a/src/core/lib/iomgr/buffer_list.cc b/src/core/lib/iomgr/buffer_list.cc index aedb4227073..dd59b4e7d49 100644 --- a/src/core/lib/iomgr/buffer_list.cc +++ b/src/core/lib/iomgr/buffer_list.cc @@ -20,7 +20,6 @@ #include "absl/log/log.h" -#include #include #include diff --git a/src/core/lib/iomgr/call_combiner.h b/src/core/lib/iomgr/call_combiner.h index d2c7c0c9851..87ad024880f 100644 --- a/src/core/lib/iomgr/call_combiner.h +++ b/src/core/lib/iomgr/call_combiner.h @@ -166,14 +166,12 @@ class CallCombinerClosureList { GRPC_CALL_COMBINER_START(call_combiner, closure.closure, closure.error, closure.reason); } - if (GRPC_TRACE_FLAG_ENABLED(call_combiner)) { - LOG(INFO) << "CallCombinerClosureList executing closure while already " - "holding call_combiner " - << call_combiner - << ": closure=" << closures_[0].closure->DebugString() - << " error=" << StatusToString(closures_[0].error) - << " reason=" << closures_[0].reason; - } + GRPC_TRACE_LOG(call_combiner, INFO) + << "CallCombinerClosureList executing closure while already " + "holding call_combiner " + << call_combiner << ": closure=" << closures_[0].closure->DebugString() + << " error=" << StatusToString(closures_[0].error) + << " reason=" << closures_[0].reason; // This will release the call combiner. ExecCtx::Run(DEBUG_LOCATION, closures_[0].closure, closures_[0].error); closures_.clear(); diff --git a/src/core/lib/iomgr/cfstream_handle.cc b/src/core/lib/iomgr/cfstream_handle.cc index de9810ad2c8..55604791a7b 100644 --- a/src/core/lib/iomgr/cfstream_handle.cc +++ b/src/core/lib/iomgr/cfstream_handle.cc @@ -65,10 +65,9 @@ void CFStreamHandle::ReadCallback(CFReadStreamRef stream, grpc_error_handle error; CFErrorRef stream_error; CFStreamHandle* handle = static_cast(client_callback_info); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CFStream ReadCallback (" << handle << ", " << stream << ", " - << type << ", " << client_callback_info << ")"; - } + GRPC_TRACE_VLOG(tcp, 2) << "CFStream ReadCallback (" << handle << ", " + << stream << ", " << type << ", " + << client_callback_info << ")"; switch (type) { case kCFStreamEventOpenCompleted: handle->open_event_.SetReady(); @@ -99,10 +98,9 @@ void CFStreamHandle::WriteCallback(CFWriteStreamRef stream, grpc_error_handle error; CFErrorRef stream_error; CFStreamHandle* handle = static_cast(clientCallBackInfo); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CFStream WriteCallback (" << handle << ", " << stream << ", " - << type << ", " << clientCallBackInfo << ")"; - } + GRPC_TRACE_VLOG(tcp, 2) << "CFStream WriteCallback (" << handle << ", " + << stream << ", " << type << ", " + << clientCallBackInfo << ")"; switch (type) { case kCFStreamEventOpenCompleted: handle->open_event_.SetReady(); diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index bebdb41a0a4..9f8a22493d3 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -292,18 +292,15 @@ class Closure { return; } #ifndef NDEBUG - if (GRPC_TRACE_FLAG_ENABLED(closure)) { - VLOG(2) << "running closure " << closure << ": created [" - << closure->file_created << ":" << closure->line_created - << "]: run [" << location.file() << ":" << location.line() << "]"; - } + GRPC_TRACE_VLOG(closure, 2) + << "running closure " << closure << ": created [" + << closure->file_created << ":" << closure->line_created << "]: run [" + << location.file() << ":" << location.line() << "]"; CHECK_NE(closure->cb, nullptr); #endif closure->cb(closure->cb_arg, error); #ifndef NDEBUG - if (GRPC_TRACE_FLAG_ENABLED(closure)) { - VLOG(2) << "closure " << closure << " finished"; - } + GRPC_TRACE_VLOG(closure, 2) << "closure " << closure << " finished"; #endif } }; diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc index 7032c40f768..56db07f5627 100644 --- a/src/core/lib/iomgr/combiner.cc +++ b/src/core/lib/iomgr/combiner.cc @@ -71,14 +71,12 @@ static void start_destroy(grpc_core::Combiner* lock) { } #ifndef NDEBUG -#define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ - if (GRPC_TRACE_FLAG_ENABLED(combiner)) { \ - VLOG(2).AtLocation(file, line) \ - << "C:" << lock << " " << (op) << " " \ - << gpr_atm_no_barrier_load(&lock->refs.count) << " --> " \ - << gpr_atm_no_barrier_load(&lock->refs.count) + (delta) << " " \ - << reason; \ - } +#define GRPC_COMBINER_DEBUG_SPAM(op, delta) \ + GRPC_TRACE_VLOG(combiner, 2).AtLocation(file, line) \ + << "C:" << lock << " " << (op) << " " \ + << gpr_atm_no_barrier_load(&lock->refs.count) << " --> " \ + << gpr_atm_no_barrier_load(&lock->refs.count) + (delta) << " " \ + << reason; #else #define GRPC_COMBINER_DEBUG_SPAM(op, delta) #endif diff --git a/src/core/lib/iomgr/endpoint_cfstream.cc b/src/core/lib/iomgr/endpoint_cfstream.cc index dbe123a554e..c542c6ae6bc 100644 --- a/src/core/lib/iomgr/endpoint_cfstream.cc +++ b/src/core/lib/iomgr/endpoint_cfstream.cc @@ -129,11 +129,10 @@ static void CallReadCb(CFStreamEndpoint* ep, grpc_error_handle error) { } static void CallWriteCb(CFStreamEndpoint* ep, grpc_error_handle error) { - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CFStream endpoint:" << ep << " call_write_cb " << ep->write_cb - << " " << ep->write_cb->cb << ":" << ep->write_cb->cb_arg; - VLOG(2) << "write: error=" << grpc_core::StatusToString(error); - } + GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep << " call_write_cb " + << ep->write_cb << " " << ep->write_cb->cb << ":" + << ep->write_cb->cb_arg << "write: error=" + << grpc_core::StatusToString(error); grpc_closure* cb = ep->write_cb; ep->write_cb = nullptr; ep->write_slices = nullptr; @@ -233,10 +232,9 @@ static void CFStreamRead(grpc_endpoint* ep, grpc_slice_buffer* slices, grpc_closure* cb, bool /*urgent*/, int /*min_progress_size*/) { CFStreamEndpoint* ep_impl = reinterpret_cast(ep); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CFStream endpoint:" << ep_impl << " read (" << slices << ", " - << cb << ") length:" << slices->length; - } + GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep_impl << " read (" + << slices << ", " << cb + << ") length:" << slices->length; CHECK_EQ(ep_impl->read_cb, nullptr); ep_impl->read_cb = cb; ep_impl->read_slices = slices; @@ -251,10 +249,9 @@ static void CFStreamWrite(grpc_endpoint* ep, grpc_slice_buffer* slices, grpc_closure* cb, void* /*arg*/, int /*max_frame_size*/) { CFStreamEndpoint* ep_impl = reinterpret_cast(ep); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CFStream endpoint:" << ep_impl << " write (" << slices << ", " - << cb << ") length:" << slices->length; - } + GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep_impl << " write (" + << slices << ", " << cb + << ") length:" << slices->length; CHECK_EQ(ep_impl->write_cb, nullptr); ep_impl->write_cb = cb; ep_impl->write_slices = slices; @@ -308,11 +305,9 @@ grpc_endpoint* grpc_cfstream_endpoint_create(CFReadStreamRef read_stream, const char* peer_string, CFStreamHandle* stream_sync) { CFStreamEndpoint* ep_impl = new CFStreamEndpoint; - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CFStream endpoint:" << ep_impl - << " create readStream:" << read_stream - << " writeStream: " << write_stream; - } + GRPC_TRACE_VLOG(tcp, 2) << "CFStream endpoint:" << ep_impl + << " create readStream:" << read_stream + << " writeStream: " << write_stream; ep_impl->base.vtable = &vtable; gpr_ref_init(&ep_impl->refcount, 1); ep_impl->read_stream = read_stream; diff --git a/src/core/lib/iomgr/endpoint_pair_posix.cc b/src/core/lib/iomgr/endpoint_pair_posix.cc index 42d0e7acdb6..4043f9a8120 100644 --- a/src/core/lib/iomgr/endpoint_pair_posix.cc +++ b/src/core/lib/iomgr/endpoint_pair_posix.cc @@ -34,7 +34,6 @@ #include "absl/strings/str_cat.h" #include -#include #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 4d38a90c251..b31173121f2 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 278e544bb79..c2c60e9663a 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -360,9 +360,8 @@ static grpc_fd* fd_create(int fd, const char* name, bool track_err) { grpc_iomgr_register_object(&new_fd->iomgr_object, fd_name.c_str()); fork_fd_list_add_grpc_fd(new_fd); #ifndef NDEBUG - if (GRPC_TRACE_FLAG_ENABLED(fd_refcount)) { - VLOG(2) << "FD " << fd << " " << new_fd << " create " << fd_name; - } + GRPC_TRACE_VLOG(fd_refcount, 2) + << "FD " << fd << " " << new_fd << " create " << fd_name; #endif struct epoll_event ev; @@ -831,12 +830,11 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, grpc_core::ExecCtx::Get()->InvalidateNow(); } - if (GRPC_TRACE_FLAG_ENABLED(polling)) { - LOG(INFO) << "PS:" << pollset << " BEGIN_DONE:" << worker - << " kick_state=" << kick_state_string(worker->state) - << " shutdown=" << pollset->shutting_down - << " kicked_without_poller: " << pollset->kicked_without_poller; - } + GRPC_TRACE_LOG(polling, INFO) + << "PS:" << pollset << " BEGIN_DONE:" << worker + << " kick_state=" << kick_state_string(worker->state) + << " shutdown=" << pollset->shutting_down + << " kicked_without_poller: " << pollset->kicked_without_poller; // We release pollset lock in this function at a couple of places: // 1. Briefly when assigning pollset to a neighborhood diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 9d0728a97d0..a95adea7c85 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -332,12 +332,11 @@ static void fork_fd_list_add_wakeup_fd(grpc_cached_wakeup_fd* fd) { #define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__) static void ref_by(grpc_fd* fd, int n, const char* reason, const char* file, int line) { - if (GRPC_TRACE_FLAG_ENABLED(fd_refcount)) { - VLOG(2) << "FD " << fd->fd << " " << fd << " ref " << n << " " - << gpr_atm_no_barrier_load(&fd->refst) << " -> " - << gpr_atm_no_barrier_load(&fd->refst) + n << " [" << reason << "; " - << file << ":" << line << "]"; - } + GRPC_TRACE_VLOG(fd_refcount, 2) + << "FD " << fd->fd << " " << fd << " ref " << n << " " + << gpr_atm_no_barrier_load(&fd->refst) << " -> " + << gpr_atm_no_barrier_load(&fd->refst) + n << " [" << reason << "; " + << file << ":" << line << "]"; #else #define REF_BY(fd, n, reason) \ do { \ @@ -357,12 +356,11 @@ static void ref_by(grpc_fd* fd, int n) { #ifndef NDEBUG static void unref_by(grpc_fd* fd, int n, const char* reason, const char* file, int line) { - if (GRPC_TRACE_FLAG_ENABLED(fd_refcount)) { - VLOG(2) << "FD " << fd->fd << " " << fd << " unref " << n << " " - << gpr_atm_no_barrier_load(&fd->refst) << " -> " - << gpr_atm_no_barrier_load(&fd->refst) - n << " [" << reason << "; " - << file << ":" << line << "]"; - } + GRPC_TRACE_VLOG(fd_refcount, 2) + << "FD " << fd->fd << " " << fd << " unref " << n << " " + << gpr_atm_no_barrier_load(&fd->refst) << " -> " + << gpr_atm_no_barrier_load(&fd->refst) - n << " [" << reason << "; " + << file << ":" << line << "]"; #else static void unref_by(grpc_fd* fd, int n) { #endif @@ -1062,12 +1060,11 @@ static grpc_error_handle pollset_work(grpc_pollset* pollset, } fd_end_poll(&watchers[i], 0, 0); } else { - if (GRPC_TRACE_FLAG_ENABLED(polling)) { - LOG(INFO) << pollset << " got_event: " << pfds[i].fd - << " r:" << ((pfds[i].revents & POLLIN_CHECK) != 0) - << " w:" << ((pfds[i].revents & POLLOUT_CHECK) != 0) - << " [" << pfds[i].revents << "]"; - } + GRPC_TRACE_LOG(polling, INFO) + << pollset << " got_event: " << pfds[i].fd + << " r:" << ((pfds[i].revents & POLLIN_CHECK) != 0) + << " w:" << ((pfds[i].revents & POLLOUT_CHECK) != 0) << " [" + << pfds[i].revents << "]"; // This is a mitigation to prevent poll() from spinning on a //* POLLHUP https://github.com/grpc/grpc/pull/13665 // diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index d23c976ca46..70ee372c4fd 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -30,7 +30,6 @@ #include "absl/strings/str_split.h" #include -#include #include #include "src/core/lib/config/config_vars.h" diff --git a/src/core/lib/iomgr/event_engine_shims/closure.cc b/src/core/lib/iomgr/event_engine_shims/closure.cc index e38b295bbaf..8a362210b80 100644 --- a/src/core/lib/iomgr/event_engine_shims/closure.cc +++ b/src/core/lib/iomgr/event_engine_shims/closure.cc @@ -35,18 +35,16 @@ void RunEventEngineClosure(grpc_closure* closure, grpc_error_handle error) { grpc_core::ExecCtx exec_ctx; #ifndef NDEBUG closure->scheduled = false; - if (GRPC_TRACE_FLAG_ENABLED(closure)) { - VLOG(2) << "EventEngine: running closure " << closure << ": created [" - << closure->file_created << ":" << closure->line_created - << "]: " << (closure->run ? "run" : "scheduled") << " [" - << closure->file_initiated << ":" << closure->line_initiated << "]"; - } + GRPC_TRACE_VLOG(closure, 2) + << "EventEngine: running closure " << closure << ": created [" + << closure->file_created << ":" << closure->line_created + << "]: " << (closure->run ? "run" : "scheduled") << " [" + << closure->file_initiated << ":" << closure->line_initiated << "]"; #endif closure->cb(closure->cb_arg, error); #ifndef NDEBUG - if (GRPC_TRACE_FLAG_ENABLED(closure)) { - VLOG(2) << "EventEngine: closure " << closure << " finished"; - } + GRPC_TRACE_VLOG(closure, 2) + << "EventEngine: closure " << closure << " finished"; #endif } diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index 0a3ae056eb8..804ae6f6494 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -32,21 +32,18 @@ static void exec_ctx_run(grpc_closure* closure) { #ifndef NDEBUG closure->scheduled = false; - if (GRPC_TRACE_FLAG_ENABLED(closure)) { - VLOG(2) << "running closure " << closure << ": created [" - << closure->file_created << ":" << closure->line_created - << "]: " << (closure->run ? "run" : "scheduled") << " [" - << closure->file_initiated << ":" << closure->line_initiated << "]"; - } + GRPC_TRACE_VLOG(closure, 2) + << "running closure " << closure << ": created [" << closure->file_created + << ":" << closure->line_created + << "]: " << (closure->run ? "run" : "scheduled") << " [" + << closure->file_initiated << ":" << closure->line_initiated << "]"; #endif grpc_error_handle error = grpc_core::internal::StatusMoveFromHeapPtr(closure->error_data.error); closure->error_data.error = 0; closure->cb(closure->cb_arg, std::move(error)); #ifndef NDEBUG - if (GRPC_TRACE_FLAG_ENABLED(closure)) { - VLOG(2) << "closure " << closure << " finished"; - } + GRPC_TRACE_VLOG(closure, 2) << "closure " << closure << " finished"; #endif } diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h index ef336aa6d56..ce41e5b92b3 100644 --- a/src/core/lib/iomgr/exec_ctx.h +++ b/src/core/lib/iomgr/exec_ctx.h @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc index a47d80acc3e..02f21cf796b 100644 --- a/src/core/lib/iomgr/executor.cc +++ b/src/core/lib/iomgr/executor.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include diff --git a/src/core/lib/iomgr/fork_windows.cc b/src/core/lib/iomgr/fork_windows.cc index 0e1583173d3..84d0609e2a0 100644 --- a/src/core/lib/iomgr/fork_windows.cc +++ b/src/core/lib/iomgr/fork_windows.cc @@ -25,7 +25,6 @@ #include "absl/log/log.h" #include -#include // // NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK diff --git a/src/core/lib/iomgr/internal_errqueue.cc b/src/core/lib/iomgr/internal_errqueue.cc index 5223687a439..dbf001b4cc6 100644 --- a/src/core/lib/iomgr/internal_errqueue.cc +++ b/src/core/lib/iomgr/internal_errqueue.cc @@ -16,7 +16,6 @@ #include "absl/log/log.h" -#include #include #include "src/core/lib/iomgr/port.h" diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index 9d6477aaaaf..bc931a4f44b 100644 --- a/src/core/lib/iomgr/iocp_windows.cc +++ b/src/core/lib/iomgr/iocp_windows.cc @@ -30,7 +30,6 @@ #include "absl/log/log.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/iomgr_windows.cc b/src/core/lib/iomgr/iomgr_windows.cc index 21570d9033f..ae35534186f 100644 --- a/src/core/lib/iomgr/iomgr_windows.cc +++ b/src/core/lib/iomgr/iomgr_windows.cc @@ -24,8 +24,6 @@ #include "absl/log/check.h" -#include - #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/iocp_windows.h" diff --git a/src/core/lib/iomgr/lockfree_event.cc b/src/core/lib/iomgr/lockfree_event.cc index ab4f5639796..51e46ab9764 100644 --- a/src/core/lib/iomgr/lockfree_event.cc +++ b/src/core/lib/iomgr/lockfree_event.cc @@ -95,10 +95,8 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) { // sure that the shutdown error has been initialized properly before us // referencing it. gpr_atm curr = gpr_atm_acq_load(&state_); - if (GRPC_TRACE_FLAG_ENABLED(polling)) { - VLOG(2) << "LockfreeEvent::NotifyOn: " << this << " curr=" << curr - << " closure=" << closure; - } + GRPC_TRACE_VLOG(polling, 2) << "LockfreeEvent::NotifyOn: " << this + << " curr=" << curr << " closure=" << closure; switch (curr) { case kClosureNotReady: { // kClosureNotReady -> . @@ -163,10 +161,9 @@ bool LockfreeEvent::SetShutdown(grpc_error_handle shutdown_error) { while (true) { gpr_atm curr = gpr_atm_no_barrier_load(&state_); - if (GRPC_TRACE_FLAG_ENABLED(polling)) { - VLOG(2) << "LockfreeEvent::SetShutdown: " << &state_ << " curr=" << curr - << " err=" << StatusToString(shutdown_error); - } + GRPC_TRACE_VLOG(polling, 2) + << "LockfreeEvent::SetShutdown: " << &state_ << " curr=" << curr + << " err=" << StatusToString(shutdown_error); switch (curr) { case kClosureReady: case kClosureNotReady: @@ -212,9 +209,8 @@ void LockfreeEvent::SetReady() { while (true) { gpr_atm curr = gpr_atm_no_barrier_load(&state_); - if (GRPC_TRACE_FLAG_ENABLED(polling)) { - VLOG(2) << "LockfreeEvent::SetReady: " << &state_ << " curr=" << curr; - } + GRPC_TRACE_VLOG(polling, 2) + << "LockfreeEvent::SetReady: " << &state_ << " curr=" << curr; switch (curr) { case kClosureReady: { diff --git a/src/core/lib/iomgr/polling_entity.cc b/src/core/lib/iomgr/polling_entity.cc index 8b225444c7e..2a3e9c77060 100644 --- a/src/core/lib/iomgr/polling_entity.cc +++ b/src/core/lib/iomgr/polling_entity.cc @@ -22,7 +22,6 @@ #include "absl/strings/str_format.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/pollset_windows.cc b/src/core/lib/iomgr/pollset_windows.cc index c42d83da495..32925c61a93 100644 --- a/src/core/lib/iomgr/pollset_windows.cc +++ b/src/core/lib/iomgr/pollset_windows.cc @@ -22,8 +22,6 @@ #ifdef GRPC_WINSOCK_SOCKET -#include - #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/iocp_windows.h" diff --git a/src/core/lib/iomgr/resolve_address.cc b/src/core/lib/iomgr/resolve_address.cc index 24cdcf1c6d0..db7b891bcc7 100644 --- a/src/core/lib/iomgr/resolve_address.cc +++ b/src/core/lib/iomgr/resolve_address.cc @@ -21,7 +21,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc index 8cad6517c1a..f890a349b97 100644 --- a/src/core/lib/iomgr/resolve_address_posix.cc +++ b/src/core/lib/iomgr/resolve_address_posix.cc @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/src/core/lib/iomgr/resolve_address_windows.cc b/src/core/lib/iomgr/resolve_address_windows.cc index 054f7423816..105dcc85744 100644 --- a/src/core/lib/iomgr/resolve_address_windows.cc +++ b/src/core/lib/iomgr/resolve_address_windows.cc @@ -28,7 +28,6 @@ #include "absl/strings/str_format.h" #include -#include #include #include #include diff --git a/src/core/lib/iomgr/sockaddr_utils_posix.cc b/src/core/lib/iomgr/sockaddr_utils_posix.cc index d1981a43196..62d5bcac84d 100644 --- a/src/core/lib/iomgr/sockaddr_utils_posix.cc +++ b/src/core/lib/iomgr/sockaddr_utils_posix.cc @@ -40,7 +40,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/socket_mutator.cc b/src/core/lib/iomgr/socket_mutator.cc index 428cc0bdf3f..f77661969ce 100644 --- a/src/core/lib/iomgr/socket_mutator.cc +++ b/src/core/lib/iomgr/socket_mutator.cc @@ -19,7 +19,6 @@ #include "src/core/lib/iomgr/socket_mutator.h" #include -#include #include #include diff --git a/src/core/lib/iomgr/socket_utils_linux.cc b/src/core/lib/iomgr/socket_utils_linux.cc index 2e64c21e0b5..d699a1d5fe5 100644 --- a/src/core/lib/iomgr/socket_utils_linux.cc +++ b/src/core/lib/iomgr/socket_utils_linux.cc @@ -25,8 +25,6 @@ #include #include -#include - #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils_posix.h" diff --git a/src/core/lib/iomgr/socket_utils_posix.cc b/src/core/lib/iomgr/socket_utils_posix.cc index b34f3749c7f..88b5d9a6bcf 100644 --- a/src/core/lib/iomgr/socket_utils_posix.cc +++ b/src/core/lib/iomgr/socket_utils_posix.cc @@ -28,7 +28,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" diff --git a/src/core/lib/iomgr/socket_utils_windows.cc b/src/core/lib/iomgr/socket_utils_windows.cc index 8b0e8f45f7c..195a838598b 100644 --- a/src/core/lib/iomgr/socket_utils_windows.cc +++ b/src/core/lib/iomgr/socket_utils_windows.cc @@ -22,8 +22,6 @@ #ifdef GRPC_WINDOWS_SOCKETUTILS -#include - #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils.h" diff --git a/src/core/lib/iomgr/tcp_client_cfstream.cc b/src/core/lib/iomgr/tcp_client_cfstream.cc index 06c6a6fb486..f3228ad20ca 100644 --- a/src/core/lib/iomgr/tcp_client_cfstream.cc +++ b/src/core/lib/iomgr/tcp_client_cfstream.cc @@ -78,10 +78,8 @@ static void CFStreamConnectCleanup(CFStreamConnect* connect) { static void OnAlarm(void* arg, grpc_error_handle error) { CFStreamConnect* connect = static_cast(arg); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CLIENT_CONNECT :" << connect - << " OnAlarm, error:" << grpc_core::StatusToString(error); - } + GRPC_TRACE_VLOG(tcp, 2) << "CLIENT_CONNECT :" << connect << " OnAlarm, error:" + << grpc_core::StatusToString(error); gpr_mu_lock(&connect->mu); grpc_closure* closure = connect->closure; connect->closure = nil; @@ -99,10 +97,8 @@ static void OnAlarm(void* arg, grpc_error_handle error) { static void OnOpen(void* arg, grpc_error_handle error) { CFStreamConnect* connect = static_cast(arg); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CLIENT_CONNECT :" << connect - << " OnOpen, error:" << grpc_core::StatusToString(error); - } + GRPC_TRACE_VLOG(tcp, 2) << "CLIENT_CONNECT :" << connect << " OnOpen, error:" + << grpc_core::StatusToString(error); gpr_mu_lock(&connect->mu); grpc_timer_cancel(&connect->alarm); grpc_closure* closure = connect->closure; @@ -173,10 +169,9 @@ static int64_t CFStreamClientConnect( gpr_ref_init(&connect->refcount, 1); gpr_mu_init(&connect->mu); - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - VLOG(2) << "CLIENT_CONNECT: " << connect << ", " << connect->addr_name - << ": asynchronously connecting"; - } + GRPC_TRACE_VLOG(tcp, 2) << "CLIENT_CONNECT: " << connect << ", " + << connect->addr_name + << ": asynchronously connecting"; CFReadStreamRef read_stream; CFWriteStreamRef write_stream; diff --git a/src/core/lib/iomgr/tcp_client_windows.cc b/src/core/lib/iomgr/tcp_client_windows.cc index bedf1cca5b1..4086d45a577 100644 --- a/src/core/lib/iomgr/tcp_client_windows.cc +++ b/src/core/lib/iomgr/tcp_client_windows.cc @@ -29,7 +29,6 @@ #include #include #include -#include #include #include "src/core/lib/address_utils/sockaddr_utils.h" diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index d0c68d40c7f..37e409d1235 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -1255,9 +1255,8 @@ static bool tcp_write_with_timestamps(grpc_tcp* tcp, struct msghdr* msg, uint32_t opt = grpc_core::kTimestampingSocketOptions; if (setsockopt(tcp->fd, SOL_SOCKET, SO_TIMESTAMPING, static_cast(&opt), sizeof(opt)) != 0) { - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - LOG(ERROR) << "Failed to set timestamping options on the socket."; - } + GRPC_TRACE_LOG(tcp, ERROR) + << "Failed to set timestamping options on the socket."; return false; } tcp->bytes_counter = -1; @@ -1341,9 +1340,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, auto next_cmsg = CMSG_NXTHDR(msg, cmsg); cmsghdr* opt_stats = nullptr; if (next_cmsg == nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - LOG(ERROR) << "Received timestamp without extended error"; - } + GRPC_TRACE_LOG(tcp, ERROR) << "Received timestamp without extended error"; return cmsg; } @@ -1353,9 +1350,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, opt_stats = next_cmsg; next_cmsg = CMSG_NXTHDR(msg, opt_stats); if (next_cmsg == nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - LOG(ERROR) << "Received timestamp without extended error"; - } + GRPC_TRACE_LOG(tcp, ERROR) << "Received timestamp without extended error"; return opt_stats; } } @@ -1363,9 +1358,7 @@ struct cmsghdr* process_timestamp(grpc_tcp* tcp, msghdr* msg, if (!(next_cmsg->cmsg_level == SOL_IP || next_cmsg->cmsg_level == SOL_IPV6) || !(next_cmsg->cmsg_type == IP_RECVERR || next_cmsg->cmsg_type == IPV6_RECVERR)) { - if (GRPC_TRACE_FLAG_ENABLED(tcp)) { - LOG(ERROR) << "Unexpected control message"; - } + GRPC_TRACE_LOG(tcp, ERROR) << "Unexpected control message"; return cmsg; } diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc index f931658c670..7b1c9d205c2 100644 --- a/src/core/lib/iomgr/timer_generic.cc +++ b/src/core/lib/iomgr/timer_generic.cc @@ -334,12 +334,11 @@ static void timer_init(grpc_timer* timer, grpc_core::Timestamp deadline, timer->hash_table_next = nullptr; #endif - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << "TIMER " << timer << ": SET " - << deadline.milliseconds_after_process_epoch() << " now " - << grpc_core::Timestamp::Now().milliseconds_after_process_epoch() - << " call " << closure << "[" << closure->cb << "]"; - } + GRPC_TRACE_VLOG(timer, 2) + << "TIMER " << timer << ": SET " + << deadline.milliseconds_after_process_epoch() << " now " + << grpc_core::Timestamp::Now().milliseconds_after_process_epoch() + << " call " << closure << "[" << closure->cb << "]"; if (!g_shared_mutables.initialized) { timer->pending = false; @@ -370,12 +369,11 @@ static void timer_init(grpc_timer* timer, grpc_core::Timestamp deadline, timer->heap_index = INVALID_HEAP_INDEX; list_join(&shard->list, timer); } - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << " .. add to shard " << (shard - g_shards) - << " with queue_deadline_cap=" - << shard->queue_deadline_cap.milliseconds_after_process_epoch() - << " => is_first_timer=" << (is_first_timer ? "true" : "false"); - } + GRPC_TRACE_VLOG(timer, 2) + << " .. add to shard " << (shard - g_shards) + << " with queue_deadline_cap=" + << shard->queue_deadline_cap.milliseconds_after_process_epoch() + << " => is_first_timer=" << (is_first_timer ? "true" : "false"); gpr_mu_unlock(&shard->mu); // Deadline may have decreased, we need to adjust the main queue. Note @@ -391,10 +389,9 @@ static void timer_init(grpc_timer* timer, grpc_core::Timestamp deadline, // grpc_timer_check. if (is_first_timer) { gpr_mu_lock(&g_shared_mutables.mu); - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << " .. old shard min_deadline=" - << shard->min_deadline.milliseconds_after_process_epoch(); - } + GRPC_TRACE_VLOG(timer, 2) + << " .. old shard min_deadline=" + << shard->min_deadline.milliseconds_after_process_epoch(); if (deadline < shard->min_deadline) { grpc_core::Timestamp old_min_deadline = g_shard_queue[0]->min_deadline; shard->min_deadline = deadline; @@ -433,10 +430,9 @@ static void timer_cancel(grpc_timer* timer) { timer_shard* shard = &g_shards[grpc_core::HashPointer(timer, g_num_shards)]; gpr_mu_lock(&shard->mu); - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << "TIMER " << timer - << ": CANCEL pending=" << (timer->pending ? "true" : "false"); - } + GRPC_TRACE_VLOG(timer, 2) + << "TIMER " << timer + << ": CANCEL pending=" << (timer->pending ? "true" : "false"); if (timer->pending) { REMOVE_FROM_HASH_TABLE(timer); @@ -474,11 +470,9 @@ static bool refill_heap(timer_shard* shard, grpc_core::Timestamp now) { std::max(now, shard->queue_deadline_cap) + grpc_core::Duration::FromSecondsAsDouble(deadline_delta); - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) << " .. shard[" << (shard - g_shards) - << "]->queue_deadline_cap --> " - << shard->queue_deadline_cap.milliseconds_after_process_epoch(); - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. shard[" << (shard - g_shards) << "]->queue_deadline_cap --> " + << shard->queue_deadline_cap.milliseconds_after_process_epoch(); for (timer = shard->list.next; timer != &shard->list; timer = next) { next = timer->next; auto timer_deadline = @@ -486,11 +480,9 @@ static bool refill_heap(timer_shard* shard, grpc_core::Timestamp now) { timer->deadline); if (timer_deadline < shard->queue_deadline_cap) { - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) << " .. add timer with deadline " - << timer_deadline.milliseconds_after_process_epoch() - << " to heap"; - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. add timer with deadline " + << timer_deadline.milliseconds_after_process_epoch() << " to heap"; list_remove(timer); grpc_timer_heap_add(&shard->heap, timer); } @@ -504,10 +496,9 @@ static bool refill_heap(timer_shard* shard, grpc_core::Timestamp now) { static grpc_timer* pop_one(timer_shard* shard, grpc_core::Timestamp now) { grpc_timer* timer; for (;;) { - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) << " .. shard[" << (shard - g_shards) << "]: heap_empty=" - << (grpc_timer_heap_is_empty(&shard->heap) ? "true" : "false"); - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. shard[" << (shard - g_shards) << "]: heap_empty=" + << (grpc_timer_heap_is_empty(&shard->heap) ? "true" : "false"); if (grpc_timer_heap_is_empty(&shard->heap)) { if (now < shard->queue_deadline_cap) return nullptr; if (!refill_heap(shard, now)) return nullptr; @@ -516,16 +507,13 @@ static grpc_timer* pop_one(timer_shard* shard, grpc_core::Timestamp now) { auto timer_deadline = grpc_core::Timestamp::FromMillisecondsAfterProcessEpoch( timer->deadline); - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) << " .. check top timer deadline=" - << timer_deadline.milliseconds_after_process_epoch() - << " now=" << now.milliseconds_after_process_epoch(); - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. check top timer deadline=" + << timer_deadline.milliseconds_after_process_epoch() + << " now=" << now.milliseconds_after_process_epoch(); if (timer_deadline > now) return nullptr; - if (GRPC_TRACE_FLAG_ENABLED(timer)) { - VLOG(2) << "TIMER " << timer << ": FIRE " - << (now - timer_deadline).millis() << "ms late"; - } + GRPC_TRACE_VLOG(timer, 2) << "TIMER " << timer << ": FIRE " + << (now - timer_deadline).millis() << "ms late"; timer->pending = false; grpc_timer_heap_pop(&shard->heap); return timer; @@ -546,9 +534,8 @@ static size_t pop_timers(timer_shard* shard, grpc_core::Timestamp now, } *new_min_deadline = compute_min_deadline(shard); gpr_mu_unlock(&shard->mu); - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) << " .. shard[" << (shard - g_shards) << "] popped " << n; - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. shard[" << (shard - g_shards) << "] popped " << n; return n; } @@ -584,12 +571,10 @@ static grpc_timer_check_result run_some_expired_timers( gpr_mu_lock(&g_shared_mutables.mu); result = GRPC_TIMERS_CHECKED_AND_EMPTY; - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) - << " .. shard[" << (g_shard_queue[0] - g_shards) - << "]->min_deadline = " - << g_shard_queue[0]->min_deadline.milliseconds_after_process_epoch(); - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. shard[" << (g_shard_queue[0] - g_shards) + << "]->min_deadline = " + << g_shard_queue[0]->min_deadline.milliseconds_after_process_epoch(); while (g_shard_queue[0]->min_deadline < now || (now != grpc_core::Timestamp::InfFuture() && @@ -603,14 +588,12 @@ static grpc_timer_check_result run_some_expired_timers( result = GRPC_TIMERS_FIRED; } - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) - << " .. result --> " << result << ", shard[" - << (g_shard_queue[0] - g_shards) << "]->min_deadline " - << g_shard_queue[0]->min_deadline.milliseconds_after_process_epoch() - << " --> " << new_min_deadline.milliseconds_after_process_epoch() - << ", now=" << now.milliseconds_after_process_epoch(); - } + GRPC_TRACE_VLOG(timer_check, 2) + << " .. result --> " << result << ", shard[" + << (g_shard_queue[0] - g_shards) << "]->min_deadline " + << g_shard_queue[0]->min_deadline.milliseconds_after_process_epoch() + << " --> " << new_min_deadline.milliseconds_after_process_epoch() + << ", now=" << now.milliseconds_after_process_epoch(); // An grpc_timer_init() on the shard could intervene here, adding a new // timer that is earlier than new_min_deadline. However, @@ -660,11 +643,9 @@ static grpc_timer_check_result timer_check(grpc_core::Timestamp* next) { if (next != nullptr) { *next = std::min(*next, min_timer); } - if (GRPC_TRACE_FLAG_ENABLED(timer_check)) { - VLOG(2) << "TIMER CHECK SKIP: now=" - << now.milliseconds_after_process_epoch() - << " min_timer=" << min_timer.milliseconds_after_process_epoch(); - } + GRPC_TRACE_VLOG(timer_check, 2) + << "TIMER CHECK SKIP: now=" << now.milliseconds_after_process_epoch() + << " min_timer=" << min_timer.milliseconds_after_process_epoch(); return GRPC_TIMERS_CHECKED_AND_EMPTY; } diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc index 15b2226b688..904cb10faa2 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.cc +++ b/src/core/lib/iomgr/unix_sockets_posix.cc @@ -37,7 +37,6 @@ #include "absl/strings/str_cat.h" #include -#include #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/unix_sockets_posix_noop.cc b/src/core/lib/iomgr/unix_sockets_posix_noop.cc index 8e783c8cb70..1f9038e9537 100644 --- a/src/core/lib/iomgr/unix_sockets_posix_noop.cc +++ b/src/core/lib/iomgr/unix_sockets_posix_noop.cc @@ -26,8 +26,6 @@ #include "absl/log/check.h" -#include - #include "src/core/lib/gprpp/crash.h" void grpc_create_socketpair_if_unix(int /* sv */[2]) { diff --git a/src/core/lib/iomgr/vsock.cc b/src/core/lib/iomgr/vsock.cc index 847dabe0f17..c6dc71a8430 100644 --- a/src/core/lib/iomgr/vsock.cc +++ b/src/core/lib/iomgr/vsock.cc @@ -28,7 +28,6 @@ #include "absl/strings/str_cat.h" #include -#include #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/iomgr/wakeup_fd_eventfd.cc b/src/core/lib/iomgr/wakeup_fd_eventfd.cc index 38760c2cfb4..fcdb63b2e5b 100644 --- a/src/core/lib/iomgr/wakeup_fd_eventfd.cc +++ b/src/core/lib/iomgr/wakeup_fd_eventfd.cc @@ -26,8 +26,6 @@ #include #include -#include - #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" diff --git a/src/core/lib/promise/activity.h b/src/core/lib/promise/activity.h index 715a28c0471..55738c08995 100644 --- a/src/core/lib/promise/activity.h +++ b/src/core/lib/promise/activity.h @@ -29,7 +29,6 @@ #include "absl/strings/str_cat.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/debug/trace.h" diff --git a/src/core/lib/promise/context.h b/src/core/lib/promise/context.h index a2597e324a0..61520707d29 100644 --- a/src/core/lib/promise/context.h +++ b/src/core/lib/promise/context.h @@ -20,7 +20,6 @@ #include "absl/log/check.h" #include "absl/meta/type_traits.h" -#include #include #include "src/core/lib/gprpp/down_cast.h" diff --git a/src/core/lib/promise/detail/join_state.h b/src/core/lib/promise/detail/join_state.h index d6ce8782bfa..403ec38b067 100644 --- a/src/core/lib/promise/detail/join_state.h +++ b/src/core/lib/promise/detail/join_state.h @@ -103,7 +103,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/2 already ready"; } @@ -125,7 +125,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/2 already ready"; } @@ -216,7 +216,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/3 already ready"; } @@ -238,7 +238,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/3 already ready"; } @@ -260,7 +260,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/3 already ready"; } @@ -367,7 +367,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/4 already ready"; } @@ -389,7 +389,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/4 already ready"; } @@ -411,7 +411,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/4 already ready"; } @@ -433,7 +433,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 4/4 already ready"; } @@ -555,7 +555,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/5 already ready"; } @@ -577,7 +577,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/5 already ready"; } @@ -599,7 +599,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/5 already ready"; } @@ -621,7 +621,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 4/5 already ready"; } @@ -643,7 +643,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 5/5 already ready"; } @@ -780,7 +780,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/6 already ready"; } @@ -802,7 +802,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/6 already ready"; } @@ -824,7 +824,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/6 already ready"; } @@ -846,7 +846,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 4/6 already ready"; } @@ -868,7 +868,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 5/6 already ready"; } @@ -890,7 +890,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 6/6 already ready"; } @@ -1042,7 +1042,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/7 already ready"; } @@ -1064,7 +1064,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/7 already ready"; } @@ -1086,7 +1086,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/7 already ready"; } @@ -1108,7 +1108,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 4/7 already ready"; } @@ -1130,7 +1130,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 5/7 already ready"; } @@ -1152,7 +1152,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 6/7 already ready"; } @@ -1174,7 +1174,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 7/7 already ready"; } @@ -1341,7 +1341,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/8 already ready"; } @@ -1363,7 +1363,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/8 already ready"; } @@ -1385,7 +1385,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/8 already ready"; } @@ -1407,7 +1407,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 4/8 already ready"; } @@ -1429,7 +1429,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 5/8 already ready"; } @@ -1451,7 +1451,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 6/8 already ready"; } @@ -1473,7 +1473,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 7/8 already ready"; } @@ -1495,7 +1495,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 8/8 already ready"; } @@ -1677,7 +1677,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 1/9 already ready"; } @@ -1699,7 +1699,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 2/9 already ready"; } @@ -1721,7 +1721,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 3/9 already ready"; } @@ -1743,7 +1743,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 4/9 already ready"; } @@ -1765,7 +1765,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 5/9 already ready"; } @@ -1787,7 +1787,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 6/9 already ready"; } @@ -1809,7 +1809,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 7/9 already ready"; } @@ -1831,7 +1831,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 8/9 already ready"; } @@ -1853,7 +1853,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint 9/9 already ready"; } diff --git a/src/core/lib/promise/detail/seq_state.h b/src/core/lib/promise/detail/seq_state.h index b2b635f98bc..245b8ac26f6 100644 --- a/src/core/lib/promise/detail/seq_state.h +++ b/src/core/lib/promise/detail/seq_state.h @@ -138,24 +138,21 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/2"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/2"; auto result = prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/2 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/2 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -171,16 +168,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/2"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/2"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/2 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/2 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -271,24 +266,21 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/3"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/3"; auto result = prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/3 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/3 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -303,24 +295,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/3"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/3"; auto result = prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/3 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/3 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -336,16 +325,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/3"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/3"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/3 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/3 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -460,24 +447,21 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/4"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/4"; auto result = prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/4 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/4 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -492,24 +476,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/4"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/4"; auto result = prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/4 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/4 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -524,24 +505,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/4"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/4"; auto result = prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/4 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/4 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -557,16 +535,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/4"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/4"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/4 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/4 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -703,24 +679,21 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/5"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/5"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/5 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/5 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -735,24 +708,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/5"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/5"; auto result = prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/5 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/5 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -767,24 +737,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/5"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/5"; auto result = prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/5 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/5 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -799,24 +766,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/5"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/5"; auto result = prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/5 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/5 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -832,16 +796,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/5"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/5"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/5 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/5 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -1009,24 +971,21 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/6"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/6"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/6 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/6 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -1042,24 +1001,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/6"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/6"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/6 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/6 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -1074,24 +1030,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/6"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/6"; auto result = prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/6 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/6 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -1106,24 +1059,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/6"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/6"; auto result = prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/6 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/6 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -1138,24 +1088,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/6"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/6"; auto result = prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/6 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/6 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -1171,16 +1118,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/6"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/6"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/6 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/6 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -1375,24 +1320,21 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/7"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/7 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/7 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -1408,24 +1350,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/7"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/7 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/7 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -1441,24 +1380,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/7"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/7 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/7 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -1473,24 +1409,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/7"; auto result = prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/7 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/7 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -1505,24 +1438,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/7"; auto result = prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/7 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/7 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -1537,24 +1467,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/7"; auto result = prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/7 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/7 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -1570,16 +1497,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/7"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/7"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/7 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/7 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -1802,25 +1727,22 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/8"; auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/8 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/8 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -1837,24 +1759,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/8"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/8 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/8 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -1870,24 +1789,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/8"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/8 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/8 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -1903,24 +1819,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/8"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/8 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/8 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -1935,24 +1848,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/8"; auto result = prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/8 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/8 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -1967,24 +1877,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/8"; auto result = prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/8 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/8 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -1999,24 +1906,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/8"; auto result = prior.current_promise(); PromiseResult6* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/8 gets " - << (p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/8 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits6::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { return PromiseResultTraits6::template ReturnValue( @@ -2032,16 +1936,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState7: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 8/8"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/8"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 8/8 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/8 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -2291,25 +2193,22 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/9"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/9 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/9 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -2327,25 +2226,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/9"; auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/9 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/9 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -2362,24 +2258,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/9"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/9 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/9 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -2395,24 +2288,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/9"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/9 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/9 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -2428,24 +2318,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/9"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/9 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/9 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -2460,24 +2347,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/9"; auto result = prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/9 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/9 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -2492,24 +2376,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/9"; auto result = prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/9 gets " - << (p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/9 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits6::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { return PromiseResultTraits6::template ReturnValue( @@ -2524,24 +2405,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState7: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 8/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/9"; auto result = prior.current_promise(); PromiseResult7* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 8/9 gets " - << (p != nullptr - ? (PromiseResultTraits7::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits7::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/9 gets " + << (p != nullptr + ? (PromiseResultTraits7::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits7::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits7::IsOk(*p)) { return PromiseResultTraits7::template ReturnValue( @@ -2557,16 +2435,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState8: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 9/9"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 9/9"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 9/9 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 9/9 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -2851,25 +2727,22 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/10"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/10 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/10 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -2889,25 +2762,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/10"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/10 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/10 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -2925,25 +2795,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/10"; auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/10 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/10 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -2960,24 +2827,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/10"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/10 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/10 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -2993,24 +2857,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/10"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/10 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/10 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -3026,24 +2887,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/10"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/10 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/10 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -3058,24 +2916,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/10"; auto result = prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/10 gets " - << (p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/10 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits6::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { return PromiseResultTraits6::template ReturnValue( @@ -3090,24 +2945,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState7: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 8/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/10"; auto result = prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 8/10 gets " - << (p != nullptr - ? (PromiseResultTraits7::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits7::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/10 gets " + << (p != nullptr + ? (PromiseResultTraits7::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits7::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits7::IsOk(*p)) { return PromiseResultTraits7::template ReturnValue( @@ -3122,24 +2974,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState8: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 9/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 9/10"; auto result = prior.current_promise(); PromiseResult8* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 9/10 gets " - << (p != nullptr - ? (PromiseResultTraits8::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits8::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 9/10 gets " + << (p != nullptr + ? (PromiseResultTraits8::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits8::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits8::IsOk(*p)) { return PromiseResultTraits8::template ReturnValue( @@ -3155,16 +3004,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState9: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 10/10"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 10/10"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 10/10 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 10/10 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -3480,25 +3327,22 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/11"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/11 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/11 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -3519,25 +3363,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/11"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/11 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/11 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -3557,25 +3398,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/11"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/11 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/11 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -3593,25 +3431,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/11"; auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/11 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/11 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -3628,24 +3463,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/11"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/11 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/11 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -3661,24 +3493,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/11"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/11 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/11 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -3694,24 +3523,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/11"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/11 gets " - << (p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/11 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits6::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { return PromiseResultTraits6::template ReturnValue( @@ -3726,24 +3552,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState7: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 8/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/11"; auto result = prior.prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 8/11 gets " - << (p != nullptr - ? (PromiseResultTraits7::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits7::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/11 gets " + << (p != nullptr + ? (PromiseResultTraits7::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits7::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits7::IsOk(*p)) { return PromiseResultTraits7::template ReturnValue( @@ -3758,24 +3581,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState8: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 9/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 9/11"; auto result = prior.prior.current_promise(); PromiseResult8* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 9/11 gets " - << (p != nullptr - ? (PromiseResultTraits8::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits8::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 9/11 gets " + << (p != nullptr + ? (PromiseResultTraits8::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits8::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits8::IsOk(*p)) { return PromiseResultTraits8::template ReturnValue( @@ -3790,24 +3610,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState9: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 10/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 10/11"; auto result = prior.current_promise(); PromiseResult9* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 10/11 gets " - << (p != nullptr - ? (PromiseResultTraits9::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits9::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 10/11 gets " + << (p != nullptr + ? (PromiseResultTraits9::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits9::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits9::IsOk(*p)) { return PromiseResultTraits9::template ReturnValue( @@ -3823,16 +3640,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState10: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 11/11"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 11/11"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 11/11 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 11/11 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -4179,25 +3994,22 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/12"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/12 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/12 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -4218,25 +4030,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/12"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/12 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/12 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -4257,25 +4066,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/12"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/12 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/12 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -4295,25 +4101,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/12"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/12 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/12 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -4331,25 +4134,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/12"; auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/12 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/12 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -4366,24 +4166,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/12"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/12 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/12 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -4399,24 +4196,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/12"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/12 gets " - << (p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/12 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits6::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { return PromiseResultTraits6::template ReturnValue( @@ -4432,24 +4226,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState7: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 8/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/12"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 8/12 gets " - << (p != nullptr - ? (PromiseResultTraits7::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits7::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/12 gets " + << (p != nullptr + ? (PromiseResultTraits7::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits7::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits7::IsOk(*p)) { return PromiseResultTraits7::template ReturnValue( @@ -4464,24 +4255,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState8: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 9/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 9/12"; auto result = prior.prior.prior.current_promise(); PromiseResult8* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 9/12 gets " - << (p != nullptr - ? (PromiseResultTraits8::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits8::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 9/12 gets " + << (p != nullptr + ? (PromiseResultTraits8::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits8::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits8::IsOk(*p)) { return PromiseResultTraits8::template ReturnValue( @@ -4496,24 +4284,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState9: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 10/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 10/12"; auto result = prior.prior.current_promise(); PromiseResult9* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 10/12 gets " - << (p != nullptr - ? (PromiseResultTraits9::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits9::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 10/12 gets " + << (p != nullptr + ? (PromiseResultTraits9::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits9::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits9::IsOk(*p)) { return PromiseResultTraits9::template ReturnValue( @@ -4528,24 +4313,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState10: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 11/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 11/12"; auto result = prior.current_promise(); PromiseResult10* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 11/12 gets " - << (p != nullptr - ? (PromiseResultTraits10::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits10::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 11/12 gets " + << (p != nullptr + ? (PromiseResultTraits10::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits10::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits10::IsOk(*p)) { return PromiseResultTraits10::template ReturnValue( @@ -4561,16 +4344,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState11: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 12/12"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 12/12"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 12/12 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 12/12 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); @@ -4950,25 +4731,22 @@ struct SeqState { GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION Poll PollOnce() { switch (state) { case State::kState0: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 1/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 1/13"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.prior.current_promise(); PromiseResult0* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 1/13 gets " - << (p != nullptr - ? (PromiseResultTraits0::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits0::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 1/13 gets " + << (p != nullptr + ? (PromiseResultTraits0::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits0::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits0::IsOk(*p)) { return PromiseResultTraits0::template ReturnValue( @@ -4989,25 +4767,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState1: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 2/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 2/13"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.prior.current_promise(); PromiseResult1* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 2/13 gets " - << (p != nullptr - ? (PromiseResultTraits1::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits1::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 2/13 gets " + << (p != nullptr + ? (PromiseResultTraits1::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits1::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits1::IsOk(*p)) { return PromiseResultTraits1::template ReturnValue( @@ -5028,25 +4803,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState2: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 3/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 3/13"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .prior.current_promise(); PromiseResult2* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 3/13 gets " - << (p != nullptr - ? (PromiseResultTraits2::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits2::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 3/13 gets " + << (p != nullptr + ? (PromiseResultTraits2::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits2::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits2::IsOk(*p)) { return PromiseResultTraits2::template ReturnValue( @@ -5067,25 +4839,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState3: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 4/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 4/13"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior .current_promise(); PromiseResult3* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 4/13 gets " - << (p != nullptr - ? (PromiseResultTraits3::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits3::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 4/13 gets " + << (p != nullptr + ? (PromiseResultTraits3::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits3::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits3::IsOk(*p)) { return PromiseResultTraits3::template ReturnValue( @@ -5105,25 +4874,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState4: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 5/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 5/13"; auto result = prior.prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult4* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 5/13 gets " - << (p != nullptr - ? (PromiseResultTraits4::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits4::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 5/13 gets " + << (p != nullptr + ? (PromiseResultTraits4::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits4::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits4::IsOk(*p)) { return PromiseResultTraits4::template ReturnValue( @@ -5141,25 +4907,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState5: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 6/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 6/13"; auto result = prior.prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult5* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 6/13 gets " - << (p != nullptr - ? (PromiseResultTraits5::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits5::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 6/13 gets " + << (p != nullptr + ? (PromiseResultTraits5::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits5::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits5::IsOk(*p)) { return PromiseResultTraits5::template ReturnValue( @@ -5176,24 +4939,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState6: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 7/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 7/13"; auto result = prior.prior.prior.prior.prior.prior.current_promise(); PromiseResult6* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 7/13 gets " - << (p != nullptr - ? (PromiseResultTraits6::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits6::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 7/13 gets " + << (p != nullptr + ? (PromiseResultTraits6::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits6::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits6::IsOk(*p)) { return PromiseResultTraits6::template ReturnValue( @@ -5209,24 +4969,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState7: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 8/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 8/13"; auto result = prior.prior.prior.prior.prior.current_promise(); PromiseResult7* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 8/13 gets " - << (p != nullptr - ? (PromiseResultTraits7::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits7::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 8/13 gets " + << (p != nullptr + ? (PromiseResultTraits7::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits7::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits7::IsOk(*p)) { return PromiseResultTraits7::template ReturnValue( @@ -5242,24 +4999,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState8: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 9/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 9/13"; auto result = prior.prior.prior.prior.current_promise(); PromiseResult8* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 9/13 gets " - << (p != nullptr - ? (PromiseResultTraits8::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits8::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 9/13 gets " + << (p != nullptr + ? (PromiseResultTraits8::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits8::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits8::IsOk(*p)) { return PromiseResultTraits8::template ReturnValue( @@ -5274,24 +5028,21 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState9: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 10/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 10/13"; auto result = prior.prior.prior.current_promise(); PromiseResult9* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 10/13 gets " - << (p != nullptr - ? (PromiseResultTraits9::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits9::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 10/13 gets " + << (p != nullptr + ? (PromiseResultTraits9::IsOk(*p) + ? "ready" + : absl::StrCat("early-error:", + PromiseResultTraits9::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits9::IsOk(*p)) { return PromiseResultTraits9::template ReturnValue( @@ -5306,24 +5057,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState10: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 11/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 11/13"; auto result = prior.prior.current_promise(); PromiseResult10* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 11/13 gets " - << (p != nullptr - ? (PromiseResultTraits10::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits10::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 11/13 gets " + << (p != nullptr + ? (PromiseResultTraits10::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits10::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits10::IsOk(*p)) { return PromiseResultTraits10::template ReturnValue( @@ -5338,24 +5087,22 @@ struct SeqState { } ABSL_FALLTHROUGH_INTENDED; case State::kState11: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 12/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 12/13"; auto result = prior.current_promise(); PromiseResult11* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 12/13 gets " - << (p != nullptr - ? (PromiseResultTraits11::IsOk(*p) - ? "ready" - : absl::StrCat( - "early-error:", - PromiseResultTraits11::ErrorString(*p)) - .c_str()) - : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 12/13 gets " + << (p != nullptr + ? (PromiseResultTraits11::IsOk(*p) + ? "ready" + : absl::StrCat( + "early-error:", + PromiseResultTraits11::ErrorString(*p)) + .c_str()) + : "pending"); if (p == nullptr) return Pending{}; if (!PromiseResultTraits11::IsOk(*p)) { return PromiseResultTraits11::template ReturnValue( @@ -5371,16 +5118,14 @@ struct SeqState { ABSL_FALLTHROUGH_INTENDED; default: case State::kState12: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: begin poll step 13/13"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step 13/13"; auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) - << "seq[" << this << "]: poll step 13/13 gets " - << (result.ready() ? "ready" : "pending"); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step 13/13 gets " + << (result.ready() ? "ready" : "pending"); auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); diff --git a/src/core/lib/promise/interceptor_list.h b/src/core/lib/promise/interceptor_list.h index dc36c2ee289..a47a75bc97a 100644 --- a/src/core/lib/promise/interceptor_list.h +++ b/src/core/lib/promise/interceptor_list.h @@ -87,10 +87,8 @@ class InterceptorList { public: RunPromise(size_t memory_required, Map** factory, absl::optional value) { if (!value.has_value() || *factory == nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << "InterceptorList::RunPromise[" << this - << "]: create immediate"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << "InterceptorList::RunPromise[" << this << "]: create immediate"; is_immediately_resolved_ = true; Construct(&result_, std::move(value)); } else { @@ -100,17 +98,15 @@ class InterceptorList { async_resolution_.space.get()); async_resolution_.current_factory = *factory; async_resolution_.first_factory = factory; - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << "InterceptorList::RunPromise[" << this - << "]: create async; mem=" << async_resolution_.space.get(); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << "InterceptorList::RunPromise[" << this + << "]: create async; mem=" << async_resolution_.space.get(); } } ~RunPromise() { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << "InterceptorList::RunPromise[" << this << "]: destroy"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << "InterceptorList::RunPromise[" << this << "]: destroy"; if (is_immediately_resolved_) { Destruct(&result_); } else { @@ -127,10 +123,9 @@ class InterceptorList { RunPromise(RunPromise&& other) noexcept : is_immediately_resolved_(other.is_immediately_resolved_) { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << "InterceptorList::RunPromise[" << this << "]: move from " - << &other; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << "InterceptorList::RunPromise[" << this << "]: move from " + << &other; if (is_immediately_resolved_) { Construct(&result_, std::move(other.result_)); } else { @@ -141,10 +136,8 @@ class InterceptorList { RunPromise& operator=(RunPromise&& other) noexcept = delete; Poll> operator()() { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << "InterceptorList::RunPromise[" << this - << "]: " << DebugString(); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << "InterceptorList::RunPromise[" << this << "]: " << DebugString(); if (is_immediately_resolved_) return std::move(result_); while (true) { if (*async_resolution_.first_factory == nullptr) { @@ -159,10 +152,9 @@ class InterceptorList { async_resolution_.current_factory = async_resolution_.current_factory->next(); if (!p->has_value()) async_resolution_.current_factory = nullptr; - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << "InterceptorList::RunPromise[" << this - << "]: " << DebugString(); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << "InterceptorList::RunPromise[" << this + << "]: " << DebugString(); if (async_resolution_.current_factory == nullptr) { return std::move(*p); } diff --git a/src/core/lib/promise/map_pipe.h b/src/core/lib/promise/map_pipe.h index e2dc6a9ee6e..2915a9376b5 100644 --- a/src/core/lib/promise/map_pipe.h +++ b/src/core/lib/promise/map_pipe.h @@ -18,7 +18,6 @@ #include "absl/log/log.h" #include "absl/status/status.h" -#include #include #include "src/core/lib/promise/detail/promise_factory.h" diff --git a/src/core/lib/promise/mpsc.h b/src/core/lib/promise/mpsc.h index 26244b43734..4df3e61a512 100644 --- a/src/core/lib/promise/mpsc.h +++ b/src/core/lib/promise/mpsc.h @@ -26,7 +26,6 @@ #include "absl/base/thread_annotations.h" #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/ref_counted.h" diff --git a/src/core/lib/promise/pipe.h b/src/core/lib/promise/pipe.h index 86f0b98d8ef..59ec003f47d 100644 --- a/src/core/lib/promise/pipe.h +++ b/src/core/lib/promise/pipe.h @@ -634,10 +634,9 @@ class Push { Poll operator()() { if (center_ == nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2) << GetContext()->DebugTag() - << " Pipe push has a null center"; - } + GRPC_TRACE_VLOG(promise_primitives, 2) + << GetContext()->DebugTag() + << " Pipe push has a null center"; return false; } if (auto* p = absl::get_if(&state_)) { diff --git a/src/core/lib/promise/poll.h b/src/core/lib/promise/poll.h index 7e26b7b366f..36570a56fbc 100644 --- a/src/core/lib/promise/poll.h +++ b/src/core/lib/promise/poll.h @@ -22,7 +22,6 @@ #include "absl/strings/str_format.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/gprpp/construct_destruct.h" diff --git a/src/core/lib/promise/promise_mutex.h b/src/core/lib/promise/promise_mutex.h index d1e01f22319..b7014da2494 100644 --- a/src/core/lib/promise/promise_mutex.h +++ b/src/core/lib/promise/promise_mutex.h @@ -19,7 +19,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/promise/activity.h" diff --git a/src/core/lib/promise/status_flag.h b/src/core/lib/promise/status_flag.h index 5dbe224955f..250dce50504 100644 --- a/src/core/lib/promise/status_flag.h +++ b/src/core/lib/promise/status_flag.h @@ -23,7 +23,6 @@ #include "absl/strings/str_cat.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/promise/detail/status.h" diff --git a/src/core/lib/resource_quota/connection_quota.cc b/src/core/lib/resource_quota/connection_quota.cc index ab07f5e21b3..846883f78c3 100644 --- a/src/core/lib/resource_quota/connection_quota.cc +++ b/src/core/lib/resource_quota/connection_quota.cc @@ -19,7 +19,6 @@ #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/resource_quota/thread_quota.cc b/src/core/lib/resource_quota/thread_quota.cc index b2aba40210f..73e8b224402 100644 --- a/src/core/lib/resource_quota/thread_quota.cc +++ b/src/core/lib/resource_quota/thread_quota.cc @@ -16,7 +16,6 @@ #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/lib/security/authorization/audit_logging.cc b/src/core/lib/security/authorization/audit_logging.cc index d5b9ae3d149..d5c8f95705e 100644 --- a/src/core/lib/security/authorization/audit_logging.cc +++ b/src/core/lib/security/authorization/audit_logging.cc @@ -30,7 +30,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/lib/security/authorization/grpc_authorization_engine.cc b/src/core/lib/security/authorization/grpc_authorization_engine.cc index 62595ee70b5..4fed6af4fed 100644 --- a/src/core/lib/security/authorization/grpc_authorization_engine.cc +++ b/src/core/lib/security/authorization/grpc_authorization_engine.cc @@ -20,7 +20,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/security/authorization/audit_logging.h" diff --git a/src/core/lib/security/authorization/grpc_server_authz_filter.cc b/src/core/lib/security/authorization/grpc_server_authz_filter.cc index c83d1cc50a7..672b02a9d91 100644 --- a/src/core/lib/security/authorization/grpc_server_authz_filter.cc +++ b/src/core/lib/security/authorization/grpc_server_authz_filter.cc @@ -64,13 +64,12 @@ GrpcServerAuthzFilter::Create(const ChannelArgs& args, ChannelFilter::Args) { bool GrpcServerAuthzFilter::IsAuthorized(ClientMetadata& initial_metadata) { EvaluateArgs args(&initial_metadata, &per_channel_evaluate_args_); - if (GRPC_TRACE_FLAG_ENABLED(grpc_authz_api)) { - VLOG(2) << "checking request: url_path=" << args.GetPath() - << ", transport_security_type=" << args.GetTransportSecurityType() - << ", uri_sans=[" << absl::StrJoin(args.GetUriSans(), ",") - << "], dns_sans=[" << absl::StrJoin(args.GetDnsSans(), ",") - << "], subject=" << args.GetSubject(); - } + GRPC_TRACE_VLOG(grpc_authz_api, 2) + << "checking request: url_path=" << args.GetPath() + << ", transport_security_type=" << args.GetTransportSecurityType() + << ", uri_sans=[" << absl::StrJoin(args.GetUriSans(), ",") + << "], dns_sans=[" << absl::StrJoin(args.GetDnsSans(), ",") + << "], subject=" << args.GetSubject(); grpc_authorization_policy_provider::AuthorizationEngines engines = provider_->engines(); if (engines.deny_engine != nullptr) { @@ -87,10 +86,9 @@ bool GrpcServerAuthzFilter::IsAuthorized(ClientMetadata& initial_metadata) { AuthorizationEngine::Decision decision = engines.allow_engine->Evaluate(args); if (decision.type == AuthorizationEngine::Decision::Type::kAllow) { - if (GRPC_TRACE_FLAG_ENABLED(grpc_authz_api)) { - VLOG(2) << "chand=" << this << ": request allowed by policy " - << decision.matching_policy_name; - } + GRPC_TRACE_VLOG(grpc_authz_api, 2) + << "chand=" << this << ": request allowed by policy " + << decision.matching_policy_name; return true; } } diff --git a/src/core/lib/security/authorization/rbac_translator.cc b/src/core/lib/security/authorization/rbac_translator.cc index 1dbbe8bf16d..d427ce8ea07 100644 --- a/src/core/lib/security/authorization/rbac_translator.cc +++ b/src/core/lib/security/authorization/rbac_translator.cc @@ -34,7 +34,6 @@ #include #include -#include #include #include "src/core/lib/matchers/matchers.h" diff --git a/src/core/lib/security/authorization/stdout_logger.cc b/src/core/lib/security/authorization/stdout_logger.cc index 8e2adb6dd17..9314d21a0e6 100644 --- a/src/core/lib/security/authorization/stdout_logger.cc +++ b/src/core/lib/security/authorization/stdout_logger.cc @@ -27,7 +27,6 @@ #include #include -#include #include namespace grpc_core { diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment.cc b/src/core/lib/security/credentials/alts/check_gcp_environment.cc index 50406fb8a54..864620c9a5a 100644 --- a/src/core/lib/security/credentials/alts/check_gcp_environment.cc +++ b/src/core/lib/security/credentials/alts/check_gcp_environment.cc @@ -25,7 +25,6 @@ #include "absl/log/log.h" #include -#include #include const size_t kBiosDataBufferSize = 256; diff --git a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc index b034ccaac79..85639e51840 100644 --- a/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc +++ b/src/core/lib/security/credentials/alts/check_gcp_environment_windows.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/lib/security/credentials/call_creds_util.cc b/src/core/lib/security/credentials/call_creds_util.cc index c49dd918ab5..037d60196c9 100644 --- a/src/core/lib/security/credentials/call_creds_util.cc +++ b/src/core/lib/security/credentials/call_creds_util.cc @@ -22,7 +22,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include #include #include diff --git a/src/core/lib/security/credentials/composite/composite_credentials.cc b/src/core/lib/security/credentials/composite/composite_credentials.cc index 016565ceaa7..db5d3079cbc 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.cc +++ b/src/core/lib/security/credentials/composite/composite_credentials.cc @@ -26,7 +26,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" -#include #include #include "src/core/lib/debug/trace.h" diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index d5c18629fcf..3066cbfeb33 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/security/credentials/external/aws_external_account_credentials.cc b/src/core/lib/security/credentials/external/aws_external_account_credentials.cc index 6daa3467b51..c2e06861019 100644 --- a/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/aws_external_account_credentials.cc @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/security/credentials/external/url_external_account_credentials.cc b/src/core/lib/security/credentials/external/url_external_account_credentials.cc index 53f4351a901..bcea5eadc09 100644 --- a/src/core/lib/security/credentials/external/url_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/url_external_account_credentials.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/security/credentials/iam/iam_credentials.cc b/src/core/lib/security/credentials/iam/iam_credentials.cc index 76e54d3dd80..876851555da 100644 --- a/src/core/lib/security/credentials/iam/iam_credentials.cc +++ b/src/core/lib/security/credentials/iam/iam_credentials.cc @@ -27,7 +27,6 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include #include #include "src/core/lib/debug/trace.h" diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.h b/src/core/lib/security/credentials/ssl/ssl_credentials.h index 6651e50202a..32c450de90f 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.h +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc b/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc index 8b02a5a4446..2472244f2c5 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc @@ -21,7 +21,6 @@ #include #include -#include #include void grpc_tls_certificate_distributor::SetKeyMaterials( diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h b/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h index d5908d974f0..c3703cd56f9 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h @@ -29,7 +29,6 @@ #include "absl/types/optional.h" #include -#include #include #include diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc b/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc index a3bd89996fa..f4c2c75bb44 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.cc @@ -25,7 +25,6 @@ #include "absl/strings/string_view.h" #include -#include #include #include diff --git a/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h b/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h index 3cb2bba340c..0c5c2e7f5ae 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h +++ b/src/core/lib/security/credentials/tls/grpc_tls_certificate_verifier.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/ref_counted.h" diff --git a/src/core/lib/security/credentials/xds/xds_credentials.cc b/src/core/lib/security/credentials/xds/xds_credentials.cc index c2e5b925e6d..a0e017498e2 100644 --- a/src/core/lib/security/credentials/xds/xds_credentials.cc +++ b/src/core/lib/security/credentials/xds/xds_credentials.cc @@ -23,7 +23,6 @@ #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/security/security_connector/fake/fake_security_connector.cc b/src/core/lib/security/security_connector/fake/fake_security_connector.cc index 25f7bf736f7..b83eda46ee1 100644 --- a/src/core/lib/security/security_connector/fake/fake_security_connector.cc +++ b/src/core/lib/security/security_connector/fake/fake_security_connector.cc @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc b/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc index 97f3fff8718..08e897bebc3 100644 --- a/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +++ b/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/handshaker/security/security_handshaker.h" diff --git a/src/core/lib/security/security_connector/load_system_roots_windows.cc b/src/core/lib/security/security_connector/load_system_roots_windows.cc index 74e5b664c6a..118f013c323 100644 --- a/src/core/lib/security/security_connector/load_system_roots_windows.cc +++ b/src/core/lib/security/security_connector/load_system_roots_windows.cc @@ -30,7 +30,6 @@ #include #include #include -#include #include "src/core/lib/security/security_connector/load_system_roots.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/security/transport/server_auth_filter.cc b/src/core/lib/security/transport/server_auth_filter.cc index 70fe059c980..5b332aa9875 100644 --- a/src/core/lib/security/transport/server_auth_filter.cc +++ b/src/core/lib/security/transport/server_auth_filter.cc @@ -131,12 +131,10 @@ struct ServerAuthFilter::RunApplicationCode::State { ServerAuthFilter::RunApplicationCode::RunApplicationCode( ServerAuthFilter* filter, ClientMetadata& metadata) : state_(GetContext()->ManagedNew(metadata)) { - if (GRPC_TRACE_FLAG_ENABLED(call)) { - LOG(ERROR) << GetContext()->DebugTag() - << "[server-auth]: Delegate to application: filter=" << filter - << " this=" << this - << " auth_ctx=" << filter->auth_context_.get(); - } + GRPC_TRACE_LOG(call, ERROR) + << GetContext()->DebugTag() + << "[server-auth]: Delegate to application: filter=" << filter + << " this=" << this << " auth_ctx=" << filter->auth_context_.get(); filter->server_credentials_->auth_metadata_processor().process( filter->server_credentials_->auth_metadata_processor().state, filter->auth_context_.get(), state_->md.metadata, state_->md.count, diff --git a/src/core/lib/slice/percent_encoding.cc b/src/core/lib/slice/percent_encoding.cc index 8931f1d716d..0d73ea3c06a 100644 --- a/src/core/lib/slice/percent_encoding.cc +++ b/src/core/lib/slice/percent_encoding.cc @@ -25,7 +25,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/bitset.h" diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc index f2d49e0bf47..c0143684dfb 100644 --- a/src/core/lib/slice/slice.cc +++ b/src/core/lib/slice/slice.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/memory.h" diff --git a/src/core/lib/slice/slice.h b/src/core/lib/slice/slice.h index 2dc1d4164c7..88f9d76bcbc 100644 --- a/src/core/lib/slice/slice.h +++ b/src/core/lib/slice/slice.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/debug_location.h" diff --git a/src/core/lib/slice/slice_buffer.cc b/src/core/lib/slice/slice_buffer.cc index 6ea05cbc157..3d07c32334b 100644 --- a/src/core/lib/slice/slice_buffer.cc +++ b/src/core/lib/slice/slice_buffer.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/slice/slice_internal.h b/src/core/lib/slice/slice_internal.h index 03d8fbe180d..e0fe8bd7e99 100644 --- a/src/core/lib/slice/slice_internal.h +++ b/src/core/lib/slice/slice_internal.h @@ -29,7 +29,6 @@ #include "absl/strings/string_view.h" #include -#include #include #include "src/core/lib/gprpp/memory.h" diff --git a/src/core/lib/surface/byte_buffer_reader.cc b/src/core/lib/surface/byte_buffer_reader.cc index 2053bf3f8b5..0516b852a90 100644 --- a/src/core/lib/surface/byte_buffer_reader.cc +++ b/src/core/lib/surface/byte_buffer_reader.cc @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index f7a4e2d09f1..f8ee18a9f0c 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -336,11 +336,9 @@ void Call::HandleCompressionAlgorithmDisabled( void Call::UpdateDeadline(Timestamp deadline) { ReleasableMutexLock lock(&deadline_mu_); - if (GRPC_TRACE_FLAG_ENABLED(call)) { - LOG(INFO) << "[call " << this - << "] UpdateDeadline from=" << deadline_.ToString() - << " to=" << deadline.ToString(); - } + GRPC_TRACE_LOG(call, INFO) + << "[call " << this << "] UpdateDeadline from=" << deadline_.ToString() + << " to=" << deadline.ToString(); if (deadline >= deadline_) return; if (deadline < Timestamp::Now()) { lock.Release(); diff --git a/src/core/lib/surface/call_utils.h b/src/core/lib/surface/call_utils.h index a68fa4a5694..3d5039ab4cf 100644 --- a/src/core/lib/surface/call_utils.h +++ b/src/core/lib/surface/call_utils.h @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 3e19723838f..577ab734efa 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "src/core/channelz/channel_trace.h" diff --git a/src/core/lib/surface/channel_create.cc b/src/core/lib/surface/channel_create.cc index 4f9eb9ad9ed..ef0fd5ba2c6 100644 --- a/src/core/lib/surface/channel_create.cc +++ b/src/core/lib/surface/channel_create.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include "src/core/channelz/channelz.h" diff --git a/src/core/lib/surface/channel_init.h b/src/core/lib/surface/channel_init.h index 05dbdd9120e..435d3cff305 100644 --- a/src/core/lib/surface/channel_init.h +++ b/src/core/lib/surface/channel_init.h @@ -30,7 +30,6 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/surface/client_call.cc b/src/core/lib/surface/client_call.cc index 42c40174b49..db329e66ffa 100644 --- a/src/core/lib/surface/client_call.cc +++ b/src/core/lib/surface/client_call.cc @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/surface/client_call.h b/src/core/lib/surface/client_call.h index 53c5487eabd..484be4d13d1 100644 --- a/src/core/lib/surface/client_call.h +++ b/src/core/lib/surface/client_call.h @@ -39,7 +39,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/surface/completion_queue_factory.cc b/src/core/lib/surface/completion_queue_factory.cc index 486cc5f00ec..dae6695b712 100644 --- a/src/core/lib/surface/completion_queue_factory.cc +++ b/src/core/lib/surface/completion_queue_factory.cc @@ -21,7 +21,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/core/lib/surface/filter_stack_call.h b/src/core/lib/surface/filter_stack_call.h index d3ad7f8b40b..aa5d739d7ad 100644 --- a/src/core/lib/surface/filter_stack_call.h +++ b/src/core/lib/surface/filter_stack_call.h @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index e431024446b..3ac1321b6c7 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/lib/surface/server_call.cc b/src/core/lib/surface/server_call.cc index 3eeddfca866..0ac9064bedb 100644 --- a/src/core/lib/surface/server_call.cc +++ b/src/core/lib/surface/server_call.cc @@ -37,7 +37,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/surface/server_call.h b/src/core/lib/surface/server_call.h index a4b27afd419..351ef21a35b 100644 --- a/src/core/lib/surface/server_call.h +++ b/src/core/lib/surface/server_call.h @@ -42,7 +42,6 @@ #include #include #include -#include #include #include diff --git a/src/core/lib/surface/validate_metadata.h b/src/core/lib/surface/validate_metadata.h index 0607abd1e00..03d08939894 100644 --- a/src/core/lib/surface/validate_metadata.h +++ b/src/core/lib/surface/validate_metadata.h @@ -27,7 +27,6 @@ #include "absl/strings/string_view.h" #include -#include #include #include "src/core/lib/iomgr/error.h" diff --git a/src/core/lib/transport/call_filters.cc b/src/core/lib/transport/call_filters.cc index 28619c214a7..0e378a86d04 100644 --- a/src/core/lib/transport/call_filters.cc +++ b/src/core/lib/transport/call_filters.cc @@ -188,10 +188,9 @@ void CallFilters::Finalize(const grpc_call_final_info* final_info) { void CallFilters::CancelDueToFailedPipeOperation(SourceLocation but_where) { // We expect something cancelled before now if (push_server_trailing_metadata_ == nullptr) return; - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(but_where.file(), but_where.line()) - << "Cancelling due to failed pipe operation: " << DebugString(); - } + GRPC_TRACE_VLOG(promise_primitives, 2) + .AtLocation(but_where.file(), but_where.line()) + << "Cancelling due to failed pipe operation: " << DebugString(); auto status = ServerMetadataFromStatus(GRPC_STATUS_CANCELLED, "Failed pipe operation"); status->Set(GrpcCallWasCancelled(), true); diff --git a/src/core/lib/transport/call_spine.h b/src/core/lib/transport/call_spine.h index 580d94067b9..99944b301fc 100644 --- a/src/core/lib/transport/call_spine.h +++ b/src/core/lib/transport/call_spine.h @@ -17,7 +17,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/dual_ref_counted.h" diff --git a/src/core/lib/transport/connectivity_state.cc b/src/core/lib/transport/connectivity_state.cc index 5e9ff808bbe..503ff1f7ea1 100644 --- a/src/core/lib/transport/connectivity_state.cc +++ b/src/core/lib/transport/connectivity_state.cc @@ -72,12 +72,11 @@ class AsyncConnectivityStateWatcherInterface::Notifier { private: static void SendNotification(void* arg, grpc_error_handle /*ignored*/) { Notifier* self = static_cast(arg); - if (GRPC_TRACE_FLAG_ENABLED(connectivity_state)) { - LOG(INFO) << "watcher " << self->watcher_.get() - << ": delivering async notification for " - << ConnectivityStateName(self->state_) << " (" - << self->status_.ToString() << ")"; - } + GRPC_TRACE_LOG(connectivity_state, INFO) + << "watcher " << self->watcher_.get() + << ": delivering async notification for " + << ConnectivityStateName(self->state_) << " (" + << self->status_.ToString() << ")"; self->watcher_->OnConnectivityStateChange(self->state_, self->status_); delete self; } @@ -104,12 +103,11 @@ ConnectivityStateTracker::~ConnectivityStateTracker() { state_.load(std::memory_order_relaxed); if (current_state == GRPC_CHANNEL_SHUTDOWN) return; for (const auto& p : watchers_) { - if (GRPC_TRACE_FLAG_ENABLED(connectivity_state)) { - LOG(INFO) << "ConnectivityStateTracker " << name_ << "[" << this - << "]: notifying watcher " << p.first << ": " - << ConnectivityStateName(current_state) << " -> " - << ConnectivityStateName(GRPC_CHANNEL_SHUTDOWN); - } + GRPC_TRACE_LOG(connectivity_state, INFO) + << "ConnectivityStateTracker " << name_ << "[" << this + << "]: notifying watcher " << p.first << ": " + << ConnectivityStateName(current_state) << " -> " + << ConnectivityStateName(GRPC_CHANNEL_SHUTDOWN); p.second->Notify(GRPC_CHANNEL_SHUTDOWN, absl::Status()); } } @@ -123,12 +121,11 @@ void ConnectivityStateTracker::AddWatcher( grpc_connectivity_state current_state = state_.load(std::memory_order_relaxed); if (initial_state != current_state) { - if (GRPC_TRACE_FLAG_ENABLED(connectivity_state)) { - LOG(INFO) << "ConnectivityStateTracker " << name_ << "[" << this - << "]: notifying watcher " << watcher.get() << ": " - << ConnectivityStateName(initial_state) << " -> " - << ConnectivityStateName(current_state); - } + GRPC_TRACE_LOG(connectivity_state, INFO) + << "ConnectivityStateTracker " << name_ << "[" << this + << "]: notifying watcher " << watcher.get() << ": " + << ConnectivityStateName(initial_state) << " -> " + << ConnectivityStateName(current_state); watcher->Notify(current_state, status_); } // If we're in state SHUTDOWN, don't add the watcher, so that it will @@ -152,21 +149,19 @@ void ConnectivityStateTracker::SetState(grpc_connectivity_state state, grpc_connectivity_state current_state = state_.load(std::memory_order_relaxed); if (state == current_state) return; - if (GRPC_TRACE_FLAG_ENABLED(connectivity_state)) { - LOG(INFO) << "ConnectivityStateTracker " << name_ << "[" << this - << "]: " << ConnectivityStateName(current_state) << " -> " - << ConnectivityStateName(state) << " (" << reason << ", " - << status.ToString() << ")"; - } + GRPC_TRACE_LOG(connectivity_state, INFO) + << "ConnectivityStateTracker " << name_ << "[" << this + << "]: " << ConnectivityStateName(current_state) << " -> " + << ConnectivityStateName(state) << " (" << reason << ", " + << status.ToString() << ")"; state_.store(state, std::memory_order_relaxed); status_ = status; for (const auto& p : watchers_) { - if (GRPC_TRACE_FLAG_ENABLED(connectivity_state)) { - LOG(INFO) << "ConnectivityStateTracker " << name_ << "[" << this - << "]: notifying watcher " << p.first << ": " - << ConnectivityStateName(current_state) << " -> " - << ConnectivityStateName(state); - } + GRPC_TRACE_LOG(connectivity_state, INFO) + << "ConnectivityStateTracker " << name_ << "[" << this + << "]: notifying watcher " << p.first << ": " + << ConnectivityStateName(current_state) << " -> " + << ConnectivityStateName(state); p.second->Notify(state, status); } // If the new state is SHUTDOWN, orphan all of the watchers. This diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h index fab1325b95c..6ede60d480c 100644 --- a/src/core/lib/transport/metadata_batch.h +++ b/src/core/lib/transport/metadata_batch.h @@ -36,7 +36,6 @@ #include #include -#include #include #include "src/core/lib/compression/compression_internal.h" diff --git a/src/core/lib/transport/promise_endpoint.cc b/src/core/lib/transport/promise_endpoint.cc index 031f5194e02..355cf44333f 100644 --- a/src/core/lib/transport/promise_endpoint.cc +++ b/src/core/lib/transport/promise_endpoint.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/sync.h" diff --git a/src/core/lib/transport/promise_endpoint.h b/src/core/lib/transport/promise_endpoint.h index 12659aff583..4d810fbc75f 100644 --- a/src/core/lib/transport/promise_endpoint.h +++ b/src/core/lib/transport/promise_endpoint.h @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "src/core/lib/event_engine/extensions/chaotic_good_extension.h" diff --git a/src/core/lib/transport/timeout_encoding.cc b/src/core/lib/transport/timeout_encoding.cc index deb82cb2cdc..57621d835c0 100644 --- a/src/core/lib/transport/timeout_encoding.cc +++ b/src/core/lib/transport/timeout_encoding.cc @@ -23,7 +23,6 @@ #include "absl/base/attributes.h" #include "absl/log/check.h" -#include #include #include diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index fa32ce2aed4..4c16314558c 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -190,10 +190,9 @@ void grpc_stream_ref_init(grpc_stream_refcount* refcount, int initial_refs, #ifndef NDEBUG inline void grpc_stream_ref(grpc_stream_refcount* refcount, const char* reason) { - if (GRPC_TRACE_FLAG_ENABLED(stream_refcount)) { - VLOG(2) << refcount->object_type << " " << refcount << ":" - << refcount->destroy.cb_arg << " REF " << reason; - } + GRPC_TRACE_VLOG(stream_refcount, 2) + << refcount->object_type << " " << refcount << ":" + << refcount->destroy.cb_arg << " REF " << reason; refcount->refs.RefNonZero(DEBUG_LOCATION, reason); } #else @@ -207,10 +206,9 @@ void grpc_stream_destroy(grpc_stream_refcount* refcount); #ifndef NDEBUG inline void grpc_stream_unref(grpc_stream_refcount* refcount, const char* reason) { - if (GRPC_TRACE_FLAG_ENABLED(stream_refcount)) { - VLOG(2) << refcount->object_type << " " << refcount << ":" - << refcount->destroy.cb_arg << " UNREF " << reason; - } + GRPC_TRACE_VLOG(stream_refcount, 2) + << refcount->object_type << " " << refcount << ":" + << refcount->destroy.cb_arg << " UNREF " << reason; if (GPR_UNLIKELY(refcount->refs.Unref(DEBUG_LOCATION, reason))) { grpc_stream_destroy(refcount); } diff --git a/src/core/lib/transport/transport_op_string.cc b/src/core/lib/transport/transport_op_string.cc index 09222337537..40ea5bc2d8a 100644 --- a/src/core/lib/transport/transport_op_string.cc +++ b/src/core/lib/transport/transport_op_string.cc @@ -22,7 +22,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" -#include #include #include "src/core/lib/channel/channel_fwd.h" diff --git a/src/core/lib/uri/uri_parser.cc b/src/core/lib/uri/uri_parser.cc index dfb71286c41..95d92663194 100644 --- a/src/core/lib/uri/uri_parser.cc +++ b/src/core/lib/uri/uri_parser.cc @@ -36,7 +36,6 @@ #include "absl/strings/str_split.h" #include "absl/strings/strip.h" -#include #include namespace grpc_core { diff --git a/src/core/load_balancing/grpclb/grpclb.cc b/src/core/load_balancing/grpclb/grpclb.cc index af895a97241..d91812d9598 100644 --- a/src/core/load_balancing/grpclb/grpclb.cc +++ b/src/core/load_balancing/grpclb/grpclb.cc @@ -851,14 +851,12 @@ void GrpcLb::Helper::UpdateState(grpc_connectivity_state state, parent()->lb_calld_->client_stats() != nullptr) { client_stats = parent()->lb_calld_->client_stats()->Ref(); } - if (GRPC_TRACE_FLAG_ENABLED(glb)) { - GRPC_TRACE_LOG(glb, INFO) - << "[grpclb " << parent() << " helper " << this - << "] state=" << ConnectivityStateName(state) << " (" - << status.ToString() << ") wrapping child picker " << picker.get() - << " (serverlist=" << serverlist.get() - << ", client_stats=" << client_stats.get() << ")"; - } + GRPC_TRACE_LOG(glb, INFO) + << "[grpclb " << parent() << " helper " << this + << "] state=" << ConnectivityStateName(state) << " (" << status.ToString() + << ") wrapping child picker " << picker.get() + << " (serverlist=" << serverlist.get() + << ", client_stats=" << client_stats.get() << ")"; parent()->channel_control_helper()->UpdateState( state, status, MakeRefCounted(std::move(serverlist), std::move(picker), diff --git a/src/core/load_balancing/health_check_client.cc b/src/core/load_balancing/health_check_client.cc index da841baaff9..430c59f28f5 100644 --- a/src/core/load_balancing/health_check_client.cc +++ b/src/core/load_balancing/health_check_client.cc @@ -458,12 +458,11 @@ void HealthWatcher::SetSubchannel(Subchannel* subchannel) { if (created) producer_->Start(subchannel->Ref()); // Register ourself with the producer. producer_->AddWatcher(this, health_check_service_name_); - if (GRPC_TRACE_FLAG_ENABLED(health_check_client)) { - LOG(INFO) << "HealthWatcher " << this << ": registered with producer " - << producer_.get() << " (created=" << created - << ", health_check_service_name=\"" - << health_check_service_name_.value_or("N/A") << "\")"; - } + GRPC_TRACE_LOG(health_check_client, INFO) + << "HealthWatcher " << this << ": registered with producer " + << producer_.get() << " (created=" << created + << ", health_check_service_name=\"" + << health_check_service_name_.value_or("N/A") << "\")"; } void HealthWatcher::Notify(grpc_connectivity_state state, absl::Status status) { diff --git a/src/core/load_balancing/outlier_detection/outlier_detection.cc b/src/core/load_balancing/outlier_detection/outlier_detection.cc index 9141b2bef59..87cffdefe81 100644 --- a/src/core/load_balancing/outlier_detection/outlier_detection.cc +++ b/src/core/load_balancing/outlier_detection/outlier_detection.cc @@ -740,12 +740,11 @@ void OutlierDetectionLb::MaybeUpdatePickerLocked() { if (picker_ != nullptr) { auto outlier_detection_picker = MakeRefCounted(this, picker_, config_->CountingEnabled()); - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << this - << "] updating connectivity: state=" - << ConnectivityStateName(state_) << " status=(" << status_ - << ") picker=" << outlier_detection_picker.get(); - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << this + << "] updating connectivity: state=" << ConnectivityStateName(state_) + << " status=(" << status_ + << ") picker=" << outlier_detection_picker.get(); channel_control_helper()->UpdateState(state_, status_, std::move(outlier_detection_picker)); } @@ -806,12 +805,11 @@ void OutlierDetectionLb::Helper::UpdateState( grpc_connectivity_state state, const absl::Status& status, RefCountedPtr picker) { if (parent()->shutting_down_) return; - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << parent() - << "] child connectivity state update: state=" - << ConnectivityStateName(state) << " (" << status - << ") picker=" << picker.get(); - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << parent() + << "] child connectivity state update: state=" + << ConnectivityStateName(state) << " (" << status + << ") picker=" << picker.get(); // Save the state and picker. parent()->state_ = state; parent()->status_ = status; @@ -892,26 +890,24 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked() { } } } - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << parent_.get() << "] found " - << success_rate_ejection_candidates.size() - << " success rate candidates and " - << failure_percentage_ejection_candidates.size() - << " failure percentage candidates; ejected_host_count=" - << ejected_host_count << "; success_rate_sum=" - << absl::StrFormat("%.3f", success_rate_sum); - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << parent_.get() << "] found " + << success_rate_ejection_candidates.size() + << " success rate candidates and " + << failure_percentage_ejection_candidates.size() + << " failure percentage candidates; ejected_host_count=" + << ejected_host_count + << "; success_rate_sum=" << absl::StrFormat("%.3f", success_rate_sum); // success rate algorithm if (!success_rate_ejection_candidates.empty() && success_rate_ejection_candidates.size() >= config.success_rate_ejection->minimum_hosts) { - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << parent_.get() - << "] running success rate algorithm: " - << "stdev_factor=" << config.success_rate_ejection->stdev_factor - << ", enforcement_percentage=" - << config.success_rate_ejection->enforcement_percentage; - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << parent_.get() + << "] running success rate algorithm: " + << "stdev_factor=" << config.success_rate_ejection->stdev_factor + << ", enforcement_percentage=" + << config.success_rate_ejection->enforcement_percentage; // calculate ejection threshold: (mean - stdev * // (success_rate_ejection.stdev_factor / 1000)) double mean = success_rate_sum / success_rate_ejection_candidates.size(); @@ -936,13 +932,11 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked() { uint32_t random_key = absl::Uniform(bit_gen_, 1, 100); double current_percent = 100.0 * ejected_host_count / parent_->endpoint_state_map_.size(); - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << parent_.get() - << "] random_key=" << random_key - << " ejected_host_count=" << ejected_host_count - << " current_percent=" - << absl::StrFormat("%.3f", current_percent); - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << parent_.get() + << "] random_key=" << random_key + << " ejected_host_count=" << ejected_host_count + << " current_percent=" << absl::StrFormat("%.3f", current_percent); if (random_key < config.success_rate_ejection->enforcement_percentage && (ejected_host_count == 0 || (current_percent < config.max_ejection_percent))) { @@ -961,13 +955,12 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked() { if (!failure_percentage_ejection_candidates.empty() && failure_percentage_ejection_candidates.size() >= config.failure_percentage_ejection->minimum_hosts) { - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << parent_.get() - << "] running failure percentage algorithm: " - << "threshold=" << config.failure_percentage_ejection->threshold - << ", enforcement_percentage=" - << config.failure_percentage_ejection->enforcement_percentage; - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << parent_.get() + << "] running failure percentage algorithm: " + << "threshold=" << config.failure_percentage_ejection->threshold + << ", enforcement_percentage=" + << config.failure_percentage_ejection->enforcement_percentage; for (auto& candidate : failure_percentage_ejection_candidates) { GRPC_TRACE_LOG(outlier_detection_lb, INFO) << "[outlier_detection_lb " << parent_.get() @@ -981,12 +974,11 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked() { uint32_t random_key = absl::Uniform(bit_gen_, 1, 100); double current_percent = 100.0 * ejected_host_count / parent_->endpoint_state_map_.size(); - if (GRPC_TRACE_FLAG_ENABLED(outlier_detection_lb)) { - LOG(INFO) << "[outlier_detection_lb " << parent_.get() - << "] random_key=" << random_key - << " ejected_host_count=" << ejected_host_count - << " current_percent=" << current_percent; - } + GRPC_TRACE_LOG(outlier_detection_lb, INFO) + << "[outlier_detection_lb " << parent_.get() + << "] random_key=" << random_key + << " ejected_host_count=" << ejected_host_count + << " current_percent=" << current_percent; if (random_key < config.failure_percentage_ejection->enforcement_percentage && (ejected_host_count == 0 || diff --git a/src/core/load_balancing/pick_first/pick_first.cc b/src/core/load_balancing/pick_first/pick_first.cc index 038b074e216..c63424cada4 100644 --- a/src/core/load_balancing/pick_first/pick_first.cc +++ b/src/core/load_balancing/pick_first/pick_first.cc @@ -735,15 +735,13 @@ void PickFirst::SubchannelList::SubchannelData::SubchannelState:: OnConnectivityStateChange(grpc_connectivity_state new_state, absl::Status status) { if (watcher_ == nullptr) return; - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "[PF " << pick_first_.get() << "] subchannel state " << this - << " (subchannel " << subchannel_.get() - << "): connectivity changed: new_state=" - << ConnectivityStateName(new_state) << ", status=" << status - << ", watcher=" << watcher_ - << ", subchannel_data_=" << subchannel_data_ - << ", pick_first_->selected_=" << pick_first_->selected_.get(); - } + GRPC_TRACE_LOG(pick_first, INFO) + << "[PF " << pick_first_.get() << "] subchannel state " << this + << " (subchannel " << subchannel_.get() + << "): connectivity changed: new_state=" + << ConnectivityStateName(new_state) << ", status=" << status + << ", watcher=" << watcher_ << ", subchannel_data_=" << subchannel_data_ + << ", pick_first_->selected_=" << pick_first_->selected_.get(); // If we're still part of a subchannel list trying to connect, check // if we're connected. if (subchannel_data_ != nullptr) { @@ -792,22 +790,21 @@ PickFirst::SubchannelList::SubchannelData::SubchannelData( void PickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange( grpc_connectivity_state new_state, absl::Status status) { PickFirst* p = subchannel_list_->policy_.get(); - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "[PF " << p << "] subchannel list " << subchannel_list_ - << " index " << index_ << " of " << subchannel_list_->size() - << " (subchannel_state " << subchannel_state_.get() - << "): connectivity changed: old_state=" - << (connectivity_state_.has_value() - ? ConnectivityStateName(*connectivity_state_) - : "N/A") - << ", new_state=" << ConnectivityStateName(new_state) - << ", status=" << status - << ", seen_transient_failure=" << seen_transient_failure_ - << ", p->selected_=" << p->selected_.get() - << ", p->subchannel_list_=" << p->subchannel_list_.get() - << ", p->subchannel_list_->shutting_down_=" - << p->subchannel_list_->shutting_down_; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "[PF " << p << "] subchannel list " << subchannel_list_ << " index " + << index_ << " of " << subchannel_list_->size() << " (subchannel_state " + << subchannel_state_.get() << "): connectivity changed: old_state=" + << (connectivity_state_.has_value() + ? ConnectivityStateName(*connectivity_state_) + : "N/A") + << ", new_state=" << ConnectivityStateName(new_state) + << ", status=" << status + << ", seen_transient_failure=" << seen_transient_failure_ + << ", p->selected_=" << p->selected_.get() + << ", p->subchannel_list_=" << p->subchannel_list_.get() + << ", p->subchannel_list_->shutting_down_=" + << p->subchannel_list_->shutting_down_; + if (subchannel_list_->shutting_down_) return; // The notification must be for a subchannel in the current list. CHECK(subchannel_list_ == p->subchannel_list_.get()); @@ -944,12 +941,10 @@ void PickFirst::SubchannelList::SubchannelData::RequestConnectionWithTimer() { // If this is not the last subchannel in the list, start the timer. if (index_ != subchannel_list_->size() - 1) { PickFirst* p = subchannel_list_->policy_.get(); - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "Pick First " << p << " subchannel list " << subchannel_list_ - << ": starting Connection Attempt Delay timer for " - << p->connection_attempt_delay_.millis() << "ms for index " - << index_; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "Pick First " << p << " subchannel list " << subchannel_list_ + << ": starting Connection Attempt Delay timer for " + << p->connection_attempt_delay_.millis() << "ms for index " << index_; subchannel_list_->timer_handle_ = p->channel_control_helper()->GetEventEngine()->RunAfter( p->connection_attempt_delay_, @@ -960,15 +955,13 @@ void PickFirst::SubchannelList::SubchannelData::RequestConnectionWithTimer() { auto* sl = subchannel_list.get(); sl->policy_->work_serializer()->Run( [subchannel_list = std::move(subchannel_list)]() { - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) - << "Pick First " << subchannel_list->policy_.get() - << " subchannel list " << subchannel_list.get() - << ": Connection Attempt Delay timer fired " - "(shutting_down=" - << subchannel_list->shutting_down_ << ", selected=" - << subchannel_list->policy_->selected_.get() << ")"; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "Pick First " << subchannel_list->policy_.get() + << " subchannel list " << subchannel_list.get() + << ": Connection Attempt Delay timer fired " + "(shutting_down=" + << subchannel_list->shutting_down_ << ", selected=" + << subchannel_list->policy_->selected_.get() << ")"; if (subchannel_list->shutting_down_) return; if (subchannel_list->policy_->selected_ != nullptr) return; ++subchannel_list->attempting_index_; @@ -1588,13 +1581,11 @@ OldPickFirst::SubchannelList::SubchannelData::SubchannelData( void OldPickFirst::SubchannelList::SubchannelData::ShutdownLocked() { if (subchannel_ != nullptr) { - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "[PF " << subchannel_list_->policy_.get() - << "] subchannel list " << subchannel_list_ << " index " - << index_ << " of " << subchannel_list_->size() - << " (subchannel " << subchannel_.get() - << "): cancelling watch and unreffing subchannel"; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "[PF " << subchannel_list_->policy_.get() << "] subchannel list " + << subchannel_list_ << " index " << index_ << " of " + << subchannel_list_->size() << " (subchannel " << subchannel_.get() + << "): cancelling watch and unreffing subchannel"; subchannel_->CancelConnectivityStateWatch(pending_watcher_); pending_watcher_ = nullptr; subchannel_.reset(); @@ -1604,24 +1595,23 @@ void OldPickFirst::SubchannelList::SubchannelData::ShutdownLocked() { void OldPickFirst::SubchannelList::SubchannelData::OnConnectivityStateChange( grpc_connectivity_state new_state, absl::Status status) { OldPickFirst* p = subchannel_list_->policy_.get(); - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "[PF " << p << "] subchannel list " << subchannel_list_ - << " index " << index_ << " of " << subchannel_list_->size() - << " (subchannel " << subchannel_.get() - << "): connectivity changed: old_state=" - << (connectivity_state_.has_value() - ? ConnectivityStateName(*connectivity_state_) - : "N/A") - << ", new_state=" << ConnectivityStateName(new_state) - << ", status=" << status - << ", shutting_down=" << subchannel_list_->shutting_down_ - << ", pending_watcher=" << pending_watcher_ - << ", seen_transient_failure=" << seen_transient_failure_ - << ", p->selected_=" << p->selected_ - << ", p->subchannel_list_=" << p->subchannel_list_.get() - << ", p->latest_pending_subchannel_list_=" - << p->latest_pending_subchannel_list_.get(); - } + GRPC_TRACE_LOG(pick_first, INFO) + << "[PF " << p << "] subchannel list " << subchannel_list_ << " index " + << index_ << " of " << subchannel_list_->size() << " (subchannel " + << subchannel_.get() << "): connectivity changed: old_state=" + << (connectivity_state_.has_value() + ? ConnectivityStateName(*connectivity_state_) + : "N/A") + << ", new_state=" << ConnectivityStateName(new_state) + << ", status=" << status + << ", shutting_down=" << subchannel_list_->shutting_down_ + << ", pending_watcher=" << pending_watcher_ + << ", seen_transient_failure=" << seen_transient_failure_ + << ", p->selected_=" << p->selected_ + << ", p->subchannel_list_=" << p->subchannel_list_.get() + << ", p->latest_pending_subchannel_list_=" + << p->latest_pending_subchannel_list_.get(); + if (subchannel_list_->shutting_down_ || pending_watcher_ == nullptr) return; auto& stats_plugins = subchannel_list_->policy_->channel_control_helper() ->GetStatsPluginGroup(); @@ -1814,12 +1804,10 @@ void OldPickFirst::SubchannelList::SubchannelData:: // If this is not the last subchannel in the list, start the timer. if (index_ != subchannel_list_->size() - 1) { OldPickFirst* p = subchannel_list_->policy_.get(); - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "Pick First " << p << " subchannel list " << subchannel_list_ - << ": starting Connection Attempt Delay timer for " - << p->connection_attempt_delay_.millis() << "ms for index " - << index_; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "Pick First " << p << " subchannel list " << subchannel_list_ + << ": starting Connection Attempt Delay timer for " + << p->connection_attempt_delay_.millis() << "ms for index " << index_; subchannel_list_->timer_handle_ = p->channel_control_helper()->GetEventEngine()->RunAfter( p->connection_attempt_delay_, @@ -1830,15 +1818,13 @@ void OldPickFirst::SubchannelList::SubchannelData:: auto* sl = subchannel_list.get(); sl->policy_->work_serializer()->Run( [subchannel_list = std::move(subchannel_list)]() { - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) - << "Pick First " << subchannel_list->policy_.get() - << " subchannel list " << subchannel_list.get() - << ": Connection Attempt Delay timer fired " - << "(shutting_down=" - << subchannel_list->shutting_down_ << ", selected=" - << subchannel_list->policy_->selected_ << ")"; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "Pick First " << subchannel_list->policy_.get() + << " subchannel list " << subchannel_list.get() + << ": Connection Attempt Delay timer fired " + << "(shutting_down=" << subchannel_list->shutting_down_ + << ", selected=" << subchannel_list->policy_->selected_ + << ")"; if (subchannel_list->shutting_down_) return; if (subchannel_list->policy_->selected_ != nullptr) return; ++subchannel_list->attempting_index_; @@ -2004,12 +1990,11 @@ void OldPickFirst::SubchannelList::MaybeFinishHappyEyeballsPass() { // TRANSIENT_FAILURE and dropping the existing (working) connection, // but we can't ignore what the control plane has told us. if (policy_->latest_pending_subchannel_list_.get() == this) { - if (GRPC_TRACE_FLAG_ENABLED(pick_first)) { - LOG(INFO) << "Pick First " << policy_.get() - << " promoting pending subchannel list " - << policy_->latest_pending_subchannel_list_.get() - << " to replace " << this; - } + GRPC_TRACE_LOG(pick_first, INFO) + << "Pick First " << policy_.get() + << " promoting pending subchannel list " + << policy_->latest_pending_subchannel_list_.get() << " to replace " + << this; policy_->UnsetSelectedSubchannel(); policy_->subchannel_list_ = std::move(policy_->latest_pending_subchannel_list_); diff --git a/src/core/load_balancing/priority/priority.cc b/src/core/load_balancing/priority/priority.cc index 3a4de92a1a6..07f9a529ddb 100644 --- a/src/core/load_balancing/priority/priority.cc +++ b/src/core/load_balancing/priority/priority.cc @@ -435,12 +435,11 @@ void PriorityLb::ChoosePriorityLocked() { return; } // Child has been failing for a while. Move on to the next priority. - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) << "[priority_lb " << this << "] skipping priority " << priority - << ", child " << child_name << ": state=" - << ConnectivityStateName(child->connectivity_state()) - << ", failover timer not pending"; - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << this << "] skipping priority " << priority + << ", child " << child_name + << ": state=" << ConnectivityStateName(child->connectivity_state()) + << ", failover timer not pending"; } // If we didn't find any priority to try, pick the first one in state // CONNECTING. @@ -472,12 +471,10 @@ void PriorityLb::ChoosePriorityLocked() { void PriorityLb::SetCurrentPriorityLocked(int32_t priority, bool deactivate_lower_priorities, const char* reason) { - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) << "[priority_lb " << this << "] selecting priority " << priority - << ", child " << config_->priorities()[priority] << " (" << reason - << ", deactivate_lower_priorities=" << deactivate_lower_priorities - << ")"; - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << this << "] selecting priority " << priority + << ", child " << config_->priorities()[priority] << " (" << reason + << ", deactivate_lower_priorities=" << deactivate_lower_priorities << ")"; current_priority_ = priority; if (deactivate_lower_priorities) { for (uint32_t p = priority + 1; p < config_->priorities().size(); ++p) { @@ -500,12 +497,11 @@ void PriorityLb::SetCurrentPriorityLocked(int32_t priority, PriorityLb::ChildPriority::DeactivationTimer::DeactivationTimer( RefCountedPtr child_priority) : child_priority_(std::move(child_priority)) { - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) << "[priority_lb " << child_priority_->priority_policy_.get() - << "] child " << child_priority_->name_ << " (" - << child_priority_.get() << "): deactivating -- will remove in " - << kChildRetentionInterval.millis() << "ms"; - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << child_priority_->priority_policy_.get() + << "] child " << child_priority_->name_ << " (" << child_priority_.get() + << "): deactivating -- will remove in " + << kChildRetentionInterval.millis() << "ms"; timer_handle_ = child_priority_->priority_policy_->channel_control_helper() ->GetEventEngine() @@ -537,12 +533,10 @@ void PriorityLb::ChildPriority::DeactivationTimer::Orphan() { void PriorityLb::ChildPriority::DeactivationTimer::OnTimerLocked() { if (timer_handle_.has_value()) { timer_handle_.reset(); - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) << "[priority_lb " << child_priority_->priority_policy_.get() - << "] child " << child_priority_->name_ << " (" - << child_priority_.get() - << "): deactivation timer fired, deleting child"; - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << child_priority_->priority_policy_.get() + << "] child " << child_priority_->name_ << " (" << child_priority_.get() + << "): deactivation timer fired, deleting child"; child_priority_->priority_policy_->DeleteChild(child_priority_.get()); } } @@ -554,14 +548,12 @@ void PriorityLb::ChildPriority::DeactivationTimer::OnTimerLocked() { PriorityLb::ChildPriority::FailoverTimer::FailoverTimer( RefCountedPtr child_priority) : child_priority_(std::move(child_priority)) { - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) - << "[priority_lb " << child_priority_->priority_policy_.get() - << "] child " << child_priority_->name_ << " (" << child_priority_.get() - << "): starting failover timer for " - << child_priority_->priority_policy_->child_failover_timeout_.millis() - << "ms"; - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << child_priority_->priority_policy_.get() + << "] child " << child_priority_->name_ << " (" << child_priority_.get() + << "): starting failover timer for " + << child_priority_->priority_policy_->child_failover_timeout_.millis() + << "ms"; timer_handle_ = child_priority_->priority_policy_->channel_control_helper() ->GetEventEngine() @@ -594,12 +586,10 @@ void PriorityLb::ChildPriority::FailoverTimer::Orphan() { void PriorityLb::ChildPriority::FailoverTimer::OnTimerLocked() { if (timer_handle_.has_value()) { timer_handle_.reset(); - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) << "[priority_lb " << child_priority_->priority_policy_.get() - << "] child " << child_priority_->name_ << " (" - << child_priority_.get() - << "): failover timer fired, reporting TRANSIENT_FAILURE"; - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << child_priority_->priority_policy_.get() + << "] child " << child_priority_->name_ << " (" << child_priority_.get() + << "): failover timer fired, reporting TRANSIENT_FAILURE"; child_priority_->OnConnectivityStateUpdateLocked( GRPC_CHANNEL_TRANSIENT_FAILURE, absl::Status(absl::StatusCode::kUnavailable, "failover timer fired"), @@ -716,12 +706,10 @@ void PriorityLb::ChildPriority::ResetBackoffLocked() { void PriorityLb::ChildPriority::OnConnectivityStateUpdateLocked( grpc_connectivity_state state, const absl::Status& status, RefCountedPtr picker) { - if (GRPC_TRACE_FLAG_ENABLED(priority_lb)) { - LOG(INFO) << "[priority_lb " << priority_policy_.get() << "] child " - << name_ << " (" << this - << "): state update: " << ConnectivityStateName(state) << " (" - << status << ") picker " << picker.get(); - } + GRPC_TRACE_LOG(priority_lb, INFO) + << "[priority_lb " << priority_policy_.get() << "] child " << name_ + << " (" << this << "): state update: " << ConnectivityStateName(state) + << " (" << status << ") picker " << picker.get(); // Store the state and picker. connectivity_state_ = state; connectivity_status_ = status; diff --git a/src/core/load_balancing/ring_hash/ring_hash.cc b/src/core/load_balancing/ring_hash/ring_hash.cc index f32f16ca159..da108603a04 100644 --- a/src/core/load_balancing/ring_hash/ring_hash.cc +++ b/src/core/load_balancing/ring_hash/ring_hash.cc @@ -570,15 +570,13 @@ absl::Status RingHash::RingHashEndpoint::UpdateChildPolicyLocked() { void RingHash::RingHashEndpoint::OnStateUpdate( grpc_connectivity_state new_state, const absl::Status& status, RefCountedPtr picker) { - if (GRPC_TRACE_FLAG_ENABLED(ring_hash_lb)) { - LOG(INFO) << "[RH " << ring_hash_.get() - << "] connectivity changed for endpoint " << this << " (" - << ring_hash_->endpoints_[index_].ToString() - << ", child_policy=" << child_policy_.get() - << "): prev_state=" << ConnectivityStateName(connectivity_state_) - << " new_state=" << ConnectivityStateName(new_state) << " (" - << status << ")"; - } + GRPC_TRACE_LOG(ring_hash_lb, INFO) + << "[RH " << ring_hash_.get() << "] connectivity changed for endpoint " + << this << " (" << ring_hash_->endpoints_[index_].ToString() + << ", child_policy=" << child_policy_.get() + << "): prev_state=" << ConnectivityStateName(connectivity_state_) + << " new_state=" << ConnectivityStateName(new_state) << " (" << status + << ")"; if (child_policy_ == nullptr) return; // Already orphaned. // Update state. const bool entered_transient_failure = @@ -756,15 +754,13 @@ void RingHash::UpdateAggregatedConnectivityStateLocked( state = GRPC_CHANNEL_TRANSIENT_FAILURE; start_connection_attempt = true; } - if (GRPC_TRACE_FLAG_ENABLED(ring_hash_lb)) { - LOG(INFO) << "[RH " << this << "] setting connectivity state to " - << ConnectivityStateName(state) << " (num_idle=" << num_idle - << ", num_connecting=" << num_connecting - << ", num_ready=" << num_ready - << ", num_transient_failure=" << num_transient_failure - << ", size=" << endpoints_.size() - << ") -- start_connection_attempt=" << start_connection_attempt; - } + GRPC_TRACE_LOG(ring_hash_lb, INFO) + << "[RH " << this << "] setting connectivity state to " + << ConnectivityStateName(state) << " (num_idle=" << num_idle + << ", num_connecting=" << num_connecting << ", num_ready=" << num_ready + << ", num_transient_failure=" << num_transient_failure + << ", size=" << endpoints_.size() + << ") -- start_connection_attempt=" << start_connection_attempt; // In TRANSIENT_FAILURE, report the last reported failure. // Otherwise, report OK. if (state == GRPC_CHANNEL_TRANSIENT_FAILURE) { @@ -833,13 +829,12 @@ void RingHash::UpdateAggregatedConnectivityStateLocked( auto it = endpoint_map_.find( EndpointAddressSet(endpoints_[first_idle_index].addresses())); CHECK(it != endpoint_map_.end()); - if (GRPC_TRACE_FLAG_ENABLED(ring_hash_lb)) { - LOG(INFO) << "[RH " << this - << "] triggering internal connection attempt for endpoint " - << it->second.get() << " (" - << endpoints_[first_idle_index].ToString() << ") (index " - << first_idle_index << " of " << endpoints_.size() << ")"; - } + GRPC_TRACE_LOG(ring_hash_lb, INFO) + << "[RH " << this + << "] triggering internal connection attempt for endpoint " + << it->second.get() << " (" << endpoints_[first_idle_index].ToString() + << ") (index " << first_idle_index << " of " << endpoints_.size() + << ")"; it->second->RequestConnectionLocked(); } } diff --git a/src/core/load_balancing/rls/rls.cc b/src/core/load_balancing/rls/rls.cc index 1248cfd639e..9138d94e974 100644 --- a/src/core/load_balancing/rls/rls.cc +++ b/src/core/load_balancing/rls/rls.cc @@ -885,12 +885,10 @@ void RlsLb::ChildPolicyWrapper::StartUpdate( lb_policy_->config_->child_policy_config_target_field_name(), target_, lb_policy_->config_->child_policy_config(), &errors); CHECK(child_policy_config.has_value()); - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << lb_policy_.get() - << "] ChildPolicyWrapper=" << this << " [" << target_ - << "]: validating update, config: " - << JsonDump(*child_policy_config); - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << lb_policy_.get() << "] ChildPolicyWrapper=" << this + << " [" << target_ + << "]: validating update, config: " << JsonDump(*child_policy_config); auto config = CoreConfiguration::Get().lb_policy_registry().ParseLoadBalancingConfig( *child_policy_config); @@ -921,12 +919,10 @@ absl::Status RlsLb::ChildPolicyWrapper::MaybeFinishUpdate() { create_args.args = lb_policy_->channel_args_; child_policy_ = MakeOrphanable(std::move(create_args), &rls_lb_trace); - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << lb_policy_.get() - << "] ChildPolicyWrapper=" << this << " [" << target_ - << "], created new child policy handler " - << child_policy_.get(); - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << lb_policy_.get() << "] ChildPolicyWrapper=" << this + << " [" << target_ << "], created new child policy handler " + << child_policy_.get(); grpc_pollset_set_add_pollset_set(child_policy_->interested_parties(), lb_policy_->interested_parties()); } @@ -949,13 +945,12 @@ absl::Status RlsLb::ChildPolicyWrapper::MaybeFinishUpdate() { void RlsLb::ChildPolicyWrapper::ChildPolicyHelper::UpdateState( grpc_connectivity_state state, const absl::Status& status, RefCountedPtr picker) { - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << wrapper_->lb_policy_.get() - << "] ChildPolicyWrapper=" << wrapper_.get() << " [" - << wrapper_->target_ << "] ChildPolicyHelper=" << this - << ": UpdateState(state=" << ConnectivityStateName(state) - << ", status=" << status << ", picker=" << picker.get() << ")"; - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << wrapper_->lb_policy_.get() + << "] ChildPolicyWrapper=" << wrapper_.get() << " [" << wrapper_->target_ + << "] ChildPolicyHelper=" << this + << ": UpdateState(state=" << ConnectivityStateName(state) + << ", status=" << status << ", picker=" << picker.get() << ")"; if (wrapper_->is_shutdown_) return; { MutexLock lock(&wrapper_->lb_policy_->mu_); @@ -1162,13 +1157,12 @@ void RlsLb::Cache::Entry::BackoffTimer::Orphan() { if (backoff_timer_task_handle_.has_value() && entry_->lb_policy_->channel_control_helper()->GetEventEngine()->Cancel( *backoff_timer_task_handle_)) { - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << entry_->lb_policy_.get() - << "] cache entry=" << entry_.get() << " " - << (entry_->is_shutdown_ ? "(shut down)" - : entry_->lru_iterator_->ToString()) - << ", backoff timer canceled"; - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << entry_->lb_policy_.get() + << "] cache entry=" << entry_.get() << " " + << (entry_->is_shutdown_ ? "(shut down)" + : entry_->lru_iterator_->ToString()) + << ", backoff timer canceled"; } backoff_timer_task_handle_.reset(); Unref(DEBUG_LOCATION, "Orphan"); @@ -1177,13 +1171,12 @@ void RlsLb::Cache::Entry::BackoffTimer::Orphan() { void RlsLb::Cache::Entry::BackoffTimer::OnBackoffTimerLocked() { { MutexLock lock(&entry_->lb_policy_->mu_); - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << entry_->lb_policy_.get() - << "] cache entry=" << entry_.get() << " " - << (entry_->is_shutdown_ ? "(shut down)" - : entry_->lru_iterator_->ToString()) - << ", backoff timer fired"; - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << entry_->lb_policy_.get() + << "] cache entry=" << entry_.get() << " " + << (entry_->is_shutdown_ ? "(shut down)" + : entry_->lru_iterator_->ToString()) + << ", backoff timer fired"; // Skip the update if Orphaned if (!backoff_timer_task_handle_.has_value()) return; backoff_timer_task_handle_.reset(); @@ -1248,28 +1241,25 @@ LoadBalancingPolicy::PickResult RlsLb::Cache::Entry::Pick(PickArgs args) { if (child_policy_wrapper->connectivity_state() == GRPC_CHANNEL_TRANSIENT_FAILURE && i < child_policy_wrappers_.size() - 1) { - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << lb_policy_.get() << "] cache entry=" << this - << " " << lru_iterator_->ToString() << ": target " - << child_policy_wrapper->target() << " (" << i << " of " - << child_policy_wrappers_.size() - << ") in state TRANSIENT_FAILURE; skipping"; - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << lb_policy_.get() << "] cache entry=" << this << " " + << lru_iterator_->ToString() << ": target " + << child_policy_wrapper->target() << " (" << i << " of " + << child_policy_wrappers_.size() + << ") in state TRANSIENT_FAILURE; skipping"; continue; } break; } // Child policy not in TRANSIENT_FAILURE or is the last target in // the list, so delegate. - if (GRPC_TRACE_FLAG_ENABLED(rls_lb)) { - LOG(INFO) << "[rlslb " << lb_policy_.get() << "] cache entry=" << this - << " " << lru_iterator_->ToString() << ": target " - << child_policy_wrapper->target() << " (" << i << " of " - << child_policy_wrappers_.size() << ") in state " - << ConnectivityStateName( - child_policy_wrapper->connectivity_state()) - << "; delegating"; - } + GRPC_TRACE_LOG(rls_lb, INFO) + << "[rlslb " << lb_policy_.get() << "] cache entry=" << this << " " + << lru_iterator_->ToString() << ": target " + << child_policy_wrapper->target() << " (" << i << " of " + << child_policy_wrappers_.size() << ") in state " + << ConnectivityStateName(child_policy_wrapper->connectivity_state()) + << "; delegating"; auto pick_result = child_policy_wrapper->Pick(args); lb_policy_->MaybeExportPickCount(kMetricTargetPicks, child_policy_wrapper->target(), pick_result); diff --git a/src/core/load_balancing/round_robin/round_robin.cc b/src/core/load_balancing/round_robin/round_robin.cc index d3cc4579a48..193c5a55821 100644 --- a/src/core/load_balancing/round_robin/round_robin.cc +++ b/src/core/load_balancing/round_robin/round_robin.cc @@ -35,7 +35,6 @@ #include "absl/types/optional.h" #include -#include #include #include "src/core/lib/channel/channel_args.h" @@ -185,12 +184,11 @@ RoundRobin::Picker::Picker( // the picker, see https://github.com/grpc/grpc-go/issues/2580. size_t index = absl::Uniform(parent->bit_gen_, 0, pickers_.size()); last_picked_index_.store(index, std::memory_order_relaxed); - if (GRPC_TRACE_FLAG_ENABLED(round_robin)) { - LOG(INFO) << "[RR " << parent_ << " picker " << this - << "] created picker from endpoint_list=" - << parent_->endpoint_list_.get() << " with " << pickers_.size() - << " READY children; last_picked_index_=" << index; - } + GRPC_TRACE_LOG(round_robin, INFO) + << "[RR " << parent_ << " picker " << this + << "] created picker from endpoint_list=" << parent_->endpoint_list_.get() + << " with " << pickers_.size() + << " READY children; last_picked_index_=" << index; } RoundRobin::PickResult RoundRobin::Picker::Pick(PickArgs args) { @@ -292,16 +290,13 @@ void RoundRobin::RoundRobinEndpointList::RoundRobinEndpoint::OnStateUpdate( grpc_connectivity_state new_state, const absl::Status& status) { auto* rr_endpoint_list = endpoint_list(); auto* round_robin = policy(); - if (GRPC_TRACE_FLAG_ENABLED(round_robin)) { - LOG(INFO) << "[RR " << round_robin << "] connectivity changed for child " - << this << ", endpoint_list " << rr_endpoint_list << " (index " - << Index() << " of " << rr_endpoint_list->size() - << "): prev_state=" - << (old_state.has_value() ? ConnectivityStateName(*old_state) - : "N/A") - << " new_state=" << ConnectivityStateName(new_state) << " (" - << status << ")"; - } + GRPC_TRACE_LOG(round_robin, INFO) + << "[RR " << round_robin << "] connectivity changed for child " << this + << ", endpoint_list " << rr_endpoint_list << " (index " << Index() + << " of " << rr_endpoint_list->size() << "): prev_state=" + << (old_state.has_value() ? ConnectivityStateName(*old_state) : "N/A") + << " new_state=" << ConnectivityStateName(new_state) << " (" << status + << ")"; if (new_state == GRPC_CHANNEL_IDLE) { GRPC_TRACE_LOG(round_robin, INFO) << "[RR " << round_robin << "] child " << this diff --git a/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc b/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc index 0c0d0f10488..785c0ff22d3 100644 --- a/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc +++ b/src/core/load_balancing/weighted_round_robin/static_stride_scheduler.cc @@ -25,7 +25,6 @@ #include "absl/functional/any_invocable.h" #include "absl/log/check.h" -#include #include namespace grpc_core { diff --git a/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc b/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc index fe2d9721b37..144f1b00888 100644 --- a/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +++ b/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc @@ -447,28 +447,24 @@ void WeightedRoundRobin::EndpointWeight::MaybeUpdateWeight( weight = qps / (utilization + penalty); } if (weight == 0) { - if (GRPC_TRACE_FLAG_ENABLED(weighted_round_robin_lb)) { - LOG(INFO) << "[WRR " << wrr_.get() << "] subchannel " << key_.ToString() - << ": qps=" << qps << ", eps=" << eps - << ", utilization=" << utilization - << ": error_util_penalty=" << error_utilization_penalty - << ", weight=" << weight << " (not updating)"; - } + GRPC_TRACE_LOG(weighted_round_robin_lb, INFO) + << "[WRR " << wrr_.get() << "] subchannel " << key_.ToString() + << ": qps=" << qps << ", eps=" << eps << ", utilization=" << utilization + << ": error_util_penalty=" << error_utilization_penalty + << ", weight=" << weight << " (not updating)"; return; } Timestamp now = Timestamp::Now(); // Grab the lock and update the data. MutexLock lock(&mu_); - if (GRPC_TRACE_FLAG_ENABLED(weighted_round_robin_lb)) { - LOG(INFO) << "[WRR " << wrr_.get() << "] subchannel " << key_.ToString() - << ": qps=" << qps << ", eps=" << eps - << ", utilization=" << utilization - << " error_util_penalty=" << error_utilization_penalty - << " : setting weight=" << weight << " weight_=" << weight_ - << " now=" << now.ToString() - << " last_update_time_=" << last_update_time_.ToString() - << " non_empty_since_=" << non_empty_since_.ToString(); - } + GRPC_TRACE_LOG(weighted_round_robin_lb, INFO) + << "[WRR " << wrr_.get() << "] subchannel " << key_.ToString() + << ": qps=" << qps << ", eps=" << eps << ", utilization=" << utilization + << " error_util_penalty=" << error_utilization_penalty + << " : setting weight=" << weight << " weight_=" << weight_ + << " now=" << now.ToString() + << " last_update_time_=" << last_update_time_.ToString() + << " non_empty_since_=" << non_empty_since_.ToString(); if (non_empty_since_ == Timestamp::InfFuture()) non_empty_since_ = now; weight_ = weight; last_update_time_ = now; @@ -478,16 +474,14 @@ float WeightedRoundRobin::EndpointWeight::GetWeight( Timestamp now, Duration weight_expiration_period, Duration blackout_period, uint64_t* num_not_yet_usable, uint64_t* num_stale) { MutexLock lock(&mu_); - if (GRPC_TRACE_FLAG_ENABLED(weighted_round_robin_lb)) { - LOG(INFO) << "[WRR " << wrr_.get() << "] subchannel " << key_.ToString() - << ": getting weight: now=" << now.ToString() - << " weight_expiration_period=" - << weight_expiration_period.ToString() - << " blackout_period=" << blackout_period.ToString() - << " last_update_time_=" << last_update_time_.ToString() - << " non_empty_since_=" << non_empty_since_.ToString() - << " weight_=" << weight_; - } + GRPC_TRACE_LOG(weighted_round_robin_lb, INFO) + << "[WRR " << wrr_.get() << "] subchannel " << key_.ToString() + << ": getting weight: now=" << now.ToString() + << " weight_expiration_period=" << weight_expiration_period.ToString() + << " blackout_period=" << blackout_period.ToString() + << " last_update_time_=" << last_update_time_.ToString() + << " non_empty_since_=" << non_empty_since_.ToString() + << " weight_=" << weight_; // If the most recent update was longer ago than the expiration // period, reset non_empty_since_ so that we apply the blackout period // again if we start getting data again in the future, and return 0. @@ -865,16 +859,13 @@ void WeightedRoundRobin::WrrEndpointList::WrrEndpoint::OnStateUpdate( grpc_connectivity_state new_state, const absl::Status& status) { auto* wrr_endpoint_list = endpoint_list(); auto* wrr = policy(); - if (GRPC_TRACE_FLAG_ENABLED(weighted_round_robin_lb)) { - LOG(INFO) << "[WRR " << wrr << "] connectivity changed for child " << this - << ", endpoint_list " << wrr_endpoint_list << " (index " - << Index() << " of " << wrr_endpoint_list->size() - << "): prev_state=" - << (old_state.has_value() ? ConnectivityStateName(*old_state) - : "N/A") - << " new_state=" << ConnectivityStateName(new_state) << " (" - << status << ")"; - } + GRPC_TRACE_LOG(weighted_round_robin_lb, INFO) + << "[WRR " << wrr << "] connectivity changed for child " << this + << ", endpoint_list " << wrr_endpoint_list << " (index " << Index() + << " of " << wrr_endpoint_list->size() << "): prev_state=" + << (old_state.has_value() ? ConnectivityStateName(*old_state) : "N/A") + << " new_state=" << ConnectivityStateName(new_state) << " (" << status + << ")"; if (new_state == GRPC_CHANNEL_IDLE) { GRPC_TRACE_LOG(weighted_round_robin_lb, INFO) << "[WRR " << wrr << "] child " << this diff --git a/src/core/load_balancing/weighted_target/weighted_target.cc b/src/core/load_balancing/weighted_target/weighted_target.cc index dc9e3f9ce11..9724720fc65 100644 --- a/src/core/load_balancing/weighted_target/weighted_target.cc +++ b/src/core/load_balancing/weighted_target/weighted_target.cc @@ -402,13 +402,10 @@ void WeightedTargetLb::UpdateStateLocked() { continue; } auto child_picker = child->picker(); - if (GRPC_TRACE_FLAG_ENABLED(weighted_target_lb)) { - LOG(INFO) << "[weighted_target_lb " << this << "] child=" << child_name - << " state=" - << ConnectivityStateName(child->connectivity_state()) - << " weight=" << child->weight() - << " picker=" << child_picker.get(); - } + GRPC_TRACE_LOG(weighted_target_lb, INFO) + << "[weighted_target_lb " << this << "] child=" << child_name + << " state=" << ConnectivityStateName(child->connectivity_state()) + << " weight=" << child->weight() << " picker=" << child_picker.get(); switch (child->connectivity_state()) { case GRPC_CHANNEL_READY: { CHECK_GT(child->weight(), 0u); @@ -488,13 +485,11 @@ WeightedTargetLb::WeightedChild::DelayedRemovalTimer::DelayedRemovalTimer( void WeightedTargetLb::WeightedChild::DelayedRemovalTimer::Orphan() { if (timer_handle_.has_value()) { - if (GRPC_TRACE_FLAG_ENABLED(weighted_target_lb)) { - LOG(INFO) << "[weighted_target_lb " - << weighted_child_->weighted_target_policy_.get() - << "] WeightedChild " << weighted_child_.get() << " " - << weighted_child_->name_ - << ": cancelling delayed removal timer"; - } + GRPC_TRACE_LOG(weighted_target_lb, INFO) + << "[weighted_target_lb " + << weighted_child_->weighted_target_policy_.get() << "] WeightedChild " + << weighted_child_.get() << " " << weighted_child_->name_ + << ": cancelling delayed removal timer"; weighted_child_->weighted_target_policy_->channel_control_helper() ->GetEventEngine() ->Cancel(*timer_handle_); @@ -619,13 +614,11 @@ void WeightedTargetLb::WeightedChild::OnConnectivityStateUpdateLocked( RefCountedPtr picker) { // Cache the picker in the WeightedChild. picker_ = std::move(picker); - if (GRPC_TRACE_FLAG_ENABLED(weighted_target_lb)) { - LOG(INFO) << "[weighted_target_lb " << weighted_target_policy_.get() - << "] WeightedChild " << this << " " << name_ - << ": connectivity state update: state=" - << ConnectivityStateName(state) << " (" << status - << ") picker=" << picker_.get(); - } + GRPC_TRACE_LOG(weighted_target_lb, INFO) + << "[weighted_target_lb " << weighted_target_policy_.get() + << "] WeightedChild " << this << " " << name_ + << ": connectivity state update: state=" << ConnectivityStateName(state) + << " (" << status << ") picker=" << picker_.get(); // If the child reports IDLE, immediately tell it to exit idle. if (state == GRPC_CHANNEL_IDLE) child_policy_->ExitIdleLocked(); // Decide what state to report for aggregation purposes. diff --git a/src/core/load_balancing/xds/xds_cluster_impl.cc b/src/core/load_balancing/xds/xds_cluster_impl.cc index 9a06ab8eeb1..911e5e44c41 100644 --- a/src/core/load_balancing/xds/xds_cluster_impl.cc +++ b/src/core/load_balancing/xds/xds_cluster_impl.cc @@ -35,7 +35,6 @@ #include "absl/types/variant.h" #include -#include #include #include "src/core/client_channel/client_channel_internal.h" @@ -293,6 +292,8 @@ class XdsClusterImplLb final : public LoadBalancingPolicy { // Current config from the resolver. RefCountedPtr config_; std::shared_ptr cluster_resource_; + RefCountedStringValue service_telemetry_label_; + RefCountedStringValue namespace_telemetry_label_; RefCountedPtr drop_config_; // Current concurrent number of requests. @@ -397,10 +398,9 @@ XdsClusterImplLb::Picker::Picker(XdsClusterImplLb* xds_cluster_impl_lb, : call_counter_(xds_cluster_impl_lb->call_counter_), max_concurrent_requests_( xds_cluster_impl_lb->cluster_resource_->max_concurrent_requests), - service_telemetry_label_( - xds_cluster_impl_lb->cluster_resource_->service_telemetry_label), + service_telemetry_label_(xds_cluster_impl_lb->service_telemetry_label_), namespace_telemetry_label_( - xds_cluster_impl_lb->cluster_resource_->namespace_telemetry_label), + xds_cluster_impl_lb->namespace_telemetry_label_), drop_config_(xds_cluster_impl_lb->drop_config_), drop_stats_(xds_cluster_impl_lb->drop_stats_), picker_(std::move(picker)) { @@ -648,6 +648,19 @@ absl::Status XdsClusterImplLb::UpdateLocked(UpdateArgs args) { // Update config state, now that we're done comparing old and new fields. config_ = std::move(new_config); cluster_resource_ = new_cluster_config.cluster; + auto it2 = + cluster_resource_->metadata.find("com.google.csm.telemetry_labels"); + if (it2 != cluster_resource_->metadata.end()) { + auto& json_object = it2->second.object(); + auto it3 = json_object.find("service_name"); + if (it3 != json_object.end() && it3->second.type() == Json::Type::kString) { + service_telemetry_label_ = RefCountedStringValue(it3->second.string()); + } + it3 = json_object.find("service_namespace"); + if (it3 != json_object.end() && it3->second.type() == Json::Type::kString) { + namespace_telemetry_label_ = RefCountedStringValue(it3->second.string()); + } + } drop_config_ = endpoint_config->endpoints != nullptr ? endpoint_config->endpoints->drop_config : nullptr; @@ -741,12 +754,10 @@ void XdsClusterImplLb::MaybeUpdatePickerLocked() { // Otherwise, update only if we have a child picker. if (picker_ != nullptr) { auto drop_picker = MakeRefCounted(this, picker_); - if (GRPC_TRACE_FLAG_ENABLED(xds_cluster_impl_lb)) { - LOG(INFO) << "[xds_cluster_impl_lb " << this - << "] updating connectivity: state=" - << ConnectivityStateName(state_) << " status=(" << status_ - << ") picker=" << drop_picker.get(); - } + GRPC_TRACE_LOG(xds_cluster_impl_lb, INFO) + << "[xds_cluster_impl_lb " << this + << "] updating connectivity: state=" << ConnectivityStateName(state_) + << " status=(" << status_ << ") picker=" << drop_picker.get(); channel_control_helper()->UpdateState(state_, status_, std::move(drop_picker)); } @@ -841,12 +852,11 @@ void XdsClusterImplLb::Helper::UpdateState( grpc_connectivity_state state, const absl::Status& status, RefCountedPtr picker) { if (parent()->shutting_down_) return; - if (GRPC_TRACE_FLAG_ENABLED(xds_cluster_impl_lb)) { - LOG(INFO) << "[xds_cluster_impl_lb " << parent() - << "] child connectivity state update: state=" - << ConnectivityStateName(state) << " (" << status - << ") picker=" << picker.get(); - } + GRPC_TRACE_LOG(xds_cluster_impl_lb, INFO) + << "[xds_cluster_impl_lb " << parent() + << "] child connectivity state update: state=" + << ConnectivityStateName(state) << " (" << status + << ") picker=" << picker.get(); // Save the state and picker. parent()->state_ = state; parent()->status_ = status; diff --git a/src/core/load_balancing/xds/xds_cluster_manager.cc b/src/core/load_balancing/xds/xds_cluster_manager.cc index ec5aeb47b62..5d3dfd9e8bc 100644 --- a/src/core/load_balancing/xds/xds_cluster_manager.cc +++ b/src/core/load_balancing/xds/xds_cluster_manager.cc @@ -531,13 +531,12 @@ void XdsClusterManagerLb::ClusterChild::OnDelayedRemovalTimerLocked() { void XdsClusterManagerLb::ClusterChild::Helper::UpdateState( grpc_connectivity_state state, const absl::Status& status, RefCountedPtr picker) { - if (GRPC_TRACE_FLAG_ENABLED(xds_cluster_manager_lb)) { - LOG(INFO) << "[xds_cluster_manager_lb " - << xds_cluster_manager_child_->xds_cluster_manager_policy_.get() - << "] child " << xds_cluster_manager_child_->name_ - << ": received update: state=" << ConnectivityStateName(state) - << " (" << status << ") picker=" << picker.get(); - } + GRPC_TRACE_LOG(xds_cluster_manager_lb, INFO) + << "[xds_cluster_manager_lb " + << xds_cluster_manager_child_->xds_cluster_manager_policy_.get() + << "] child " << xds_cluster_manager_child_->name_ + << ": received update: state=" << ConnectivityStateName(state) << " (" + << status << ") picker=" << picker.get(); if (xds_cluster_manager_child_->xds_cluster_manager_policy_->shutting_down_) { return; } diff --git a/src/core/load_balancing/xds/xds_override_host.cc b/src/core/load_balancing/xds/xds_override_host.cc index dbd8ff9b479..a3de3e6b97c 100644 --- a/src/core/load_balancing/xds/xds_override_host.cc +++ b/src/core/load_balancing/xds/xds_override_host.cc @@ -759,13 +759,10 @@ absl::Status XdsOverrideHostLb::UpdateLocked(UpdateArgs args) { args_ = std::move(args.args); override_host_status_set_ = it->second->cluster->override_host_statuses; connection_idle_timeout_ = it->second->cluster->connection_idle_timeout; - if (GRPC_TRACE_FLAG_ENABLED(xds_override_host_lb)) { - LOG(INFO) << "[xds_override_host_lb " << this - << "] override host status set: " - << override_host_status_set_.ToString() - << " connection idle timeout: " - << connection_idle_timeout_.ToString(); - } + GRPC_TRACE_LOG(xds_override_host_lb, INFO) + << "[xds_override_host_lb " << this + << "] override host status set: " << override_host_status_set_.ToString() + << " connection idle timeout: " << connection_idle_timeout_.ToString(); // Update address map and wrap endpoint iterator for child policy. if (args.addresses.ok()) { UpdateAddressMap(**args.addresses); @@ -796,12 +793,11 @@ void XdsOverrideHostLb::MaybeUpdatePickerLocked() { if (picker_ != nullptr) { auto xds_override_host_picker = MakeRefCounted( RefAsSubclass(), picker_, override_host_status_set_); - if (GRPC_TRACE_FLAG_ENABLED(xds_override_host_lb)) { - LOG(INFO) << "[xds_override_host_lb " << this - << "] updating connectivity: state=" - << ConnectivityStateName(state_) << " status=(" << status_ - << ") picker=" << xds_override_host_picker.get(); - } + GRPC_TRACE_LOG(xds_override_host_lb, INFO) + << "[xds_override_host_lb " << this + << "] updating connectivity: state=" << ConnectivityStateName(state_) + << " status=(" << status_ + << ") picker=" << xds_override_host_picker.get(); channel_control_helper()->UpdateState(state_, status_, std::move(xds_override_host_picker)); } @@ -843,12 +839,11 @@ void XdsOverrideHostLb::UpdateAddressMap( // Skip draining hosts if not in the override status set. if (status.status() == XdsHealthStatus::kDraining && !override_host_status_set_.Contains(status)) { - if (GRPC_TRACE_FLAG_ENABLED(xds_override_host_lb)) { - LOG(INFO) << "[xds_override_host_lb " << this << "] endpoint " - << endpoint.ToString() - << ": draining but not in override_host_status set -- " - "ignoring"; - } + GRPC_TRACE_LOG(xds_override_host_lb, INFO) + << "[xds_override_host_lb " << this << "] endpoint " + << endpoint.ToString() + << ": draining but not in override_host_status set -- " + "ignoring"; return; } std::vector addresses; @@ -905,13 +900,11 @@ void XdsOverrideHostLb::UpdateAddressMap( it = subchannel_map_.emplace(address, MakeRefCounted()) .first; } - if (GRPC_TRACE_FLAG_ENABLED(xds_override_host_lb)) { - LOG(INFO) << "[xds_override_host_lb " << this << "] map key " << address - << ": setting " - << "eds_health_status=" - << address_info.eds_health_status.ToString() - << " address_list=" << address_info.address_list.c_str(); - } + GRPC_TRACE_LOG(xds_override_host_lb, INFO) + << "[xds_override_host_lb " << this << "] map key " << address + << ": setting " + << "eds_health_status=" << address_info.eds_health_status.ToString() + << " address_list=" << address_info.address_list.c_str(); it->second->set_eds_health_status(address_info.eds_health_status); it->second->set_address_list(std::move(address_info.address_list)); // Check the entry's last_used_time to determine the next time at diff --git a/src/core/load_balancing/xds/xds_wrr_locality.cc b/src/core/load_balancing/xds/xds_wrr_locality.cc index 3f2ef77583d..7435032ceeb 100644 --- a/src/core/load_balancing/xds/xds_wrr_locality.cc +++ b/src/core/load_balancing/xds/xds_wrr_locality.cc @@ -29,7 +29,6 @@ #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/resolver/binder/binder_resolver.cc b/src/core/resolver/binder/binder_resolver.cc index 7cd03f29193..f8da4cfd5ed 100644 --- a/src/core/resolver/binder/binder_resolver.cc +++ b/src/core/resolver/binder/binder_resolver.cc @@ -43,8 +43,6 @@ #include "absl/strings/string_view.h" #include "absl/strings/strip.h" -#include - #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/orphanable.h" diff --git a/src/core/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/resolver/dns/c_ares/dns_resolver_ares.cc index 67993abc5b7..dbd8fc34a3e 100644 --- a/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/resolver/dns/c_ares/dns_resolver_ares.cc @@ -34,7 +34,6 @@ #include #include -#include #include #include "src/core/lib/config/core_configuration.h" diff --git a/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc index 07738942206..ce54f647f15 100644 --- a/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +++ b/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc @@ -39,8 +39,6 @@ #include "absl/log/check.h" #include "absl/strings/str_cat.h" -#include - #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" diff --git a/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc b/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc index 142958f104f..a9f257f5b4d 100644 --- a/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +++ b/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc @@ -33,7 +33,6 @@ #include "absl/strings/str_format.h" #include -#include #include #include #include diff --git a/src/core/resolver/dns/dns_resolver_plugin.cc b/src/core/resolver/dns/dns_resolver_plugin.cc index 9abce007fd5..0a3c78488ed 100644 --- a/src/core/resolver/dns/dns_resolver_plugin.cc +++ b/src/core/resolver/dns/dns_resolver_plugin.cc @@ -18,7 +18,6 @@ #include "absl/log/log.h" #include "absl/strings/match.h" -#include #include #include "src/core/lib/config/config_vars.h" diff --git a/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc b/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc index 44ad3995857..3efb937523d 100644 --- a/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +++ b/src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc @@ -77,12 +77,6 @@ using grpc_event_engine::experimental::EventEngine; // TODO(hork): Add a test that checks for proper authority from balancer // addresses. -#define GRPC_EVENT_ENGINE_RESOLVER_TRACE(format, ...) \ - if (GRPC_TRACE_FLAG_ENABLED(event_engine_client_channel_resolver)) { \ - VLOG(2) << "(event_engine client channel resolver) " \ - << absl::StrFormat(format, __VA_ARGS__); \ - } - // ---------------------------------------------------------------------------- // EventEngineClientChannelDNSResolver // ---------------------------------------------------------------------------- @@ -221,9 +215,10 @@ EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: event_engine_resolver_(std::move(event_engine_resolver)) { // Locking to prevent completion before all records are queried MutexLock lock(&on_resolved_mu_); - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p Starting hostname resolution for %s", resolver_.get(), - resolver_->name_to_resolve().c_str()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << resolver_.get() << " Starting hostname resolution for " + << resolver_->name_to_resolve(); is_hostname_inflight_ = true; event_engine_resolver_->LookupHostname( [self = Ref(DEBUG_LOCATION, "OnHostnameResolved")]( @@ -236,9 +231,10 @@ EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: }, resolver_->name_to_resolve(), kDefaultSecurePort); if (resolver_->enable_srv_queries_) { - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p Starting SRV record resolution for %s", - resolver_.get(), resolver_->name_to_resolve().c_str()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << resolver_.get() << " Starting SRV record resolution for " + << resolver_->name_to_resolve(); is_srv_inflight_ = true; event_engine_resolver_->LookupSRV( [self = Ref(DEBUG_LOCATION, "OnSRVResolved")]( @@ -252,9 +248,10 @@ EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: absl::StrCat("_grpclb._tcp.", resolver_->name_to_resolve())); } if (resolver_->request_service_config_) { - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p Starting TXT record resolution for %s", - resolver_.get(), resolver_->name_to_resolve().c_str()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << resolver_.get() << " Starting TXT record resolution for " + << resolver_->name_to_resolve(); is_txt_inflight_ = true; event_engine_resolver_->LookupTXT( [self = Ref(DEBUG_LOCATION, "OnTXTResolved")]( @@ -303,8 +300,9 @@ void EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: void EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: OnTimeout() { MutexLock lock(&on_resolved_mu_); - GRPC_EVENT_ENGINE_RESOLVER_TRACE("DNSResolver::%p OnTimeout", - resolver_.get()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << resolver_.get() << " OnTimeout"; timeout_handle_.reset(); event_engine_resolver_.reset(); } @@ -368,9 +366,10 @@ void EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: } // Do a subsequent hostname query since SRV records were returned for (auto& srv_record : *srv_records) { - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p Starting balancer hostname resolution for %s:%d", - resolver_.get(), srv_record.host.c_str(), srv_record.port); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << resolver_.get() << " Starting balancer hostname resolution for " + << srv_record.host << ":" << srv_record.port; ++number_of_balancer_hostnames_initiated_; event_engine_resolver_->LookupHostname( [host = srv_record.host, @@ -446,9 +445,10 @@ void EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: // Found a service config record. service_config_json_ = result->substr(kServiceConfigAttributePrefix.size()); - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p found service config: %s", - event_engine_resolver_.get(), service_config_json_->c_str()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << event_engine_resolver_.get() + << " found service config: " << service_config_json_->c_str(); } else { service_config_json_ = absl::UnavailableError(absl::StrCat( "failed to find attribute prefix: ", kServiceConfigAttributePrefix, @@ -492,9 +492,10 @@ void EventEngineClientChannelDNSResolver::EventEngineDNSRequestWrapper:: return; } if (service_config->empty()) return; - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p selected service config choice: %s", - event_engine_resolver_.get(), service_config->c_str()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" + << event_engine_resolver_.get() + << " selected service config choice: " << service_config->c_str(); result->service_config = ServiceConfigImpl::Create(resolver_->channel_args(), *service_config); if (!result->service_config.ok()) { @@ -511,20 +512,19 @@ absl::optional EventEngineClientChannelDNSResolver:: if (is_hostname_inflight_ || is_srv_inflight_ || is_txt_inflight_ || number_of_balancer_hostnames_resolved_ != number_of_balancer_hostnames_initiated_) { - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p OnResolved() waiting for results (hostname: %s, " - "srv: %s, " - "txt: %s, " - "balancer addresses: %" PRIuPTR "/%" PRIuPTR " complete", - this, is_hostname_inflight_ ? "waiting" : "done", - is_srv_inflight_ ? "waiting" : "done", - is_txt_inflight_ ? "waiting" : "done", - number_of_balancer_hostnames_resolved_, - number_of_balancer_hostnames_initiated_); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" << this + << " OnResolved() waiting for results (hostname: " + << (is_hostname_inflight_ ? "waiting" : "done") + << ", srv: " << (is_srv_inflight_ ? "waiting" : "done") + << ", txt: " << (is_txt_inflight_ ? "waiting" : "done") + << ", balancer addresses: " << number_of_balancer_hostnames_resolved_ + << "/" << number_of_balancer_hostnames_initiated_ << " complete"; return absl::nullopt; } - GRPC_EVENT_ENGINE_RESOLVER_TRACE( - "DNSResolver::%p OnResolvedLocked() proceeding", this); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) DNSResolver::" << this + << " OnResolvedLocked() proceeding"; Resolver::Result result; result.args = resolver_->channel_args(); // If both addresses and balancer addresses failed, return an error for both @@ -538,7 +538,8 @@ absl::optional EventEngineClientChannelDNSResolver:: // return an error. Validation errors may be empty. status = absl::UnavailableError("No results from DNS queries"); } - GRPC_EVENT_ENGINE_RESOLVER_TRACE("%s", status.message().data()); + GRPC_TRACE_VLOG(event_engine_client_channel_resolver, 2) + << "(event_engine client channel resolver) " << status.message().data(); result.addresses = status; result.service_config = status; return std::move(result); diff --git a/src/core/resolver/dns/native/dns_resolver.cc b/src/core/resolver/dns/native/dns_resolver.cc index 0fb59889d06..1a3ca55f9b0 100644 --- a/src/core/resolver/dns/native/dns_resolver.cc +++ b/src/core/resolver/dns/native/dns_resolver.cc @@ -90,15 +90,11 @@ NativeClientChannelDNSResolver::NativeClientChannelDNSResolver( .set_max_backoff(Duration::Milliseconds( GRPC_DNS_RECONNECT_MAX_BACKOFF_SECONDS * 1000)), &dns_resolver_trace) { - if (GRPC_TRACE_FLAG_ENABLED(dns_resolver)) { - VLOG(2) << "[dns_resolver=" << this << "] created"; - } + GRPC_TRACE_VLOG(dns_resolver, 2) << "[dns_resolver=" << this << "] created"; } NativeClientChannelDNSResolver::~NativeClientChannelDNSResolver() { - if (GRPC_TRACE_FLAG_ENABLED(dns_resolver)) { - VLOG(2) << "[dns_resolver=" << this << "] destroyed"; - } + GRPC_TRACE_VLOG(dns_resolver, 2) << "[dns_resolver=" << this << "] destroyed"; } OrphanablePtr NativeClientChannelDNSResolver::StartRequest() { @@ -107,19 +103,17 @@ OrphanablePtr NativeClientChannelDNSResolver::StartRequest() { absl::bind_front(&NativeClientChannelDNSResolver::OnResolved, this), name_to_resolve(), kDefaultSecurePort, kDefaultDNSRequestTimeout, interested_parties(), /*name_server=*/""); - if (GRPC_TRACE_FLAG_ENABLED(dns_resolver)) { - VLOG(2) << "[dns_resolver=" << this << "] starting request=" - << DNSResolver::HandleToString(dns_request_handle); - } + GRPC_TRACE_VLOG(dns_resolver, 2) + << "[dns_resolver=" << this << "] starting request=" + << DNSResolver::HandleToString(dns_request_handle); return MakeOrphanable(); } void NativeClientChannelDNSResolver::OnResolved( absl::StatusOr> addresses_or) { - if (GRPC_TRACE_FLAG_ENABLED(dns_resolver)) { - VLOG(2) << "[dns_resolver=" << this - << "] request complete, status=" << addresses_or.status(); - } + GRPC_TRACE_VLOG(dns_resolver, 2) + << "[dns_resolver=" << this + << "] request complete, status=" << addresses_or.status(); // Convert result from iomgr DNS API into Resolver::Result. Result result; if (addresses_or.ok()) { diff --git a/src/core/resolver/endpoint_addresses.cc b/src/core/resolver/endpoint_addresses.cc index 19fbfdfbc16..7fc7d8d3335 100644 --- a/src/core/resolver/endpoint_addresses.cc +++ b/src/core/resolver/endpoint_addresses.cc @@ -30,7 +30,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" -#include #include #include "src/core/lib/address_utils/sockaddr_utils.h" diff --git a/src/core/resolver/fake/fake_resolver.cc b/src/core/resolver/fake/fake_resolver.cc index 99703f8a6ea..b1659f84bf4 100644 --- a/src/core/resolver/fake/fake_resolver.cc +++ b/src/core/resolver/fake/fake_resolver.cc @@ -26,7 +26,6 @@ #include "absl/log/check.h" #include "absl/strings/string_view.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/resolver/xds/xds_resolver.cc b/src/core/resolver/xds/xds_resolver.cc index 53c218a29ec..a8880674c4d 100644 --- a/src/core/resolver/xds/xds_resolver.cc +++ b/src/core/resolver/xds/xds_resolver.cc @@ -1076,12 +1076,11 @@ void XdsResolver::GenerateResult() { Result result; result.addresses.emplace(); result.service_config = CreateServiceConfig(); - if (GRPC_TRACE_FLAG_ENABLED(xds_resolver)) { - LOG(INFO) << "[xds_resolver " << this << "] generated service config: " - << (result.service_config.ok() - ? ((*result.service_config)->json_string()) - : result.service_config.status().ToString()); - } + GRPC_TRACE_LOG(xds_resolver, INFO) + << "[xds_resolver " << this << "] generated service config: " + << (result.service_config.ok() + ? ((*result.service_config)->json_string()) + : result.service_config.status().ToString()); result.args = args_.SetObject(xds_client_.Ref(DEBUG_LOCATION, "xds resolver result")) .SetObject(config_selector) diff --git a/src/core/server/server_config_selector_filter.cc b/src/core/server/server_config_selector_filter.cc index 4dfe26fb5c5..3773eeb3b78 100644 --- a/src/core/server/server_config_selector_filter.cc +++ b/src/core/server/server_config_selector_filter.cc @@ -24,7 +24,6 @@ #include "absl/status/statusor.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/service_config/service_config_channel_arg_filter.cc b/src/core/service_config/service_config_channel_arg_filter.cc index 96a5b3f8b81..063ecbd987a 100644 --- a/src/core/service_config/service_config_channel_arg_filter.cc +++ b/src/core/service_config/service_config_channel_arg_filter.cc @@ -28,7 +28,6 @@ #include "absl/types/optional.h" #include -#include #include #include "src/core/ext/filters/message_size/message_size_filter.h" diff --git a/src/core/service_config/service_config_impl.h b/src/core/service_config/service_config_impl.h index f617163a956..a36a803abf3 100644 --- a/src/core/service_config/service_config_impl.h +++ b/src/core/service_config/service_config_impl.h @@ -29,7 +29,6 @@ #include "absl/strings/string_view.h" #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/telemetry/call_tracer.cc b/src/core/telemetry/call_tracer.cc index f09721a0622..873db2d192b 100644 --- a/src/core/telemetry/call_tracer.cc +++ b/src/core/telemetry/call_tracer.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/promise/context.h" diff --git a/src/core/telemetry/metrics.h b/src/core/telemetry/metrics.h index 589aa7964ec..2f60ff541dc 100644 --- a/src/core/telemetry/metrics.h +++ b/src/core/telemetry/metrics.h @@ -25,7 +25,6 @@ #include "absl/strings/string_view.h" #include "absl/types/span.h" -#include #include #include diff --git a/src/core/tsi/alts/handshaker/alts_shared_resource.cc b/src/core/tsi/alts/handshaker/alts_shared_resource.cc index 03e2b4439e1..8407ee7cac3 100644 --- a/src/core/tsi/alts/handshaker/alts_shared_resource.cc +++ b/src/core/tsi/alts/handshaker/alts_shared_resource.cc @@ -20,7 +20,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/tsi/alts/handshaker/transport_security_common_api.h b/src/core/tsi/alts/handshaker/transport_security_common_api.h index a8cb4c3f79d..81819c09e76 100644 --- a/src/core/tsi/alts/handshaker/transport_security_common_api.h +++ b/src/core/tsi/alts/handshaker/transport_security_common_api.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc index 40046f0769e..2ae8bb534da 100644 --- a/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +++ b/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/tsi/ssl/session_cache/ssl_session_cache.cc b/src/core/tsi/ssl/session_cache/ssl_session_cache.cc index de89e3e85fe..d6c5d556b9c 100644 --- a/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +++ b/src/core/tsi/ssl/session_cache/ssl_session_cache.cc @@ -21,7 +21,6 @@ #include "absl/log/check.h" #include "absl/log/log.h" -#include #include #include diff --git a/src/core/util/alloc.cc b/src/core/util/alloc.cc index a8b92260a92..6afba483d4c 100644 --- a/src/core/util/alloc.cc +++ b/src/core/util/alloc.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/gcp_metadata_query.cc b/src/core/util/gcp_metadata_query.cc index db2c382bead..351f6e7a578 100644 --- a/src/core/util/gcp_metadata_query.cc +++ b/src/core/util/gcp_metadata_query.cc @@ -35,7 +35,6 @@ #include #include #include -#include #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" diff --git a/src/core/util/http_client/httpcli.cc b/src/core/util/http_client/httpcli.cc index d60b1cd68b1..4220cb58b65 100644 --- a/src/core/util/http_client/httpcli.cc +++ b/src/core/util/http_client/httpcli.cc @@ -33,19 +33,19 @@ #include #include #include -#include #include "src/core/handshaker/handshaker.h" #include "src/core/handshaker/handshaker_registry.h" #include "src/core/handshaker/tcp_connect/tcp_connect_handshaker.h" +#include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/event_engine/tcp_socket_utils.h" #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/pollset_set.h" +#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/resource_quota/api.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/security_connector/security_connector.h" @@ -58,9 +58,6 @@ namespace grpc_core { namespace { -using grpc_event_engine::experimental::EventEngine; -using grpc_event_engine::experimental::ResolvedAddressToURI; - grpc_httpcli_get_override g_get_override; grpc_httpcli_post_override g_post_override; grpc_httpcli_put_override g_put_override; @@ -80,8 +77,7 @@ OrphanablePtr HttpRequest::Get( // Note that capturing request here assumes it will remain alive // until after Start is called. This avoids making a copy as this // code path is only used for test mocks. - g_get_override(request, uri.authority().c_str(), uri.path().c_str(), - deadline, on_done, response); + g_get_override(request, uri, deadline, on_done, response); }; } std::string name = @@ -103,9 +99,9 @@ OrphanablePtr HttpRequest::Post( if (g_post_override != nullptr) { test_only_generate_response = [request, uri, deadline, on_done, response]() { - g_post_override(request, uri.authority().c_str(), uri.path().c_str(), - request->body, request->body_length, deadline, on_done, - response); + g_post_override(request, uri, + absl::string_view(request->body, request->body_length), + deadline, on_done, response); }; } std::string name = @@ -127,9 +123,9 @@ OrphanablePtr HttpRequest::Put( if (g_put_override != nullptr) { test_only_generate_response = [request, uri, deadline, on_done, response]() { - g_put_override(request, uri.authority().c_str(), uri.path().c_str(), - request->body, request->body_length, deadline, on_done, - response); + g_put_override(request, uri, + absl::string_view(request->body, request->body_length), + deadline, on_done, response); }; } std::string name = @@ -175,10 +171,7 @@ HttpRequest::HttpRequest( pollent_(pollent), pollset_set_(grpc_pollset_set_create()), test_only_generate_response_(std::move(test_only_generate_response)), - resolver_( - ChannelArgs::FromC(channel_args_) - .GetObjectRef() - ->GetDNSResolver(EventEngine::DNSResolver::ResolverOptions())) { + resolver_(GetDNSResolver()) { grpc_http_parser_init(&parser_, GRPC_HTTP_RESPONSE, response); grpc_slice_buffer_init(&incoming_); grpc_slice_buffer_init(&outgoing_); @@ -212,14 +205,11 @@ void HttpRequest::Start() { test_only_generate_response_.value()(); return; } - if (!resolver_.ok()) { - Finish(resolver_.status()); - return; - } Ref().release(); // ref held by pending DNS resolution - (*resolver_) - ->LookupHostname(absl::bind_front(&HttpRequest::OnResolved, this), - uri_.authority(), uri_.scheme()); + dns_request_handle_ = resolver_->LookupHostname( + absl::bind_front(&HttpRequest::OnResolved, this), uri_.authority(), + uri_.scheme(), kDefaultDNSRequestTimeout, pollset_set_, + /*name_server=*/""); } void HttpRequest::Orphan() { @@ -228,8 +218,10 @@ void HttpRequest::Orphan() { CHECK(!cancelled_); cancelled_ = true; // cancel potentially pending DNS resolution. - if (*resolver_ != nullptr) { - resolver_->reset(); + if (dns_request_handle_.has_value() && + resolver_->Cancel(dns_request_handle_.value())) { + Finish(GRPC_ERROR_CREATE("cancelled during DNS resolution")); + Unref(); } if (handshake_mgr_ != nullptr) { // Shutdown will cancel any ongoing tcp connect. @@ -245,7 +237,8 @@ void HttpRequest::AppendError(grpc_error_handle error) { if (overall_error_.ok()) { overall_error_ = GRPC_ERROR_CREATE("Failed HTTP/1 client request"); } - auto addr_text = ResolvedAddressToURI(addresses_[next_address_ - 1]); + const grpc_resolved_address* addr = &addresses_[next_address_ - 1]; + auto addr_text = grpc_sockaddr_to_uri(addr); if (addr_text.ok()) error = AddMessagePrefix(*addr_text, std::move(error)); overall_error_ = grpc_error_add_child(overall_error_, std::move(error)); } @@ -315,7 +308,7 @@ void HttpRequest::OnHandshakeDone(absl::StatusOr result) { StartWrite(); } -void HttpRequest::DoHandshake(const EventEngine::ResolvedAddress& addr) { +void HttpRequest::DoHandshake(const grpc_resolved_address* addr) { // Create the security connector using the credentials and target name. ChannelArgs args = ChannelArgs::FromC(channel_args_); RefCountedPtr sc = @@ -326,7 +319,7 @@ void HttpRequest::DoHandshake(const EventEngine::ResolvedAddress& addr) { &overall_error_, 1)); return; } - absl::StatusOr address = ResolvedAddressToURI(addr); + absl::StatusOr address = grpc_sockaddr_to_uri(addr); if (!address.ok()) { Finish(GRPC_ERROR_CREATE_REFERENCING("Failed to extract URI from address", &overall_error_, 1)); @@ -359,16 +352,15 @@ void HttpRequest::NextAddress(grpc_error_handle error) { &overall_error_, 1)); return; } - DoHandshake(addresses_[next_address_++]); + const grpc_resolved_address* addr = &addresses_[next_address_++]; + DoHandshake(addr); } void HttpRequest::OnResolved( - absl::StatusOr> addresses_or) { - ApplicationCallbackExecCtx callback_exec_ctx; - ExecCtx exec_ctx; + absl::StatusOr> addresses_or) { RefCountedPtr unreffer(this); MutexLock lock(&mu_); - resolver_->reset(); + dns_request_handle_.reset(); if (cancelled_) { Finish(GRPC_ERROR_CREATE("cancelled during DNS resolution")); return; diff --git a/src/core/util/http_client/httpcli.h b/src/core/util/http_client/httpcli.h index 94822e40fa6..dd676a5b1c9 100644 --- a/src/core/util/http_client/httpcli.h +++ b/src/core/util/http_client/httpcli.h @@ -30,9 +30,9 @@ #include "absl/base/thread_annotations.h" #include "absl/status/status.h" #include "absl/status/statusor.h" +#include "absl/strings/string_view.h" #include "absl/types/optional.h" -#include #include #include @@ -49,6 +49,8 @@ #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/polling_entity.h" +#include "src/core/lib/iomgr/resolve_address.h" +#include "src/core/lib/iomgr/resolved_address.h" #include "src/core/lib/resource_quota/resource_quota.h" #include "src/core/lib/uri/uri_parser.h" #include "src/core/util/http_client/parser.h" @@ -58,18 +60,22 @@ // override functions return 1 if they handled the request, 0 otherwise typedef int (*grpc_httpcli_get_override)(const grpc_http_request* request, - const char* host, const char* path, + const grpc_core::URI& uri, + grpc_core::Timestamp deadline, + grpc_closure* on_complete, + grpc_http_response* response); +typedef int (*grpc_httpcli_post_override)(const grpc_http_request* request, + const grpc_core::URI& uri, + absl::string_view body, + grpc_core::Timestamp deadline, + grpc_closure* on_complete, + grpc_http_response* response); +typedef int (*grpc_httpcli_put_override)(const grpc_http_request* request, + const grpc_core::URI& uri, + absl::string_view body, grpc_core::Timestamp deadline, grpc_closure* on_complete, grpc_http_response* response); -typedef int (*grpc_httpcli_post_override)( - const grpc_http_request* request, const char* host, const char* path, - const char* body_bytes, size_t body_size, grpc_core::Timestamp deadline, - grpc_closure* on_complete, grpc_http_response* response); -typedef int (*grpc_httpcli_put_override)( - const grpc_http_request* request, const char* host, const char* path, - const char* body_bytes, size_t body_size, grpc_core::Timestamp deadline, - grpc_closure* on_complete, grpc_http_response* response); namespace grpc_core { @@ -222,16 +228,13 @@ class HttpRequest : public InternallyRefCounted { void OnHandshakeDone(absl::StatusOr result); - void DoHandshake( - const grpc_event_engine::experimental::EventEngine::ResolvedAddress& addr) + void DoHandshake(const grpc_resolved_address* addr) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_); void NextAddress(grpc_error_handle error) ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_); void OnResolved( - absl::StatusOr> - addresses_or); + absl::StatusOr> addresses_or); const URI uri_; const grpc_slice request_text_; @@ -252,17 +255,16 @@ class HttpRequest : public InternallyRefCounted { RefCountedPtr handshake_mgr_ ABSL_GUARDED_BY(mu_); bool cancelled_ ABSL_GUARDED_BY(mu_) = false; grpc_http_parser parser_ ABSL_GUARDED_BY(mu_); - std::vector - addresses_ ABSL_GUARDED_BY(mu_); + std::vector addresses_ ABSL_GUARDED_BY(mu_); size_t next_address_ ABSL_GUARDED_BY(mu_) = 0; int have_read_byte_ ABSL_GUARDED_BY(mu_) = 0; grpc_iomgr_object iomgr_obj_ ABSL_GUARDED_BY(mu_); grpc_slice_buffer incoming_ ABSL_GUARDED_BY(mu_); grpc_slice_buffer outgoing_ ABSL_GUARDED_BY(mu_); grpc_error_handle overall_error_ ABSL_GUARDED_BY(mu_) = absl::OkStatus(); - absl::StatusOr> - resolver_; + std::shared_ptr resolver_; + absl::optional dns_request_handle_ + ABSL_GUARDED_BY(mu_) = DNSResolver::kNullHandle; }; } // namespace grpc_core diff --git a/src/core/util/http_client/parser.cc b/src/core/util/http_client/parser.cc index 5e905ce3acd..b0c7416c6c9 100644 --- a/src/core/util/http_client/parser.cc +++ b/src/core/util/http_client/parser.cc @@ -376,10 +376,9 @@ static grpc_error_handle addbyte(grpc_http_parser* parser, uint8_t byte, case GRPC_HTTP_HEADERS: case GRPC_HTTP_TRAILERS: if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) { - if (GRPC_TRACE_FLAG_ENABLED(http1)) { - LOG(ERROR) << "HTTP header max line length (" - << GRPC_HTTP_PARSER_MAX_HEADER_LENGTH << ") exceeded"; - } + GRPC_TRACE_LOG(http1, ERROR) + << "HTTP header max line length (" + << GRPC_HTTP_PARSER_MAX_HEADER_LENGTH << ") exceeded"; return GRPC_ERROR_CREATE("HTTP header max line length exceeded"); } parser->cur_line[parser->cur_line_length] = byte; diff --git a/src/core/util/json/json_reader.cc b/src/core/util/json/json_reader.cc index 291e96544d6..20a1a04a75c 100644 --- a/src/core/util/json/json_reader.cc +++ b/src/core/util/json/json_reader.cc @@ -36,7 +36,6 @@ #include "absl/types/variant.h" #include -#include #include "src/core/lib/gprpp/match.h" #include "src/core/util/json/json.h" diff --git a/src/core/util/latent_see.cc b/src/core/util/latent_see.cc index 585a072c5b3..6bb250b445f 100644 --- a/src/core/util/latent_see.cc +++ b/src/core/util/latent_see.cc @@ -35,16 +35,25 @@ thread_local uint64_t Log::thread_id_ = Log::Get().next_thread_id_.fetch_add(1); thread_local Bin* Log::bin_ = nullptr; thread_local void* Log::bin_owner_ = nullptr; std::atomic Flow::next_flow_id_{1}; -std::atomic Log::free_bins_; +std::atomic Log::free_bins_{0}; std::string Log::GenerateJson() { std::vector events; + RingBuffer* other; for (auto& fragment : fragments_) { - MutexLock lock(&fragment.mu); - for (auto it = fragment.events.begin(); it != fragment.events.end(); ++it) { + { + MutexLock lock(&fragment.mu); + other = fragment.active; + if (fragment.active == &fragment.primary) { + fragment.active = &fragment.secondary; + } else { + fragment.active = &fragment.primary; + } + } + for (auto it = other->begin(); it != other->end(); ++it) { events.push_back(*it); } - fragment.events.Clear(); + other->Clear(); } absl::optional start_time; for (auto& event : events) { @@ -113,7 +122,7 @@ void Log::FlushBin(Bin* bin) { { MutexLock lock(&fragment.mu); for (auto event : bin->events) { - fragment.events.Append(RecordedEvent{thread_id, batch_id, event}); + fragment.active->Append(RecordedEvent{thread_id, batch_id, event}); } } bin->events.clear(); diff --git a/src/core/util/latent_see.h b/src/core/util/latent_see.h index b4f11d2960b..cf499caa84b 100644 --- a/src/core/util/latent_see.h +++ b/src/core/util/latent_see.h @@ -18,6 +18,9 @@ #include #ifdef GRPC_ENABLE_LATENT_SEE +#include +#include + #include #include #include @@ -27,12 +30,17 @@ #include #include +#include "absl/base/thread_annotations.h" +#include "absl/functional/any_invocable.h" #include "absl/log/log.h" +#include "absl/strings/string_view.h" #include "src/core/lib/gprpp/per_cpu.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/util/ring_buffer.h" +#define TAGGED_POINTER_SIZE_BITS 48 + namespace grpc_core { namespace latent_see { @@ -59,47 +67,59 @@ struct Bin { } std::vector events; - Bin* next_free; + uintptr_t next_free = 0; }; class Log { public: static constexpr int kMaxEventsPerCpu = 50000; - static Bin* MaybeStartBin(void* owner) { - if (bin_ != nullptr) return bin_; - Bin* bin = free_bins_.load(std::memory_order_acquire); + static constexpr uintptr_t kTagMask = (1ULL << TAGGED_POINTER_SIZE_BITS) - 1; + + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static uintptr_t IncrementTag( + uintptr_t input) { + return input + (1UL << TAGGED_POINTER_SIZE_BITS); + } + + GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Bin* ToBin(uintptr_t ptr) { + return reinterpret_cast(ptr & kTagMask); + } + + static uintptr_t StartBin(void* owner) { + uintptr_t bin_descriptor = free_bins_.load(std::memory_order_acquire); + Bin* bin; do { - if (bin == nullptr) { + if (bin_descriptor == 0) { bin = new Bin(); break; } - } while (!free_bins_.compare_exchange_weak(bin, bin->next_free, - std::memory_order_acq_rel)); + bin = ToBin(bin_descriptor); + } while (!free_bins_.compare_exchange_strong(bin_descriptor, bin->next_free, + std::memory_order_acq_rel)); bin_ = bin; bin_owner_ = owner; - return bin; + return reinterpret_cast(bin); } - static void EndBin(void* owner) { - if (bin_owner_ != owner) return; - FlushBin(bin_); - bin_->next_free = free_bins_.load(std::memory_order_acquire); - while (!free_bins_.compare_exchange_weak(bin_->next_free, bin_, - std::memory_order_acq_rel)) { + static void EndBin(uintptr_t bin_descriptor, void* owner) { + if (bin_owner_ != owner || bin_descriptor == 0) return; + FlushBin(ToBin(bin_descriptor)); + uintptr_t next_free = free_bins_.load(std::memory_order_acquire); + while (!free_bins_.compare_exchange_strong( + next_free, IncrementTag(bin_descriptor), std::memory_order_acq_rel)) { } bin_ = nullptr; + bin_owner_ = nullptr; } static Bin* CurrentThreadBin() { return bin_; } - private: - Log() = default; - - static void FlushBin(Bin* bin); - GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION static Log& Get() { static Log* log = []() { atexit([] { + if (log->stats_flusher_ != nullptr) { + log->stats_flusher_(log->GenerateJson()); + return; + } LOG(INFO) << "Writing latent_see.json in " << get_current_dir_name(); FILE* f = fopen("latent_see.json", "w"); if (f == nullptr) return; @@ -113,6 +133,16 @@ class Log { std::string GenerateJson(); + void OverrideStatsFlusher( + absl::AnyInvocable stats_exporter) { + stats_flusher_ = std::move(stats_exporter); + } + + private: + Log() = default; + + static void FlushBin(Bin* bin); + struct RecordedEvent { uint64_t thread_id; uint64_t batch_id; @@ -123,10 +153,15 @@ class Log { static thread_local uint64_t thread_id_; static thread_local Bin* bin_; static thread_local void* bin_owner_; - static std::atomic free_bins_; + static std::atomic free_bins_; + absl::AnyInvocable stats_flusher_ = nullptr; struct Fragment { + Fragment() : active(&primary){}; Mutex mu; - RingBuffer events ABSL_GUARDED_BY(mu); + RingBuffer* active + ABSL_GUARDED_BY(mu); + RingBuffer primary; + RingBuffer secondary; }; PerCpu fragments_{PerCpuOptions()}; }; @@ -136,11 +171,17 @@ class Scope { public: GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION explicit Scope(const Metadata* metadata) : metadata_(metadata) { + bin_ = Log::CurrentThreadBin(); + if (kParent && bin_ == nullptr) { + bin_descriptor_ = Log::StartBin(this); + bin_ = Log::ToBin(bin_descriptor_); + } + CHECK_NE(bin_, nullptr); bin_->Append(metadata_, EventType::kBegin, 0); } GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION ~Scope() { bin_->Append(metadata_, EventType::kEnd, 0); - if (kParent) Log::EndBin(this); + if (kParent) Log::EndBin(bin_descriptor_, this); } Scope(const Scope&) = delete; @@ -148,8 +189,8 @@ class Scope { private: const Metadata* const metadata_; - Bin* const bin_ = - kParent ? Log::MaybeStartBin(this) : Log::CurrentThreadBin(); + uintptr_t bin_descriptor_ = 0; + Bin* bin_ = nullptr; }; using ParentScope = Scope; diff --git a/src/core/util/msys/tmpfile.cc b/src/core/util/msys/tmpfile.cc index 41a04f1c75d..dc1cdf7bc34 100644 --- a/src/core/util/msys/tmpfile.cc +++ b/src/core/util/msys/tmpfile.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/posix/sync.cc b/src/core/util/posix/sync.cc index 912a1a6b48e..1ccaa281996 100644 --- a/src/core/util/posix/sync.cc +++ b/src/core/util/posix/sync.cc @@ -27,7 +27,6 @@ #include "absl/log/check.h" #include -#include #include #include diff --git a/src/core/util/posix/time.cc b/src/core/util/posix/time.cc index 6624b0fd656..5fea711d59f 100644 --- a/src/core/util/posix/time.cc +++ b/src/core/util/posix/time.cc @@ -31,7 +31,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/string.cc b/src/core/util/string.cc index 7efbd09f51f..31ffb9eb4bf 100644 --- a/src/core/util/string.cc +++ b/src/core/util/string.cc @@ -31,7 +31,6 @@ #include "absl/strings/str_cat.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/sync.cc b/src/core/util/sync.cc index b70435a992b..dd3db7e6423 100644 --- a/src/core/util/sync.cc +++ b/src/core/util/sync.cc @@ -25,7 +25,6 @@ #include "absl/log/check.h" #include -#include #include // Number of mutexes to allocate for events, to avoid lock contention. diff --git a/src/core/util/sync_abseil.cc b/src/core/util/sync_abseil.cc index cc23c3d1cd3..1d826f6565c 100644 --- a/src/core/util/sync_abseil.cc +++ b/src/core/util/sync_abseil.cc @@ -29,7 +29,6 @@ #include "absl/time/time.h" #include -#include #include #include diff --git a/src/core/util/time.cc b/src/core/util/time.cc index a46e95ef352..d71cee90ca9 100644 --- a/src/core/util/time.cc +++ b/src/core/util/time.cc @@ -26,7 +26,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/windows/cpu.cc b/src/core/util/windows/cpu.cc index 94af1e419c6..a8ba5952f88 100644 --- a/src/core/util/windows/cpu.cc +++ b/src/core/util/windows/cpu.cc @@ -20,7 +20,6 @@ #ifdef GPR_WINDOWS #include -#include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/windows/sync.cc b/src/core/util/windows/sync.cc index 800188bf29d..0f7fd78868d 100644 --- a/src/core/util/windows/sync.cc +++ b/src/core/util/windows/sync.cc @@ -25,7 +25,6 @@ #include "absl/log/check.h" -#include #include #include diff --git a/src/core/util/windows/time.cc b/src/core/util/windows/time.cc index b80a4a5a14b..21cfed52a13 100644 --- a/src/core/util/windows/time.cc +++ b/src/core/util/windows/time.cc @@ -28,7 +28,6 @@ #include "absl/log/check.h" -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/util/windows/tmpfile.cc b/src/core/util/windows/tmpfile.cc index cd3838bc4ee..23d647a2b8e 100644 --- a/src/core/util/windows/tmpfile.cc +++ b/src/core/util/windows/tmpfile.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/src/core/xds/grpc/xds_certificate_provider.cc b/src/core/xds/grpc/xds_certificate_provider.cc index 35c537bf362..fecc658d364 100644 --- a/src/core/xds/grpc/xds_certificate_provider.cc +++ b/src/core/xds/grpc/xds_certificate_provider.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/xds/grpc/xds_cluster.cc b/src/core/xds/grpc/xds_cluster.cc index 300528f5a16..eae5a95d398 100644 --- a/src/core/xds/grpc/xds_cluster.cc +++ b/src/core/xds/grpc/xds_cluster.cc @@ -65,14 +65,14 @@ std::string XdsClusterResource::ToString() const { absl::StrCat("max_concurrent_requests=", max_concurrent_requests)); contents.push_back(absl::StrCat("override_host_statuses=", override_host_statuses.ToString())); - if (!service_telemetry_label.as_string_view().empty()) { - contents.push_back(absl::StrCat("service_name_telemetry_label=", - service_telemetry_label.as_string_view())); - } - if (!namespace_telemetry_label.as_string_view().empty()) { + if (!metadata.empty()) { + std::vector metadata_entries; + for (const auto& p : metadata) { + metadata_entries.push_back( + absl::StrCat(p.first, "=", JsonDump(p.second))); + } contents.push_back( - absl::StrCat("service_namespace_telemetry_label=", - namespace_telemetry_label.as_string_view())); + absl::StrCat("metadata={", absl::StrJoin(metadata_entries, ", "), "}")); } return absl::StrCat("{", absl::StrJoin(contents, ", "), "}"); } diff --git a/src/core/xds/grpc/xds_cluster.h b/src/core/xds/grpc/xds_cluster.h index 601593541e5..a0d087d8196 100644 --- a/src/core/xds/grpc/xds_cluster.h +++ b/src/core/xds/grpc/xds_cluster.h @@ -20,6 +20,7 @@ #include #include +#include "absl/container/flat_hash_map.h" #include "absl/types/optional.h" #include "absl/types/variant.h" @@ -86,8 +87,7 @@ struct XdsClusterResource : public XdsResourceType::ResourceData { XdsHealthStatusSet override_host_statuses; - RefCountedStringValue service_telemetry_label; - RefCountedStringValue namespace_telemetry_label; + absl::flat_hash_map metadata; bool operator==(const XdsClusterResource& other) const { return type == other.type && lb_policy_config == other.lb_policy_config && @@ -97,8 +97,7 @@ struct XdsClusterResource : public XdsResourceType::ResourceData { max_concurrent_requests == other.max_concurrent_requests && outlier_detection == other.outlier_detection && override_host_statuses == other.override_host_statuses && - service_telemetry_label == other.service_telemetry_label && - namespace_telemetry_label == other.namespace_telemetry_label; + metadata == other.metadata; } std::string ToString() const; diff --git a/src/core/xds/grpc/xds_cluster_parser.cc b/src/core/xds/grpc/xds_cluster_parser.cc index c26c62c458e..2d06762b5a8 100644 --- a/src/core/xds/grpc/xds_cluster_parser.cc +++ b/src/core/xds/grpc/xds_cluster_parser.cc @@ -641,34 +641,49 @@ absl::StatusOr> CdsResourceParse( cds_update->override_host_statuses.Add( XdsHealthStatus(XdsHealthStatus::kHealthy)); } - // Record telemetry labels (if any). + // Parse metadata. const envoy_config_core_v3_Metadata* metadata = envoy_config_cluster_v3_Cluster_metadata(cluster); if (metadata != nullptr) { - google_protobuf_Struct* telemetry_labels_struct; - if (envoy_config_core_v3_Metadata_filter_metadata_get( - metadata, - StdStringToUpbString( - absl::string_view("com.google.csm.telemetry_labels")), - &telemetry_labels_struct)) { - size_t iter = kUpb_Map_Begin; - const google_protobuf_Struct_FieldsEntry* fields_entry; - while ((fields_entry = google_protobuf_Struct_fields_next( - telemetry_labels_struct, &iter)) != nullptr) { - // Adds any entry whose value is a string to telemetry_labels. - const google_protobuf_Value* value = - google_protobuf_Struct_FieldsEntry_value(fields_entry); - if (google_protobuf_Value_has_string_value(value)) { - if (UpbStringToAbsl(google_protobuf_Struct_FieldsEntry_key( - fields_entry)) == "service_name") { - cds_update->service_telemetry_label = RefCountedStringValue( - UpbStringToAbsl(google_protobuf_Value_string_value(value))); - } else if (UpbStringToAbsl(google_protobuf_Struct_FieldsEntry_key( - fields_entry)) == "service_namespace") { - cds_update->namespace_telemetry_label = RefCountedStringValue( - UpbStringToAbsl(google_protobuf_Value_string_value(value))); - } - } + // First, try typed_filter_metadata. + size_t iter = kUpb_Map_Begin; + const envoy_config_core_v3_Metadata_TypedFilterMetadataEntry* typed_entry; + while ( + (typed_entry = envoy_config_core_v3_Metadata_typed_filter_metadata_next( + metadata, &iter)) != nullptr) { + absl::string_view key = UpbStringToAbsl( + envoy_config_core_v3_Metadata_TypedFilterMetadataEntry_key( + typed_entry)); + ValidationErrors::ScopedField field( + &errors, absl::StrCat(".metadata.typed_filter_metadata[", key, "]")); + auto extension = ExtractXdsExtension( + context, + envoy_config_core_v3_Metadata_TypedFilterMetadataEntry_value( + typed_entry), + &errors); + if (!extension.has_value()) continue; + // TODO(roth): If we ever need to support another type here, refactor + // this into a separate registry. + if (extension->type == "extensions.filters.http.gcp_authn.v3.Audience") { + // TODO(roth): In a subsequent PR, add parsing here. + } + } + // Then, try filter_metadata. + iter = kUpb_Map_Begin; + const envoy_config_core_v3_Metadata_FilterMetadataEntry* entry; + while ((entry = envoy_config_core_v3_Metadata_filter_metadata_next( + metadata, &iter)) != nullptr) { + absl::string_view key = UpbStringToAbsl( + envoy_config_core_v3_Metadata_FilterMetadataEntry_key(entry)); + auto json = ParseProtobufStructToJson( + context, + envoy_config_core_v3_Metadata_FilterMetadataEntry_value(entry)); + if (!json.ok()) { + ValidationErrors::ScopedField field( + &errors, absl::StrCat(".metadata.filter_metadata[", key, "]")); + errors.AddError(json.status().message()); + } else if (!cds_update->metadata.contains(key)) { + cds_update->metadata[key] = std::move(*json); } } } diff --git a/src/core/xds/grpc/xds_cluster_specifier_plugin.cc b/src/core/xds/grpc/xds_cluster_specifier_plugin.cc index 11a707a0d63..8d77160224e 100644 --- a/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +++ b/src/core/xds/grpc/xds_cluster_specifier_plugin.cc @@ -30,7 +30,6 @@ #include "upb/mem/arena.hpp" #include -#include #include #include "src/core/util/json/json.h" diff --git a/src/core/xds/grpc/xds_common_types_parser.cc b/src/core/xds/grpc/xds_common_types_parser.cc index 3da948fe503..8b617a6143d 100644 --- a/src/core/xds/grpc/xds_common_types_parser.cc +++ b/src/core/xds/grpc/xds_common_types_parser.cc @@ -372,11 +372,9 @@ CommonTlsContext CommonTlsContextParse( } // -// ExtractXdsExtension +// ParseProtobufStructToJson() // -namespace { - absl::StatusOr ParseProtobufStructToJson( const XdsResourceType::DecodeContext& context, const google_protobuf_Struct* resource) { @@ -405,7 +403,9 @@ absl::StatusOr ParseProtobufStructToJson( return std::move(*json); } -} // namespace +// +// ExtractXdsExtension() +// absl::optional ExtractXdsExtension( const XdsResourceType::DecodeContext& context, diff --git a/src/core/xds/grpc/xds_common_types_parser.h b/src/core/xds/grpc/xds_common_types_parser.h index 880e50b7ded..b73a04ec99a 100644 --- a/src/core/xds/grpc/xds_common_types_parser.h +++ b/src/core/xds/grpc/xds_common_types_parser.h @@ -21,6 +21,7 @@ #include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h" #include "google/protobuf/any.upb.h" #include "google/protobuf/duration.upb.h" +#include "google/protobuf/struct.upb.h" #include "google/protobuf/wrappers.upb.h" #include "src/core/lib/gprpp/time.h" @@ -45,6 +46,10 @@ CommonTlsContext CommonTlsContextParse( common_tls_context_proto, ValidationErrors* errors); +absl::StatusOr ParseProtobufStructToJson( + const XdsResourceType::DecodeContext& context, + const google_protobuf_Struct* resource); + absl::optional ExtractXdsExtension( const XdsResourceType::DecodeContext& context, const google_protobuf_Any* any, ValidationErrors* errors); diff --git a/src/core/xds/grpc/xds_endpoint_parser.cc b/src/core/xds/grpc/xds_endpoint_parser.cc index 89a42ab9ce3..63fb15eda89 100644 --- a/src/core/xds/grpc/xds_endpoint_parser.cc +++ b/src/core/xds/grpc/xds_endpoint_parser.cc @@ -61,10 +61,10 @@ namespace grpc_core { namespace { -// TODO(roth): Remove this once dualstack support is stable. +// TODO(roth): Remove this after 1.67 is released. bool XdsDualstackEndpointsEnabled() { auto value = GetEnv("GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); - if (!value.has_value()) return false; + if (!value.has_value()) return true; bool parsed_value; bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value); return parse_succeeded && parsed_value; diff --git a/src/core/xds/grpc/xds_http_filter_registry.cc b/src/core/xds/grpc/xds_http_filter_registry.cc index c0ed05e7db0..9a6f18e226b 100644 --- a/src/core/xds/grpc/xds_http_filter_registry.cc +++ b/src/core/xds/grpc/xds_http_filter_registry.cc @@ -25,7 +25,6 @@ #include "envoy/extensions/filters/http/router/v3/router.upb.h" #include "envoy/extensions/filters/http/router/v3/router.upbdefs.h" -#include #include #include "src/core/util/json/json.h" diff --git a/src/core/xds/grpc/xds_routing.cc b/src/core/xds/grpc/xds_routing.cc index 1cedfd603d7..83c9d620e48 100644 --- a/src/core/xds/grpc/xds_routing.cc +++ b/src/core/xds/grpc/xds_routing.cc @@ -31,7 +31,6 @@ #include "absl/strings/match.h" #include "absl/strings/str_cat.h" -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/xds/grpc/xds_transport_grpc.cc b/src/core/xds/grpc/xds_transport_grpc.cc index f2759b251a6..6af60f0516d 100644 --- a/src/core/xds/grpc/xds_transport_grpc.cc +++ b/src/core/xds/grpc/xds_transport_grpc.cc @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "src/core/client_channel/client_channel_filter.h" diff --git a/src/core/xds/xds_client/xds_client.cc b/src/core/xds/xds_client/xds_client.cc index 6f1575c1146..7c4cef0dd17 100644 --- a/src/core/xds/xds_client/xds_client.cc +++ b/src/core/xds/xds_client/xds_client.cc @@ -250,16 +250,14 @@ class XdsClient::XdsChannel::AdsCall final } void OnTimer() { - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << ads_call_->xds_client() - << "] xds server " - << ads_call_->xds_channel()->server_.server_uri() - << ": timeout obtaining resource {type=" << type_->type_url() - << " name=" - << XdsClient::ConstructFullXdsResourceName( - name_.authority, type_->type_url(), name_.key) - << "} from xds server"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << ads_call_->xds_client() << "] xds server " + << ads_call_->xds_channel()->server_.server_uri() + << ": timeout obtaining resource {type=" << type_->type_url() + << " name=" + << XdsClient::ConstructFullXdsResourceName( + name_.authority, type_->type_url(), name_.key) + << "} from xds server"; { MutexLock lock(&ads_call_->xds_client()->mu_); timer_handle_.reset(); @@ -571,13 +569,10 @@ bool XdsClient::XdsChannel::MaybeFallbackLocked( type_resource.first, {authority, key_state.first}); } } - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client_.get() << "] authority " - << authority << ": added fallback server " - << xds_servers[i]->server_uri() << " (" - << authority_state.xds_channels.back()->status().ToString() - << ")"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client_.get() << "] authority " << authority + << ": added fallback server " << xds_servers[i]->server_uri() << " (" + << authority_state.xds_channels.back()->status().ToString() << ")"; if (authority_state.xds_channels.back()->status().ok()) return true; } GRPC_TRACE_LOG(xds_client, INFO) @@ -723,12 +718,11 @@ void XdsClient::XdsChannel::RetryableCall::StartRetryTimerLocked() { const Timestamp next_attempt_time = backoff_.NextAttemptTime(); const Duration timeout = std::max(next_attempt_time - Timestamp::Now(), Duration::Zero()); - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_channel()->xds_client() - << "] xds server " << xds_channel()->server_.server_uri() - << ": call attempt failed; retry timer will fire in " - << timeout.millis() << "ms."; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_channel()->xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": call attempt failed; retry timer will fire in " << timeout.millis() + << "ms."; timer_handle_ = xds_channel()->xds_client()->engine()->RunAfter( timeout, [self = this->Ref(DEBUG_LOCATION, "RetryableCall+retry_timer_start")]() { @@ -779,13 +773,12 @@ class XdsClient::XdsChannel::AdsCall::AdsReadDelayHandle final absl::Status XdsClient::XdsChannel::AdsCall::AdsResponseParser::ProcessAdsResponseFields( AdsResponseFields fields) { - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << ads_call_->xds_client() << "] xds server " - << ads_call_->xds_channel()->server_.server_uri() - << ": received ADS response: type_url=" << fields.type_url - << ", version=" << fields.version << ", nonce=" << fields.nonce - << ", num_resources=" << fields.num_resources; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << ads_call_->xds_client() << "] xds server " + << ads_call_->xds_channel()->server_.server_uri() + << ": received ADS response: type_url=" << fields.type_url + << ", version=" << fields.version << ", nonce=" << fields.nonce + << ", num_resources=" << fields.num_resources; result_.type = ads_call_->xds_client()->GetResourceTypeLocked(fields.type_url); if (result_.type == nullptr) { @@ -991,12 +984,11 @@ XdsClient::XdsChannel::AdsCall::AdsCall( RefCountedPtr(this))); CHECK(streaming_call_ != nullptr); // Start the call. - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << xds_channel()->server_.server_uri() - << ": starting ADS call (ads_call: " << this - << ", streaming_call: " << streaming_call_.get() << ")"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": starting ADS call (ads_call: " << this + << ", streaming_call: " << streaming_call_.get() << ")"; // If this is a reconnect, add any necessary subscriptions from what's // already in the cache. for (auto& a : xds_client()->authority_state_map_) { @@ -1044,13 +1036,12 @@ void XdsClient::XdsChannel::AdsCall::SendMessageLocked( state.nonce, ResourceNamesForRequest(type), state.status, !sent_initial_message_); sent_initial_message_ = true; - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << xds_channel()->server_.server_uri() - << ": sending ADS request: type=" << type->type_url() - << " version=" << xds_channel()->resource_type_version_map_[type] - << " nonce=" << state.nonce << " error=" << state.status; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": sending ADS request: type=" << type->type_url() + << " version=" << xds_channel()->resource_type_version_map_[type] + << " nonce=" << state.nonce << " error=" << state.status; state.status = absl::OkStatus(); streaming_call_->SendMessage(std::move(serialized_message)); send_message_pending_ = type; @@ -1228,14 +1219,12 @@ void XdsClient::XdsChannel::AdsCall::OnRecvMessage(absl::string_view payload) { void XdsClient::XdsChannel::AdsCall::OnStatusReceived(absl::Status status) { { MutexLock lock(&xds_client()->mu_); - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << xds_channel()->server_.server_uri() - << ": ADS call status received (xds_channel=" << xds_channel() - << ", ads_call=" << this - << ", streaming_call=" << streaming_call_.get() - << "): " << status; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": ADS call status received (xds_channel=" << xds_channel() + << ", ads_call=" << this << ", streaming_call=" << streaming_call_.get() + << "): " << status; // Cancel any does-not-exist timers that may be pending. for (const auto& p : state_map_) { for (const auto& q : p.second.subscribed_resources) { @@ -1301,12 +1290,11 @@ void XdsClient::XdsChannel::LrsCall::Timer::Orphan() { } void XdsClient::XdsChannel::LrsCall::Timer::ScheduleNextReportLocked() { - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << lrs_call_->xds_channel()->server_.server_uri() - << ": scheduling next load report in " - << lrs_call_->load_reporting_interval_; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << lrs_call_->xds_channel()->server_.server_uri() + << ": scheduling next load report in " + << lrs_call_->load_reporting_interval_; timer_handle_ = xds_client()->engine()->RunAfter( lrs_call_->load_reporting_interval_, [self = Ref(DEBUG_LOCATION, "timer")]() { @@ -1344,12 +1332,11 @@ XdsClient::XdsChannel::LrsCall::LrsCall( RefCountedPtr(this))); CHECK(streaming_call_ != nullptr); // Start the call. - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << xds_channel()->server_.server_uri() - << ": starting LRS call (lrs_call=" << this - << ", streaming_call=" << streaming_call_.get() << ")"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": starting LRS call (lrs_call=" << this + << ", streaming_call=" << streaming_call_.get() << ")"; // Send the initial request. std::string serialized_payload = xds_client()->api_.CreateLrsInitialRequest(); SendMessageLocked(std::move(serialized_payload)); @@ -1473,12 +1460,11 @@ void XdsClient::XdsChannel::LrsCall::OnRecvMessage(absl::string_view payload) { Duration::Milliseconds(GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS)) { new_load_reporting_interval = Duration::Milliseconds(GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS); - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << xds_channel()->server_.server_uri() - << ": increased load_report_interval to minimum value " - << GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS << "ms"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": increased load_report_interval to minimum value " + << GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS << "ms"; } // Ignore identical update. if (send_all_clusters == send_all_clusters_ && @@ -1506,14 +1492,12 @@ void XdsClient::XdsChannel::LrsCall::OnRecvMessage(absl::string_view payload) { void XdsClient::XdsChannel::LrsCall::OnStatusReceived(absl::Status status) { MutexLock lock(&xds_client()->mu_); - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client() << "] xds server " - << xds_channel()->server_.server_uri() - << ": LRS call status received (xds_channel=" << xds_channel() - << ", lrs_call=" << this - << ", streaming_call=" << streaming_call_.get() - << "): " << status; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client() << "] xds server " + << xds_channel()->server_.server_uri() + << ": LRS call status received (xds_channel=" << xds_channel() + << ", lrs_call=" << this << ", streaming_call=" << streaming_call_.get() + << "): " << status; // Ignore status from a stale call. if (IsCurrentCallOnChannel()) { // Try to restart the call. @@ -2076,14 +2060,12 @@ XdsApi::ClusterLoadReportMap XdsClient::BuildLoadReportSnapshotLocked( if (locality_state.locality_stats != nullptr) { locality_snapshot += locality_state.locality_stats->GetSnapshotAndReset(); - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << this - << "] cluster=" << cluster_key.first.c_str() - << " eds_service_name=" << cluster_key.second.c_str() - << " locality=" - << locality_name->human_readable_string().c_str() - << " locality_stats=" << locality_state.locality_stats; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << this + << "] cluster=" << cluster_key.first.c_str() + << " eds_service_name=" << cluster_key.second.c_str() + << " locality=" << locality_name->human_readable_string().c_str() + << " locality_stats=" << locality_state.locality_stats; } // If the only thing left in this entry was final snapshots from // deleted locality stats objects, remove the entry. diff --git a/src/core/xds/xds_client/xds_client_stats.cc b/src/core/xds/xds_client/xds_client_stats.cc index b78dbce775b..3219b224a9e 100644 --- a/src/core/xds/xds_client/xds_client_stats.cc +++ b/src/core/xds/xds_client/xds_client_stats.cc @@ -100,26 +100,21 @@ XdsClusterLocalityStats::XdsClusterLocalityStats( cluster_name_(cluster_name), eds_service_name_(eds_service_name), name_(std::move(name)) { - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client_.get() - << "] created locality stats " << this << " for {" << lrs_server_ - << ", " << cluster_name_ << ", " << eds_service_name_ << ", " - << (name_ == nullptr ? "" - : name_->human_readable_string().c_str()) - << "}"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client_.get() << "] created locality stats " + << this << " for {" << lrs_server_ << ", " << cluster_name_ << ", " + << eds_service_name_ << ", " + << (name_ == nullptr ? "" : name_->human_readable_string().c_str()) + << "}"; } XdsClusterLocalityStats::~XdsClusterLocalityStats() { - if (GRPC_TRACE_FLAG_ENABLED(xds_client)) { - LOG(INFO) << "[xds_client " << xds_client_.get() - << "] destroying locality stats " << this << " for {" - << lrs_server_ << ", " << cluster_name_ << ", " - << eds_service_name_ << ", " - << (name_ == nullptr ? "" - : name_->human_readable_string().c_str()) - << "}"; - } + GRPC_TRACE_LOG(xds_client, INFO) + << "[xds_client " << xds_client_.get() << "] destroying locality stats " + << this << " for {" << lrs_server_ << ", " << cluster_name_ << ", " + << eds_service_name_ << ", " + << (name_ == nullptr ? "" : name_->human_readable_string().c_str()) + << "}"; xds_client_->RemoveClusterLocalityStats(lrs_server_, cluster_name_, eds_service_name_, name_, this); xds_client_.reset(DEBUG_LOCATION, "LocalityStats"); diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index 8b8e37fc9f2..457f9db37aa 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 76bee4cb6b8..78c0bd16002 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/src/cpp/client/xds_credentials.cc b/src/cpp/client/xds_credentials.cc index d7878e5cb5b..e3fefd04c47 100644 --- a/src/cpp/client/xds_credentials.cc +++ b/src/cpp/client/xds_credentials.cc @@ -22,7 +22,6 @@ #include #include -#include #include namespace grpc { diff --git a/src/cpp/common/alarm.cc b/src/cpp/common/alarm.cc index 918922eb235..041584eb489 100644 --- a/src/cpp/common/alarm.cc +++ b/src/cpp/common/alarm.cc @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index 3eb56c32806..fc09938b99f 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/src/cpp/common/tls_certificate_provider.cc b/src/cpp/common/tls_certificate_provider.cc index b94a807bfdb..7d841b38fd5 100644 --- a/src/cpp/common/tls_certificate_provider.cc +++ b/src/cpp/common/tls_certificate_provider.cc @@ -21,7 +21,6 @@ #include #include -#include #include namespace grpc { diff --git a/src/cpp/common/tls_certificate_verifier.cc b/src/cpp/common/tls_certificate_verifier.cc index a642760a4a9..d298cf26773 100644 --- a/src/cpp/common/tls_certificate_verifier.cc +++ b/src/cpp/common/tls_certificate_verifier.cc @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/src/cpp/common/tls_credentials_options.cc b/src/cpp/common/tls_credentials_options.cc index ef260b86908..74e74128322 100644 --- a/src/cpp/common/tls_credentials_options.cc +++ b/src/cpp/common/tls_credentials_options.cc @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/src/cpp/ext/filters/census/client_filter.cc b/src/cpp/ext/filters/census/client_filter.cc index daffd3e78a2..cf0aac4c0d2 100644 --- a/src/cpp/ext/filters/census/client_filter.cc +++ b/src/cpp/ext/filters/census/client_filter.cc @@ -44,7 +44,6 @@ #include "opencensus/trace/status_code.h" #include -#include #include #include #include diff --git a/src/cpp/ext/gcp/environment_autodetect.cc b/src/cpp/ext/gcp/environment_autodetect.cc index f9d121635cb..90e958c55b2 100644 --- a/src/cpp/ext/gcp/environment_autodetect.cc +++ b/src/cpp/ext/gcp/environment_autodetect.cc @@ -63,10 +63,9 @@ std::string GetNamespaceName() { "/var/run/secrets/kubernetes.io/serviceaccount/namespace"; auto namespace_name = grpc_core::LoadFile(filename, false); if (!namespace_name.ok()) { - if (GRPC_TRACE_FLAG_ENABLED(environment_autodetect)) { - VLOG(2) << "Reading file " << filename << " failed: " - << grpc_core::StatusToString(namespace_name.status()); - } + GRPC_TRACE_VLOG(environment_autodetect, 2) + << "Reading file " << filename + << " failed: " << grpc_core::StatusToString(namespace_name.status()); // Fallback on an environment variable return grpc_core::GetEnv("NAMESPACE_NAME").value_or(""); } @@ -248,14 +247,12 @@ class EnvironmentAutoDetectHelper queries_.push_back(grpc_core::MakeOrphanable( element.first, &pollent_, [this](std::string attribute, absl::StatusOr result) { - if (GRPC_TRACE_FLAG_ENABLED(environment_autodetect)) { - LOG(INFO) << "Environment AutoDetect: Attribute: \"" << attribute - << "\" Result: \"" - << (result.ok() - ? result.value() + GRPC_TRACE_LOG(environment_autodetect, INFO) + << "Environment AutoDetect: Attribute: \"" << attribute + << "\" Result: \"" + << (result.ok() ? result.value() : grpc_core::StatusToString(result.status())) - << "\""; - } + << "\""; absl::optional resource; { grpc_core::MutexLock lock(&mu_); diff --git a/src/cpp/ext/otel/otel_client_call_tracer.cc b/src/cpp/ext/otel/otel_client_call_tracer.cc index 822a96ea9cf..8e75cb82bba 100644 --- a/src/cpp/ext/otel/otel_client_call_tracer.cc +++ b/src/cpp/ext/otel/otel_client_call_tracer.cc @@ -40,7 +40,6 @@ #include "opentelemetry/metrics/sync_instruments.h" #include -#include #include #include diff --git a/src/cpp/ext/proto_server_reflection_plugin.cc b/src/cpp/ext/proto_server_reflection_plugin.cc index 78080fa8cbe..4299884055d 100644 --- a/src/cpp/ext/proto_server_reflection_plugin.cc +++ b/src/cpp/ext/proto_server_reflection_plugin.cc @@ -24,6 +24,7 @@ #include #include +#include "src/core/lib/config/config_vars.h" #include "src/cpp/ext/proto_server_reflection.h" namespace grpc { @@ -41,8 +42,13 @@ std::string ProtoServerReflectionPlugin::name() { } void ProtoServerReflectionPlugin::InitServer(grpc::ServerInitializer* si) { - si->RegisterService(reflection_service_v1_); - si->RegisterService(reflection_service_v1alpha_); + // We cannot simply keep the plugin from being unregistered because this must + // happen at static initialization time, whereas flag configuration that + // controls this is not received until later. + if (!grpc_core::ConfigVars::Get().CppExperimentalDisableReflection()) { + si->RegisterService(reflection_service_v1_); + si->RegisterService(reflection_service_v1alpha_); + } } void ProtoServerReflectionPlugin::Finish(grpc::ServerInitializer* si) { @@ -53,17 +59,23 @@ void ProtoServerReflectionPlugin::ChangeArguments(const std::string& /*name*/, void* /*value*/) {} bool ProtoServerReflectionPlugin::has_sync_methods() const { - return (reflection_service_v1_ && - reflection_service_v1_->has_synchronous_methods()) || - (reflection_service_v1alpha_ && - reflection_service_v1alpha_->has_synchronous_methods()); + if (!grpc_core::ConfigVars::Get().CppExperimentalDisableReflection()) { + return (reflection_service_v1_ && + reflection_service_v1_->has_synchronous_methods()) || + (reflection_service_v1alpha_ && + reflection_service_v1alpha_->has_synchronous_methods()); + } + return false; } bool ProtoServerReflectionPlugin::has_async_methods() const { - return (reflection_service_v1_ && - reflection_service_v1_->has_async_methods()) || - (reflection_service_v1alpha_ && - reflection_service_v1alpha_->has_async_methods()); + if (!grpc_core::ConfigVars::Get().CppExperimentalDisableReflection()) { + return (reflection_service_v1_ && + reflection_service_v1_->has_async_methods()) || + (reflection_service_v1alpha_ && + reflection_service_v1alpha_->has_async_methods()); + } + return false; } static std::unique_ptr CreateProtoReflection() { diff --git a/src/cpp/server/backend_metric_recorder.cc b/src/cpp/server/backend_metric_recorder.cc index e686fa9d0e3..40a19f3a72f 100644 --- a/src/cpp/server/backend_metric_recorder.cc +++ b/src/cpp/server/backend_metric_recorder.cc @@ -26,7 +26,6 @@ #include "absl/log/log.h" -#include #include #include @@ -368,15 +367,13 @@ BackendMetricData BackendMetricState::GetBackendMetricData() { data.named_metrics[r.first] = r.second; } } - if (GRPC_TRACE_FLAG_ENABLED(backend_metric)) { - LOG(INFO) << "[" << this - << "] Backend metric data returned: cpu:" << data.cpu_utilization - << " mem:" << data.mem_utilization << " qps:" << data.qps - << " eps:" << data.eps - << " utilization size:" << data.utilization.size() - << " request_cost size:" << data.request_cost.size() - << "named_metrics size:" << data.named_metrics.size(); - } + GRPC_TRACE_LOG(backend_metric, INFO) + << "[" << this + << "] Backend metric data returned: cpu:" << data.cpu_utilization + << " mem:" << data.mem_utilization << " qps:" << data.qps + << " eps:" << data.eps << " utilization size:" << data.utilization.size() + << " request_cost size:" << data.request_cost.size() + << "named_metrics size:" << data.named_metrics.size(); return data; } diff --git a/src/cpp/server/insecure_server_credentials.cc b/src/cpp/server/insecure_server_credentials.cc index ed14ac3def9..a48b9cb93c7 100644 --- a/src/cpp/server/insecure_server_credentials.cc +++ b/src/cpp/server/insecure_server_credentials.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/src/cpp/server/load_reporter/load_reporter_async_service_impl.h b/src/cpp/server/load_reporter/load_reporter_async_service_impl.h index c348e918e54..d7cbad32455 100644 --- a/src/cpp/server/load_reporter/load_reporter_async_service_impl.h +++ b/src/cpp/server/load_reporter/load_reporter_async_service_impl.h @@ -29,7 +29,6 @@ #include "absl/log/check.h" -#include #include #include #include diff --git a/src/cpp/server/orca/orca_service.cc b/src/cpp/server/orca/orca_service.cc index 05a86fdfd08..9cc09c9909e 100644 --- a/src/cpp/server/orca/orca_service.cc +++ b/src/cpp/server/orca/orca_service.cc @@ -32,7 +32,6 @@ #include "xds/service/orca/v3/orca.upb.h" #include -#include #include #include #include diff --git a/src/cpp/server/xds_server_credentials.cc b/src/cpp/server/xds_server_credentials.cc index eb7f6ddfda8..df05e254d45 100644 --- a/src/cpp/server/xds_server_credentials.cc +++ b/src/cpp/server/xds_server_credentials.cc @@ -22,7 +22,6 @@ #include #include -#include #include namespace grpc { diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.mm b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.mm index 7f29485fee3..93919d0f5ec 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.mm +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.mm @@ -18,8 +18,6 @@ #import "GRPCChannel.h" -#include - #import "../../internal/GRPCCallOptions+Internal.h" #import "../GRPCTransport+Private.h" #import "ChannelArgsUtil.h" diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.mm b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.mm index b42fd6e0a1c..a261300cd52 100644 --- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.mm +++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.mm @@ -28,8 +28,6 @@ #import "GRPCSecureChannelFactory.h" #import "GRPCWrappedCall.h" -#include - extern const char *kCFStreamVarName; static GRPCChannelPool *gChannelPool; diff --git a/src/python/grpcio_observability/grpc_observability/observability_util.cc b/src/python/grpcio_observability/grpc_observability/observability_util.cc index bdbf48b4db3..54f5c8d36c4 100644 --- a/src/python/grpcio_observability/grpc_observability/observability_util.cc +++ b/src/python/grpcio_observability/grpc_observability/observability_util.cc @@ -27,8 +27,6 @@ #include "python_observability_context.h" #include "server_call_tracer.h" -#include - namespace grpc_observability { std::queue* g_census_data_buffer; diff --git a/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template index 684eef015db..cfefb7e0279 100644 --- a/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM alpine:3.15 + FROM alpine:3.17 # Install Git and basic packages. RUN apk update && apk add ${'\\'} autoconf ${'\\'} automake ${'\\'} + bash ${'\\'} bzip2 ${'\\'} build-base ${'\\'} cmake ${'\\'} diff --git a/templates/tools/dockerfile/test/python_alpine_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_alpine_x64/Dockerfile.template index 16c19cc3ad5..c2e4298aa3c 100644 --- a/templates/tools/dockerfile/test/python_alpine_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_alpine_x64/Dockerfile.template @@ -14,12 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM alpine:3.15 + FROM alpine:3.17 # Install Git and basic packages. RUN apk update && apk add \ autoconf \ automake \ + bash ${'\\'} bzip2 \ build-base \ cmake \ @@ -40,8 +41,6 @@ <%include file="../../git_avoid_dubious_ownership_error.include"/> - RUN ln -s /usr/bin/python3 /usr/bin/python - # Install Python packages from PyPI RUN python3 -m pip install --upgrade pip==19.3.1 diff --git a/templates/tools/doxygen/Doxyfile.base b/templates/tools/doxygen/Doxyfile.base index 1b6cf5f64e5..89073e722fd 100644 --- a/templates/tools/doxygen/Doxyfile.base +++ b/templates/tools/doxygen/Doxyfile.base @@ -1407,7 +1407,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1982,7 +1982,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/templates/tools/doxygen/Doxyfile.objc.include b/templates/tools/doxygen/Doxyfile.objc.include index fb87d23ce1e..9a42506717a 100644 --- a/templates/tools/doxygen/Doxyfile.objc.include +++ b/templates/tools/doxygen/Doxyfile.objc.include @@ -1438,7 +1438,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -2013,7 +2013,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/test/core/address_utils/sockaddr_utils_fuzzer_test.cc b/test/core/address_utils/sockaddr_utils_fuzzer_test.cc index 09cf4e5244d..593d99dd0e3 100644 --- a/test/core/address_utils/sockaddr_utils_fuzzer_test.cc +++ b/test/core/address_utils/sockaddr_utils_fuzzer_test.cc @@ -22,8 +22,6 @@ #include "absl/log/check.h" #include "absl/status/statusor.h" -#include - #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolved_address.h" diff --git a/test/core/address_utils/sockaddr_utils_test.cc b/test/core/address_utils/sockaddr_utils_test.cc index e06223a7649..83de472f102 100644 --- a/test/core/address_utils/sockaddr_utils_test.cc +++ b/test/core/address_utils/sockaddr_utils_test.cc @@ -44,8 +44,6 @@ #include "absl/log/check.h" -#include - #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils.h" diff --git a/test/core/bad_client/tests/bad_streaming_id.cc b/test/core/bad_client/tests/bad_streaming_id.cc index a29c64cea1a..4cd7cbc5778 100644 --- a/test/core/bad_client/tests/bad_streaming_id.cc +++ b/test/core/bad_client/tests/bad_streaming_id.cc @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/badreq.cc b/test/core/bad_client/tests/badreq.cc index 4d595b9f4e2..27a01496d97 100644 --- a/test/core/bad_client/tests/badreq.cc +++ b/test/core/bad_client/tests/badreq.cc @@ -19,7 +19,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/connection_prefix.cc b/test/core/bad_client/tests/connection_prefix.cc index 993e799839e..1aa899ab707 100644 --- a/test/core/bad_client/tests/connection_prefix.cc +++ b/test/core/bad_client/tests/connection_prefix.cc @@ -19,7 +19,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/duplicate_header.cc b/test/core/bad_client/tests/duplicate_header.cc index 12c5dfd58cb..c4ed690c5b2 100644 --- a/test/core/bad_client/tests/duplicate_header.cc +++ b/test/core/bad_client/tests/duplicate_header.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include "src/core/lib/gprpp/time.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/head_of_line_blocking.cc b/test/core/bad_client/tests/head_of_line_blocking.cc index 75615687d86..2a46c836780 100644 --- a/test/core/bad_client/tests/head_of_line_blocking.cc +++ b/test/core/bad_client/tests/head_of_line_blocking.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/out_of_bounds.cc b/test/core/bad_client/tests/out_of_bounds.cc index 1d03c4f8b56..04cdf739c41 100644 --- a/test/core/bad_client/tests/out_of_bounds.cc +++ b/test/core/bad_client/tests/out_of_bounds.cc @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/server_registered_method.cc b/test/core/bad_client/tests/server_registered_method.cc index 32f69f20a40..731eeb91acc 100644 --- a/test/core/bad_client/tests/server_registered_method.cc +++ b/test/core/bad_client/tests/server_registered_method.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include "src/core/server/server.h" diff --git a/test/core/bad_client/tests/simple_request.cc b/test/core/bad_client/tests/simple_request.cc index 7fa0065b6e5..6732d76147d 100644 --- a/test/core/bad_client/tests/simple_request.cc +++ b/test/core/bad_client/tests/simple_request.cc @@ -16,7 +16,6 @@ #include #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/unknown_frame.cc b/test/core/bad_client/tests/unknown_frame.cc index 7b3e1364ba5..a7c908ca483 100644 --- a/test/core/bad_client/tests/unknown_frame.cc +++ b/test/core/bad_client/tests/unknown_frame.cc @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_client/tests/window_overflow.cc b/test/core/bad_client/tests/window_overflow.cc index b58ca84febe..3137921591e 100644 --- a/test/core/bad_client/tests/window_overflow.cc +++ b/test/core/bad_client/tests/window_overflow.cc @@ -21,7 +21,6 @@ #include #include -#include #include "src/core/server/server.h" #include "test/core/bad_client/bad_client.h" diff --git a/test/core/bad_ssl/bad_ssl_test.cc b/test/core/bad_ssl/bad_ssl_test.cc index ade42a80c68..c548e188706 100644 --- a/test/core/bad_ssl/bad_ssl_test.cc +++ b/test/core/bad_ssl/bad_ssl_test.cc @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/test/core/bad_ssl/servers/alpn.cc b/test/core/bad_ssl/servers/alpn.cc index b3894767b01..285488747c8 100644 --- a/test/core/bad_ssl/servers/alpn.cc +++ b/test/core/bad_ssl/servers/alpn.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include "src/core/lib/iomgr/error.h" #include "src/core/util/useful.h" diff --git a/test/core/bad_ssl/servers/cert.cc b/test/core/bad_ssl/servers/cert.cc index f2fd81fa35d..30d1b7fc8fd 100644 --- a/test/core/bad_ssl/servers/cert.cc +++ b/test/core/bad_ssl/servers/cert.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include "src/core/lib/iomgr/error.h" #include "test/core/bad_ssl/server_common.h" diff --git a/test/core/call/yodel/fuzzer_main.cc b/test/core/call/yodel/fuzzer_main.cc index f88cda36333..ce9075485f9 100644 --- a/test/core/call/yodel/fuzzer_main.cc +++ b/test/core/call/yodel/fuzzer_main.cc @@ -19,7 +19,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/config/config_vars.h" #include "src/core/lib/event_engine/default_event_engine.h" diff --git a/test/core/call/yodel/yodel_test.cc b/test/core/call/yodel/yodel_test.cc index 4331c274b19..ccd31f35fb9 100644 --- a/test/core/call/yodel/yodel_test.cc +++ b/test/core/call/yodel/yodel_test.cc @@ -130,8 +130,11 @@ class YodelTest::WatchDog { private: YodelTest* const test_; grpc_event_engine::experimental::EventEngine::TaskHandle const timer_{ + // For fuzzing, we'll wait for a year since the fuzzing EE allows delays + // capped to one year for each RunAfter() call. This will prevent + // pre-mature timeouts of some legitimate fuzzed inputs. test_->state_->event_engine->RunAfter( - g_yodel_fuzzing ? Duration::Hours(24) : Duration::Minutes(5), + g_yodel_fuzzing ? Duration::Hours(24 * 365) : Duration::Minutes(5), [this]() { test_->Timeout(); })}; }; diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index cf1a7b08339..d06f98fba2e 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -41,7 +41,6 @@ #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" diff --git a/test/core/end2end/end2end_test_fuzzer.cc b/test/core/end2end/end2end_test_fuzzer.cc index c0f5cb3bbf9..98cad6424b5 100644 --- a/test/core/end2end/end2end_test_fuzzer.cc +++ b/test/core/end2end/end2end_test_fuzzer.cc @@ -29,7 +29,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/config/config_vars.h" #include "src/core/lib/event_engine/default_event_engine.h" diff --git a/test/core/end2end/end2end_test_suites.cc b/test/core/end2end/end2end_test_suites.cc index 047c2a7f3d9..61bc29cdb19 100644 --- a/test/core/end2end/end2end_test_suites.cc +++ b/test/core/end2end/end2end_test_suites.cc @@ -43,7 +43,6 @@ #include #include #include -#include #include #include "src/core/ext/transport/chaotic_good/client/chaotic_good_connector.h" diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index e37f3f4939c..fc2b5b9dc31 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/end2end/fixtures/h2_oauth2_common.h b/test/core/end2end/fixtures/h2_oauth2_common.h index 1af9d8b7bcd..92d873d313c 100644 --- a/test/core/end2end/fixtures/h2_oauth2_common.h +++ b/test/core/end2end/fixtures/h2_oauth2_common.h @@ -26,7 +26,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h b/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h index 7713cf5f597..cbe17d19a13 100644 --- a/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h +++ b/test/core/end2end/fixtures/h2_ssl_cred_reload_fixture.h @@ -26,7 +26,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/core/end2end/fixtures/h2_ssl_tls_common.h b/test/core/end2end/fixtures/h2_ssl_tls_common.h index a63ea964f20..ce346b3175e 100644 --- a/test/core/end2end/fixtures/h2_ssl_tls_common.h +++ b/test/core/end2end/fixtures/h2_ssl_tls_common.h @@ -26,7 +26,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/core/end2end/fixtures/h2_tls_common.h b/test/core/end2end/fixtures/h2_tls_common.h index 88fd4c6dd8b..c7a5ffd1d73 100644 --- a/test/core/end2end/fixtures/h2_tls_common.h +++ b/test/core/end2end/fixtures/h2_tls_common.h @@ -34,7 +34,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/error.h" diff --git a/test/core/end2end/fixtures/local_util.cc b/test/core/end2end/fixtures/local_util.cc index 12e05139a85..63bc96b9052 100644 --- a/test/core/end2end/fixtures/local_util.cc +++ b/test/core/end2end/fixtures/local_util.cc @@ -27,7 +27,6 @@ #include #include #include -#include static void process_auth_failure(void* state, grpc_auth_context* /*ctx*/, const grpc_metadata* /*md*/, diff --git a/test/core/end2end/fixtures/secure_fixture.h b/test/core/end2end/fixtures/secure_fixture.h index d0a8448ae72..fc9ef450c98 100644 --- a/test/core/end2end/fixtures/secure_fixture.h +++ b/test/core/end2end/fixtures/secure_fixture.h @@ -24,7 +24,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/host_port.h" diff --git a/test/core/end2end/fixtures/sockpair_fixture.h b/test/core/end2end/fixtures/sockpair_fixture.h index 354f052a769..8731ab05acf 100644 --- a/test/core/end2end/fixtures/sockpair_fixture.h +++ b/test/core/end2end/fixtures/sockpair_fixture.h @@ -26,7 +26,6 @@ #include #include #include -#include #include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 712f225d8bc..b92fdb5655c 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -42,7 +42,6 @@ #include #include #include -#include #include #include "src/core/ext/transport/inproc/inproc_transport.h" diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index f924c302241..3d9d1778d8f 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -21,7 +21,6 @@ #include #include #include -#include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/end2end/fuzzers/connector_fuzzer.cc b/test/core/end2end/fuzzers/connector_fuzzer.cc index 5c230c49297..d1d93789f47 100644 --- a/test/core/end2end/fuzzers/connector_fuzzer.cc +++ b/test/core/end2end/fuzzers/connector_fuzzer.cc @@ -105,6 +105,7 @@ class ConnectorFuzzer { engine_->RunAfterExactly( Duration::Milliseconds(when_ms), [this, new_size = action.resize_resource_quota()]() { + ExecCtx exec_ctx; resource_quota_->memory_quota()->SetSize(new_size); }); when_ms += 1; diff --git a/test/core/end2end/fuzzers/fuzzing_common.h b/test/core/end2end/fuzzers/fuzzing_common.h index 51d63abb3d3..95c48fd4f7e 100644 --- a/test/core/end2end/fuzzers/fuzzing_common.h +++ b/test/core/end2end/fuzzers/fuzzing_common.h @@ -32,7 +32,6 @@ #include "absl/types/span.h" #include -#include #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index a161815f51a..05fef731cc4 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -20,7 +20,6 @@ #include #include #include -#include #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/experiments/config.h" diff --git a/test/core/end2end/h2_ssl_session_reuse_test.cc b/test/core/end2end/h2_ssl_session_reuse_test.cc index e419096114d..6fd220719e5 100644 --- a/test/core/end2end/h2_ssl_session_reuse_test.cc +++ b/test/core/end2end/h2_ssl_session_reuse_test.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc b/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc index e3982feaa4f..24fc3e7c3c0 100644 --- a/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc +++ b/test/core/end2end/h2_tls_peer_property_external_verifier_test.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/end2end/tests/grpc_authz.cc b/test/core/end2end/tests/grpc_authz.cc index fa8c54ccec1..710535ea5d3 100644 --- a/test/core/end2end/tests/grpc_authz.cc +++ b/test/core/end2end/tests/grpc_authz.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/notification.h" diff --git a/test/core/end2end/tests/http2_stats.cc b/test/core/end2end/tests/http2_stats.cc index 5535e72153a..a8de51639f7 100644 --- a/test/core/end2end/tests/http2_stats.cc +++ b/test/core/end2end/tests/http2_stats.cc @@ -25,7 +25,6 @@ #include "gtest/gtest.h" #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/end2end/tests/retry_lb_drop.cc b/test/core/end2end/tests/retry_lb_drop.cc index 6a9e4b413b0..d53c680037d 100644 --- a/test/core/end2end/tests/retry_lb_drop.cc +++ b/test/core/end2end/tests/retry_lb_drop.cc @@ -28,7 +28,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" diff --git a/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc b/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc index 4dec816f1e9..913da903038 100644 --- a/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc +++ b/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc @@ -28,7 +28,6 @@ #include "absl/strings/str_cat.h" #include -#include #include #include "src/core/lib/debug/trace.h" diff --git a/test/core/event_engine/posix/timer_heap_test.cc b/test/core/event_engine/posix/timer_heap_test.cc index cfc50cdcd3f..e9249444dd4 100644 --- a/test/core/event_engine/posix/timer_heap_test.cc +++ b/test/core/event_engine/posix/timer_heap_test.cc @@ -28,8 +28,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include - #include "src/core/lib/event_engine/posix_engine/timer.h" #include "src/core/lib/gprpp/bitset.h" diff --git a/test/core/event_engine/posix/traced_buffer_list_test.cc b/test/core/event_engine/posix/traced_buffer_list_test.cc index 1ae3a05cb94..b6c8c0b7b3d 100644 --- a/test/core/event_engine/posix/traced_buffer_list_test.cc +++ b/test/core/event_engine/posix/traced_buffer_list_test.cc @@ -22,7 +22,6 @@ #include "gtest/gtest.h" #include -#include #include #include "src/core/lib/gprpp/time.h" diff --git a/test/core/event_engine/slice_buffer_test.cc b/test/core/event_engine/slice_buffer_test.cc index 4e2ade3eefd..0a0c26f9520 100644 --- a/test/core/event_engine/slice_buffer_test.cc +++ b/test/core/event_engine/slice_buffer_test.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include using ::grpc_event_engine::experimental::Slice; diff --git a/test/core/event_engine/tcp_socket_utils_test.cc b/test/core/event_engine/tcp_socket_utils_test.cc index 4826782e9f6..53ce735e478 100644 --- a/test/core/event_engine/tcp_socket_utils_test.cc +++ b/test/core/event_engine/tcp_socket_utils_test.cc @@ -51,7 +51,6 @@ #include "gtest/gtest.h" #include -#include #include "src/core/lib/iomgr/sockaddr.h" diff --git a/test/core/event_engine/test_suite/event_engine_test_framework.h b/test/core/event_engine/test_suite/event_engine_test_framework.h index 5b164ee03e2..0f2b768637a 100644 --- a/test/core/event_engine/test_suite/event_engine_test_framework.h +++ b/test/core/event_engine/test_suite/event_engine_test_framework.h @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include -#include extern absl::AnyInvocable< std::shared_ptr()>* diff --git a/test/core/event_engine/test_suite/tests/client_test.cc b/test/core/event_engine/test_suite/tests/client_test.cc index 29c4ce35084..331d59a6c57 100644 --- a/test/core/event_engine/test_suite/tests/client_test.cc +++ b/test/core/event_engine/test_suite/tests/client_test.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" diff --git a/test/core/event_engine/test_suite/tests/server_test.cc b/test/core/event_engine/test_suite/tests/server_test.cc index 0ff5bfb411c..e71bcd58cb8 100644 --- a/test/core/event_engine/test_suite/tests/server_test.cc +++ b/test/core/event_engine/test_suite/tests/server_test.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" diff --git a/test/core/event_engine/test_suite/tools/windows_event_engine_factory.cc b/test/core/event_engine/test_suite/tools/windows_event_engine_factory.cc index 4b1bf530495..98f591fe604 100644 --- a/test/core/event_engine/test_suite/tools/windows_event_engine_factory.cc +++ b/test/core/event_engine/test_suite/tools/windows_event_engine_factory.cc @@ -18,7 +18,6 @@ #include "absl/log/check.h" #include -#include #include #ifdef GPR_WINDOWS diff --git a/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc b/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc index d655fedcf35..a363e872eac 100644 --- a/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc +++ b/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc @@ -27,7 +27,6 @@ #include "absl/strings/string_view.h" #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/gprpp/chunked_vector_fuzzer.cc b/test/core/gprpp/chunked_vector_fuzzer.cc index 2a83b3df935..d857208c2e5 100644 --- a/test/core/gprpp/chunked_vector_fuzzer.cc +++ b/test/core/gprpp/chunked_vector_fuzzer.cc @@ -23,7 +23,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/gprpp/chunked_vector.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" diff --git a/test/core/gprpp/ref_counted_ptr_test.cc b/test/core/gprpp/ref_counted_ptr_test.cc index 12f619e5673..5c3e0f0f6c7 100644 --- a/test/core/gprpp/ref_counted_ptr_test.cc +++ b/test/core/gprpp/ref_counted_ptr_test.cc @@ -24,8 +24,6 @@ #include "absl/log/check.h" #include "gtest/gtest.h" -#include - #include "src/core/lib/gprpp/dual_ref_counted.h" #include "src/core/lib/gprpp/ref_counted.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc index 0a8c0a45066..bdd625adad5 100644 --- a/test/core/iomgr/combiner_test.cc +++ b/test/core/iomgr/combiner_test.cc @@ -24,7 +24,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/notification.h" diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc index 28676454923..4a37f512a06 100644 --- a/test/core/iomgr/fd_conservation_posix_test.cc +++ b/test/core/iomgr/fd_conservation_posix_test.cc @@ -21,7 +21,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/endpoint_pair.h" diff --git a/test/core/iomgr/grpc_ipv6_loopback_available_test.cc b/test/core/iomgr/grpc_ipv6_loopback_available_test.cc index 34a2c59f7ce..2b8ae366778 100644 --- a/test/core/iomgr/grpc_ipv6_loopback_available_test.cc +++ b/test/core/iomgr/grpc_ipv6_loopback_available_test.cc @@ -19,7 +19,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/port.h" diff --git a/test/core/iomgr/socket_utils_test.cc b/test/core/iomgr/socket_utils_test.cc index edec3943f7c..6d56ad9d65c 100644 --- a/test/core/iomgr/socket_utils_test.cc +++ b/test/core/iomgr/socket_utils_test.cc @@ -31,7 +31,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/json/fuzzer.cc b/test/core/json/fuzzer.cc index 1ae8ad25429..bc17d74af3d 100644 --- a/test/core/json/fuzzer.cc +++ b/test/core/json/fuzzer.cc @@ -24,7 +24,6 @@ #include "absl/strings/string_view.h" #include -#include #include "src/core/util/json/json_reader.h" #include "src/core/util/json/json_writer.h" diff --git a/test/core/load_balancing/static_stride_scheduler_benchmark.cc b/test/core/load_balancing/static_stride_scheduler_benchmark.cc index ca882c63247..7ae3973637b 100644 --- a/test/core/load_balancing/static_stride_scheduler_benchmark.cc +++ b/test/core/load_balancing/static_stride_scheduler_benchmark.cc @@ -27,8 +27,6 @@ #include "absl/types/optional.h" #include "absl/types/span.h" -#include - #include "src/core/lib/gprpp/no_destruct.h" #include "src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h" diff --git a/test/core/memory_usage/memstats.cc b/test/core/memory_usage/memstats.cc index 4a479ca5edd..cfac08bcf31 100644 --- a/test/core/memory_usage/memstats.cc +++ b/test/core/memory_usage/memstats.cc @@ -22,8 +22,6 @@ #include "absl/log/check.h" #include "absl/strings/str_cat.h" -#include - long GetMemUsage(absl::optional pid) { // Default is getting memory usage for self (calling process) std::string path = "/proc/self/stat"; diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index 9dd8ebbce7a..a952cf558dc 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -20,7 +20,6 @@ #include #include -#include #include "test/core/test_util/test_config.h" diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index 4e22041dfe5..278f4c4cbfa 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -20,7 +20,6 @@ #include #include -#include #include "test/core/test_util/test_config.h" diff --git a/test/core/promise/BUILD b/test/core/promise/BUILD index 532c2f95adc..318756063fc 100644 --- a/test/core/promise/BUILD +++ b/test/core/promise/BUILD @@ -540,6 +540,7 @@ grpc_proto_fuzzer( "//src/core:poll", "//src/core:race", "//src/core:seq", + "//test/core/test_util:grpc_test_util", ], ) diff --git a/test/core/promise/observable_test.cc b/test/core/promise/observable_test.cc index b6a2268ad99..12fd66fe36c 100644 --- a/test/core/promise/observable_test.cc +++ b/test/core/promise/observable_test.cc @@ -23,6 +23,8 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include + #include "src/core/lib/gprpp/notification.h" #include "src/core/lib/promise/loop.h" #include "src/core/lib/promise/map.h" diff --git a/test/core/promise/promise_fuzzer.cc b/test/core/promise/promise_fuzzer.cc index d74ad045ec4..0b70153d023 100644 --- a/test/core/promise/promise_fuzzer.cc +++ b/test/core/promise/promise_fuzzer.cc @@ -24,8 +24,6 @@ #include "absl/status/status.h" #include "absl/types/optional.h" -#include - #include "src/core/lib/promise/activity.h" #include "src/core/lib/promise/join.h" #include "src/core/lib/promise/map.h" diff --git a/test/core/resolver/endpoint_addresses_test.cc b/test/core/resolver/endpoint_addresses_test.cc index 236e26fe8e9..d5f14f624da 100644 --- a/test/core/resolver/endpoint_addresses_test.cc +++ b/test/core/resolver/endpoint_addresses_test.cc @@ -24,7 +24,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include #include #include "src/core/lib/address_utils/parse_address.h" diff --git a/test/core/resource_quota/call_checker.h b/test/core/resource_quota/call_checker.h index 9157618956f..541c0168085 100644 --- a/test/core/resource_quota/call_checker.h +++ b/test/core/resource_quota/call_checker.h @@ -19,8 +19,6 @@ #include "absl/log/check.h" -#include - namespace grpc_core { namespace testing { diff --git a/test/core/resource_quota/memory_quota_test.cc b/test/core/resource_quota/memory_quota_test.cc index 2d46537f946..245fe892c97 100644 --- a/test/core/resource_quota/memory_quota_test.cc +++ b/test/core/resource_quota/memory_quota_test.cc @@ -25,6 +25,7 @@ #include "gtest/gtest.h" #include +#include #include "src/core/lib/iomgr/exec_ctx.h" #include "test/core/resource_quota/call_checker.h" diff --git a/test/core/security/alts_credentials_fuzzer.cc b/test/core/security/alts_credentials_fuzzer.cc index 224a5ea9859..4913a3b29c9 100644 --- a/test/core/security/alts_credentials_fuzzer.cc +++ b/test/core/security/alts_credentials_fuzzer.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/check_gcp_environment_linux_test.cc b/test/core/security/check_gcp_environment_linux_test.cc index 1627aa67b67..4217c0eb346 100644 --- a/test/core/security/check_gcp_environment_linux_test.cc +++ b/test/core/security/check_gcp_environment_linux_test.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/check_gcp_environment_windows_test.cc b/test/core/security/check_gcp_environment_windows_test.cc index d046565d8ab..8a1cbbb3fba 100644 --- a/test/core/security/check_gcp_environment_windows_test.cc +++ b/test/core/security/check_gcp_environment_windows_test.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/create_jwt.cc b/test/core/security/create_jwt.cc index a8f48a9d179..79be2b68e1c 100644 --- a/test/core/security/create_jwt.cc +++ b/test/core/security/create_jwt.cc @@ -22,7 +22,6 @@ #include #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/jwt/jwt_credentials.h" diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 68dc26752d1..a96474cbf42 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -714,49 +714,45 @@ TEST_F(CredentialsTest, TestChannelOauth2GoogleIamCompositeCreds) { } void validate_compute_engine_http_request(const grpc_http_request* request, - const char* host, const char* path) { - CHECK_EQ(strcmp(host, "metadata.google.internal."), 0); - CHECK_EQ( - strcmp(path, - "/computeMetadata/v1/instance/service-accounts/default/token"), - 0); - CHECK_EQ(request->hdr_count, 1); - CHECK_EQ(strcmp(request->hdrs[0].key, "Metadata-Flavor"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "Google"), 0); + const URI& uri) { + EXPECT_EQ(uri.authority(), "metadata.google.internal."); + EXPECT_EQ(uri.path(), + "/computeMetadata/v1/instance/service-accounts/default/token"); + ASSERT_EQ(request->hdr_count, 1); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Metadata-Flavor"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), "Google"); } int compute_engine_httpcli_get_success_override( - const grpc_http_request* request, const char* host, const char* path, - Timestamp /*deadline*/, grpc_closure* on_done, - grpc_http_response* response) { - validate_compute_engine_http_request(request, host, path); + const grpc_http_request* request, const URI& uri, Timestamp /*deadline*/, + grpc_closure* on_done, grpc_http_response* response) { + validate_compute_engine_http_request(request, uri); *response = http_response(200, valid_oauth2_json_response); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } int compute_engine_httpcli_get_failure_override( - const grpc_http_request* request, const char* host, const char* path, - Timestamp /*deadline*/, grpc_closure* on_done, - grpc_http_response* response) { - validate_compute_engine_http_request(request, host, path); + const grpc_http_request* request, const URI& uri, Timestamp /*deadline*/, + grpc_closure* on_done, grpc_http_response* response) { + validate_compute_engine_http_request(request, uri); *response = http_response(403, "Not Authorized."); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } -int httpcli_post_should_not_be_called( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* /*path*/, const char* /*body_bytes*/, size_t /*body_size*/, - Timestamp /*deadline*/, grpc_closure* /*on_done*/, - grpc_http_response* /*response*/) { +int httpcli_post_should_not_be_called(const grpc_http_request* /*request*/, + const URI& /*uri*/, + absl::string_view /*body*/, + Timestamp /*deadline*/, + grpc_closure* /*on_done*/, + grpc_http_response* /*response*/) { CHECK(false) << "HTTP POST should not be called"; return 1; } int httpcli_get_should_not_be_called(const grpc_http_request* /*request*/, - const char* /*host*/, const char* /*path*/, - Timestamp /*deadline*/, + const URI& /*uri*/, Timestamp /*deadline*/, grpc_closure* /*on_done*/, grpc_http_response* /*response*/) { CHECK(false) << "HTTP GET should not be called"; @@ -764,9 +760,8 @@ int httpcli_get_should_not_be_called(const grpc_http_request* /*request*/, } int httpcli_put_should_not_be_called(const grpc_http_request* /*request*/, - const char* /*host*/, const char* /*path*/, - const char* /*body_bytes*/, - size_t /*body_size*/, + const URI& /*uri*/, + absl::string_view /*body*/, Timestamp /*deadline*/, grpc_closure* /*on_done*/, grpc_http_response* /*response*/) { @@ -830,40 +825,34 @@ TEST_F(CredentialsTest, TestComputeEngineCredsFailure) { } void validate_refresh_token_http_request(const grpc_http_request* request, - const char* host, const char* path, - const char* body, size_t body_size) { + const URI& uri, + absl::string_view body) { // The content of the assertion is tested extensively in json_token_test. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); - std::string expected_body = absl::StrFormat( - GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING, - "32555999999.apps.googleusercontent.com", "EmssLNjJy1332hD4KFsecret", - "1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42"); - CHECK_EQ(expected_body.size(), body_size); - CHECK_EQ(memcmp(expected_body.data(), body, body_size), 0); - CHECK_EQ(strcmp(host, GRPC_GOOGLE_OAUTH2_SERVICE_HOST), 0); - CHECK_EQ(strcmp(path, GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH), 0); - CHECK_EQ(request->hdr_count, 1); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); + EXPECT_EQ(body, absl::StrFormat(GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING, + "32555999999.apps.googleusercontent.com", + "EmssLNjJy1332hD4KFsecret", + "1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42")); + EXPECT_EQ(uri.authority(), GRPC_GOOGLE_OAUTH2_SERVICE_HOST); + EXPECT_EQ(uri.path(), GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH); + ASSERT_EQ(request->hdr_count, 1); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); } int refresh_token_httpcli_post_success(const grpc_http_request* request, - const char* host, const char* path, - const char* body, size_t body_size, + const URI& uri, absl::string_view body, Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { - validate_refresh_token_http_request(request, host, path, body, body_size); + validate_refresh_token_http_request(request, uri, body); *response = http_response(200, valid_oauth2_json_response); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } int token_httpcli_post_failure(const grpc_http_request* /*request*/, - const char* /*host*/, const char* /*path*/, - const char* /*body*/, size_t /*body_size*/, + const URI& /*uri*/, absl::string_view /*body*/, Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { *response = http_response(403, "Not Authorized."); @@ -1033,12 +1022,9 @@ void assert_query_parameters(const URI& uri, absl::string_view expected_key, } void validate_sts_token_http_request(const grpc_http_request* request, - const char* host, const char* path, - const char* body, size_t body_size, + const URI& uri, absl::string_view body, bool expect_actor_token) { // Check that the body is constructed properly. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); std::string get_url_equivalent = absl::StrFormat("%s?%s", test_sts_endpoint_url, body); absl::StatusOr url = URI::Parse(get_url_equivalent); @@ -1065,31 +1051,30 @@ void validate_sts_token_http_request(const grpc_http_request* request, } // Check the rest of the request. - CHECK_EQ(strcmp(host, "foo.com:5555"), 0); - CHECK_EQ(strcmp(path, "/v1/token-exchange"), 0); - CHECK_EQ(request->hdr_count, 1); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); + EXPECT_EQ(uri.authority(), "foo.com:5555"); + EXPECT_EQ(uri.path(), "/v1/token-exchange"); + ASSERT_EQ(request->hdr_count, 1); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); } int sts_token_httpcli_post_success(const grpc_http_request* request, - const char* host, const char* path, - const char* body, size_t body_size, + const URI& uri, absl::string_view body, Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { - validate_sts_token_http_request(request, host, path, body, body_size, true); + validate_sts_token_http_request(request, uri, body, true); *response = http_response(200, valid_sts_json_response); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } int sts_token_httpcli_post_success_no_actor_token( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, Timestamp /*deadline*/, - grpc_closure* on_done, grpc_http_response* response) { - validate_sts_token_http_request(request, host, path, body, body_size, false); + const grpc_http_request* request, const URI& uri, absl::string_view body, + Timestamp /*deadline*/, grpc_closure* on_done, + grpc_http_response* response) { + validate_sts_token_http_request(request, uri, body, false); *response = http_response(200, valid_sts_json_response); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; @@ -1625,7 +1610,7 @@ TEST_F(CredentialsTest, } int default_creds_metadata_server_detection_httpcli_get_success_override( - const grpc_http_request* /*request*/, const char* host, const char* path, + const grpc_http_request* /*request*/, const URI& uri, Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { *response = http_response(200, ""); @@ -1635,8 +1620,8 @@ int default_creds_metadata_server_detection_httpcli_get_success_override( headers[0].value = gpr_strdup("Google"); response->hdr_count = 1; response->hdrs = headers; - CHECK_EQ(strcmp(path, "/"), 0); - CHECK_EQ(strcmp(host, "metadata.google.internal."), 0); + EXPECT_EQ(uri.path(), "/"); + EXPECT_EQ(uri.authority(), "metadata.google.internal."); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } @@ -1713,12 +1698,12 @@ TEST_F(CredentialsTest, TestGoogleDefaultCredsNonGce) { } int default_creds_gce_detection_httpcli_get_failure_override( - const grpc_http_request* /*request*/, const char* host, const char* path, + const grpc_http_request* /*request*/, const URI& uri, Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { // No magic header. - CHECK_EQ(strcmp(path, "/"), 0); - CHECK_EQ(strcmp(host, "metadata.google.internal."), 0); + EXPECT_EQ(uri.path(), "/"); + EXPECT_EQ(uri.authority(), "metadata.google.internal."); *response = http_response(200, ""); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; @@ -2130,11 +2115,9 @@ TEST_F(CredentialsTest, TestAuthMetadataContext) { } void validate_external_account_creds_token_exchage_request( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, bool /*expect_actor_token*/) { + const grpc_http_request* request, const URI& request_uri, + absl::string_view body) { // Check that the body is constructed properly. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); std::string get_url_equivalent = absl::StrFormat("%s?%s", "https://foo.com:5555/token", body); absl::StatusOr uri = URI::Parse(get_url_equivalent); @@ -2151,100 +2134,84 @@ void validate_external_account_creds_token_exchage_request( assert_query_parameters(*uri, "subject_token_type", "subject_token_type"); assert_query_parameters(*uri, "scope", "https://www.googleapis.com/auth/cloud-platform"); - // Check the rest of the request. - CHECK_EQ(strcmp(host, "foo.com:5555"), 0); - CHECK_EQ(strcmp(path, "/token"), 0); - CHECK_EQ(request->hdr_count, 3); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); - CHECK_EQ(strcmp(request->hdrs[2].key, "Authorization"), 0); - CHECK_EQ( - strcmp(request->hdrs[2].value, "Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="), - 0); + EXPECT_EQ(request_uri.authority(), "foo.com:5555"); + EXPECT_EQ(request_uri.path(), "/token"); + ASSERT_EQ(request->hdr_count, 3); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); + EXPECT_EQ(absl::string_view(request->hdrs[2].key), "Authorization"); + EXPECT_EQ(absl::string_view(request->hdrs[2].value), + "Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="); } void validate_external_account_creds_token_exchage_request_with_url_encode( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, bool /*expect_actor_token*/) { + const grpc_http_request* request, const URI& uri, absl::string_view body) { // Check that the body is constructed properly. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); - CHECK_EQ( - strcmp( - std::string(body, body_size).c_str(), - "audience=audience_!%40%23%24&grant_type=urn%3Aietf%3Aparams%3Aoauth%" - "3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%" - "3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=" - "subject_token_type_!%40%23%24&subject_token=test_subject_token&" - "scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&" - "options=%7B%7D"), - 0); - + EXPECT_EQ( + body, + "audience=audience_!%40%23%24&grant_type=urn%3Aietf%3Aparams%3Aoauth%" + "3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%" + "3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=" + "subject_token_type_!%40%23%24&subject_token=test_subject_token&" + "scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&" + "options=%7B%7D"); // Check the rest of the request. - CHECK_EQ(strcmp(host, "foo.com:5555"), 0); - CHECK_EQ(strcmp(path, "/token_url_encode"), 0); - CHECK_EQ(request->hdr_count, 3); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); - CHECK_EQ(strcmp(request->hdrs[2].key, "Authorization"), 0); - CHECK_EQ( - strcmp(request->hdrs[2].value, "Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="), - 0); + EXPECT_EQ(uri.authority(), "foo.com:5555"); + EXPECT_EQ(uri.path(), "/token_url_encode"); + ASSERT_EQ(request->hdr_count, 3); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); + EXPECT_EQ(absl::string_view(request->hdrs[2].key), "Authorization"); + EXPECT_EQ(absl::string_view(request->hdrs[2].value), + "Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="); } void validate_external_account_creds_service_account_impersonation_request( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, bool /*expect_actor_token*/) { + const grpc_http_request* request, const URI& uri, absl::string_view body) { // Check that the body is constructed properly. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); - CHECK_EQ(strcmp(body, "scope=scope_1%20scope_2&lifetime=3600s"), 0); + EXPECT_EQ(body, "scope=scope_1%20scope_2&lifetime=3600s"); // Check the rest of the request. - CHECK_EQ(strcmp(host, "foo.com:5555"), 0); - CHECK_EQ(strcmp(path, "/service_account_impersonation"), 0); - CHECK_EQ(request->hdr_count, 2); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); - CHECK_EQ(strcmp(request->hdrs[1].key, "Authorization"), 0); - CHECK_EQ(strcmp(request->hdrs[1].value, "Bearer token_exchange_access_token"), - 0); + EXPECT_EQ(uri.authority(), "foo.com:5555"); + EXPECT_EQ(uri.path(), "/service_account_impersonation"); + ASSERT_EQ(request->hdr_count, 2); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); + EXPECT_EQ(absl::string_view(request->hdrs[1].key), "Authorization"); + EXPECT_EQ(absl::string_view(request->hdrs[1].value), + "Bearer token_exchange_access_token"); } void validate_external_account_creds_serv_acc_imp_custom_lifetime_request( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, bool /*expect_actor_token*/) { + const grpc_http_request* request, const URI& uri, absl::string_view body) { // Check that the body is constructed properly. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); - CHECK_EQ(strcmp(body, "scope=scope_1%20scope_2&lifetime=1800s"), 0); + EXPECT_EQ(body, "scope=scope_1%20scope_2&lifetime=1800s"); // Check the rest of the request. - CHECK_EQ(strcmp(host, "foo.com:5555"), 0); - CHECK_EQ(strcmp(path, "/service_account_impersonation"), 0); - CHECK_EQ(request->hdr_count, 2); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); - CHECK_EQ(strcmp(request->hdrs[1].key, "Authorization"), 0); - CHECK_EQ(strcmp(request->hdrs[1].value, "Bearer token_exchange_access_token"), - 0); + EXPECT_EQ(uri.authority(), "foo.com:5555"); + EXPECT_EQ(uri.path(), "/service_account_impersonation"); + ASSERT_EQ(request->hdr_count, 2); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); + EXPECT_EQ(absl::string_view(request->hdrs[1].key), "Authorization"); + EXPECT_EQ(absl::string_view(request->hdrs[1].value), + "Bearer token_exchange_access_token"); } int external_acc_creds_serv_acc_imp_custom_lifetime_httpcli_post_success( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, Timestamp /*deadline*/, - grpc_closure* on_done, grpc_http_response* response) { - if (strcmp(path, "/token") == 0) { - validate_external_account_creds_token_exchage_request( - request, host, path, body, body_size, true); + const grpc_http_request* request, const URI& uri, absl::string_view body, + Timestamp /*deadline*/, grpc_closure* on_done, + grpc_http_response* response) { + if (uri.path() == "/token") { + validate_external_account_creds_token_exchage_request(request, uri, body); *response = http_response( 200, valid_external_account_creds_token_exchange_response); - } else if (strcmp(path, "/service_account_impersonation") == 0) { + } else if (uri.path() == "/service_account_impersonation") { validate_external_account_creds_serv_acc_imp_custom_lifetime_request( - request, host, path, body, body_size, true); + request, uri, body); *response = http_response( 200, valid_external_account_creds_service_account_impersonation_response); @@ -2254,23 +2221,22 @@ int external_acc_creds_serv_acc_imp_custom_lifetime_httpcli_post_success( } int external_account_creds_httpcli_post_success( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, Timestamp /*deadline*/, - grpc_closure* on_done, grpc_http_response* response) { - if (strcmp(path, "/token") == 0) { - validate_external_account_creds_token_exchage_request( - request, host, path, body, body_size, true); + const grpc_http_request* request, const URI& uri, absl::string_view body, + Timestamp /*deadline*/, grpc_closure* on_done, + grpc_http_response* response) { + if (uri.path() == "/token") { + validate_external_account_creds_token_exchage_request(request, uri, body); *response = http_response( 200, valid_external_account_creds_token_exchange_response); - } else if (strcmp(path, "/service_account_impersonation") == 0) { + } else if (uri.path() == "/service_account_impersonation") { validate_external_account_creds_service_account_impersonation_request( - request, host, path, body, body_size, true); + request, uri, body); *response = http_response( 200, valid_external_account_creds_service_account_impersonation_response); - } else if (strcmp(path, "/token_url_encode") == 0) { + } else if (uri.path() == "/token_url_encode") { validate_external_account_creds_token_exchage_request_with_url_encode( - request, host, path, body, body_size, true); + request, uri, body); *response = http_response( 200, valid_external_account_creds_token_exchange_response); } @@ -2279,16 +2245,15 @@ int external_account_creds_httpcli_post_success( } int external_account_creds_httpcli_post_failure_token_exchange_response_missing_access_token( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* path, const char* /*body*/, size_t /*body_size*/, - Timestamp /*deadline*/, grpc_closure* on_done, + const grpc_http_request* /*request*/, const URI& uri, + absl::string_view /*body*/, Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { - if (strcmp(path, "/token") == 0) { + if (uri.path() == "/token") { *response = http_response(200, "{\"not_access_token\":\"not_access_token\"," "\"expires_in\":3599," " \"token_type\":\"Bearer\"}"); - } else if (strcmp(path, "/service_account_impersonation") == 0) { + } else if (uri.path() == "/service_account_impersonation") { *response = http_response( 200, valid_external_account_creds_service_account_impersonation_response); @@ -2298,18 +2263,18 @@ int external_account_creds_httpcli_post_failure_token_exchange_response_missing_ } int url_external_account_creds_httpcli_get_success( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* path, Timestamp /*deadline*/, grpc_closure* on_done, + const grpc_http_request* /*request*/, const URI& uri, + Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { - if (strcmp(path, "/generate_subject_token_format_text") == 0) { + if (uri.path() == "/generate_subject_token_format_text") { *response = http_response( 200, valid_url_external_account_creds_retrieve_subject_token_response_format_text); - } else if (strcmp(path, "/path/to/url/creds?p1=v1&p2=v2") == 0) { + } else if (uri.path() == "/path/to/url/creds?p1=v1&p2=v2") { *response = http_response( 200, valid_url_external_account_creds_retrieve_subject_token_response_format_text); - } else if (strcmp(path, "/generate_subject_token_format_json") == 0) { + } else if (uri.path() == "/generate_subject_token_format_json") { *response = http_response( 200, valid_url_external_account_creds_retrieve_subject_token_response_format_json); @@ -2319,14 +2284,11 @@ int url_external_account_creds_httpcli_get_success( } void validate_aws_external_account_creds_token_exchage_request( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, bool /*expect_actor_token*/) { - // Check that the body is constructed properly. - CHECK_NE(body, nullptr); - CHECK_NE(body_size, 0); + const grpc_http_request* request, const URI& request_uri, + absl::string_view body) { // Check that the regional_cred_verification_url got constructed // with the correct AWS Region ("test_regionz" or "test_region"). - CHECK(strstr(body, "regional_cred_verification_url_test_region")); + EXPECT_NE(body.find("regional_cred_verification_url_test_region"), body.npos); std::string get_url_equivalent = absl::StrFormat("%s?%s", "https://foo.com:5555/token", body); absl::StatusOr uri = URI::Parse(get_url_equivalent); @@ -2340,35 +2302,34 @@ void validate_aws_external_account_creds_token_exchage_request( assert_query_parameters(*uri, "scope", "https://www.googleapis.com/auth/cloud-platform"); // Check the rest of the request. - CHECK_EQ(strcmp(host, "foo.com:5555"), 0); - CHECK_EQ(strcmp(path, "/token"), 0); - CHECK_EQ(request->hdr_count, 3); - CHECK_EQ(strcmp(request->hdrs[0].key, "Content-Type"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "application/x-www-form-urlencoded"), - 0); - CHECK_EQ(strcmp(request->hdrs[1].key, "x-goog-api-client"), 0); + EXPECT_EQ(request_uri.authority(), "foo.com:5555"); + EXPECT_EQ(request_uri.path(), "/token"); + ASSERT_EQ(request->hdr_count, 3); + EXPECT_EQ(absl::string_view(request->hdrs[0].key), "Content-Type"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + "application/x-www-form-urlencoded"); + EXPECT_EQ(absl::string_view(request->hdrs[1].key), "x-goog-api-client"); EXPECT_EQ( - request->hdrs[1].value, + absl::string_view(request->hdrs[1].value), absl::StrFormat("gl-cpp/unknown auth/%s google-byoid-sdk source/aws " "sa-impersonation/false config-lifetime/false", grpc_version_string())); - CHECK_EQ(strcmp(request->hdrs[2].key, "Authorization"), 0); - CHECK_EQ( - strcmp(request->hdrs[2].value, "Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="), - 0); + EXPECT_EQ(absl::string_view(request->hdrs[2].key), "Authorization"); + EXPECT_EQ(absl::string_view(request->hdrs[2].value), + "Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ="); } int aws_external_account_creds_httpcli_get_success( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* path, Timestamp /*deadline*/, grpc_closure* on_done, + const grpc_http_request* /*request*/, const URI& uri, + Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { - if (strcmp(path, "/region_url") == 0) { + if (uri.path() == "/region_url") { *response = http_response(200, "test_regionz"); - } else if (strcmp(path, "/url") == 0) { + } else if (uri.path() == "/url") { *response = http_response(200, "test_role_name"); - } else if (strcmp(path, "/url_no_role_name") == 0) { + } else if (uri.path() == "/url_no_role_name") { *response = http_response(200, ""); - } else if (strcmp(path, "/url/test_role_name") == 0) { + } else if (uri.path() == "/url/test_role_name") { *response = http_response( 200, valid_aws_external_account_creds_retrieve_signing_keys_response); } @@ -2377,36 +2338,42 @@ int aws_external_account_creds_httpcli_get_success( } int aws_imdsv2_external_account_creds_httpcli_get_success( - const grpc_http_request* request, const char* host, const char* path, - Timestamp deadline, grpc_closure* on_done, grpc_http_response* response) { - CHECK_EQ(request->hdr_count, 1); - CHECK_EQ(strcmp(request->hdrs[0].key, "x-aws-ec2-metadata-token"), 0); - CHECK_EQ(strcmp(request->hdrs[0].value, aws_imdsv2_session_token), 0); - return aws_external_account_creds_httpcli_get_success( - request, host, path, deadline, on_done, response); + const grpc_http_request* request, const URI& uri, Timestamp deadline, + grpc_closure* on_done, grpc_http_response* response) { + EXPECT_EQ(request->hdr_count, 1); + if (request->hdr_count == 1) { + EXPECT_EQ(absl::string_view(request->hdrs[0].key), + "x-aws-ec2-metadata-token"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), + aws_imdsv2_session_token); + } + return aws_external_account_creds_httpcli_get_success(request, uri, deadline, + on_done, response); } int aws_imdsv2_external_account_creds_httpcli_put_success( - const grpc_http_request* request, const char* /*host*/, const char* path, - const char* /*body*/, size_t /*body_size*/, Timestamp /*deadline*/, - grpc_closure* on_done, grpc_http_response* response) { - CHECK_EQ(request->hdr_count, 1); - CHECK_EQ(strcmp(request->hdrs[0].key, "x-aws-ec2-metadata-token-ttl-seconds"), - 0); - CHECK_EQ(strcmp(request->hdrs[0].value, "300"), 0); - CHECK_EQ(strcmp(path, "/imdsv2_session_token_url"), 0); + const grpc_http_request* request, const URI& uri, + absl::string_view /*body*/, Timestamp /*deadline*/, grpc_closure* on_done, + grpc_http_response* response) { + EXPECT_EQ(request->hdr_count, 1); + if (request->hdr_count == 1) { + EXPECT_EQ(absl::string_view(request->hdrs[0].key), + "x-aws-ec2-metadata-token-ttl-seconds"); + EXPECT_EQ(absl::string_view(request->hdrs[0].value), "300"); + } + EXPECT_EQ(uri.path(), "/imdsv2_session_token_url"); *response = http_response(200, aws_imdsv2_session_token); ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } int aws_external_account_creds_httpcli_post_success( - const grpc_http_request* request, const char* host, const char* path, - const char* body, size_t body_size, Timestamp /*deadline*/, - grpc_closure* on_done, grpc_http_response* response) { - if (strcmp(path, "/token") == 0) { - validate_aws_external_account_creds_token_exchage_request( - request, host, path, body, body_size, true); + const grpc_http_request* request, const URI& uri, absl::string_view body, + Timestamp /*deadline*/, grpc_closure* on_done, + grpc_http_response* response) { + if (uri.path() == "/token") { + validate_aws_external_account_creds_token_exchage_request(request, uri, + body); *response = http_response( 200, valid_external_account_creds_token_exchange_response); } diff --git a/test/core/security/grpc_alts_credentials_options_test.cc b/test/core/security/grpc_alts_credentials_options_test.cc index 4168ffe7244..9c53cd25bf3 100644 --- a/test/core/security/grpc_alts_credentials_options_test.cc +++ b/test/core/security/grpc_alts_credentials_options_test.cc @@ -25,7 +25,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/grpc_tls_certificate_distributor_test.cc b/test/core/security/grpc_tls_certificate_distributor_test.cc index f43b15f38a9..e0fbd238468 100644 --- a/test/core/security/grpc_tls_certificate_distributor_test.cc +++ b/test/core/security/grpc_tls_certificate_distributor_test.cc @@ -27,7 +27,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/grpc_tls_certificate_provider_test.cc b/test/core/security/grpc_tls_certificate_provider_test.cc index ed0621fef74..31e7a06bd63 100644 --- a/test/core/security/grpc_tls_certificate_provider_test.cc +++ b/test/core/security/grpc_tls_certificate_provider_test.cc @@ -25,7 +25,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/grpc_tls_credentials_options_test.cc b/test/core/security/grpc_tls_credentials_options_test.cc index 4dde2e18b97..8270f7955dd 100644 --- a/test/core/security/grpc_tls_credentials_options_test.cc +++ b/test/core/security/grpc_tls_credentials_options_test.cc @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "src/core/lib/config/config_vars.h" diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index 792fbe670cf..e250d352cce 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/crash.h" @@ -319,33 +318,31 @@ static grpc_http_response http_response(int status, char* body) { } static int httpcli_post_should_not_be_called( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* /*path*/, const char* /*body_bytes*/, size_t /*body_size*/, - grpc_core::Timestamp /*deadline*/, grpc_closure* /*on_done*/, - grpc_http_response* /*response*/) { + const grpc_http_request* /*request*/, const grpc_core::URI& /*uri*/, + absl::string_view /*body*/, grpc_core::Timestamp /*deadline*/, + grpc_closure* /*on_done*/, grpc_http_response* /*response*/) { EXPECT_EQ("HTTP POST should not be called", nullptr); return 1; } static int httpcli_put_should_not_be_called( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* /*path*/, const char* /*body_bytes*/, size_t /*body_size*/, - grpc_core::Timestamp /*deadline*/, grpc_closure* /*on_done*/, - grpc_http_response* /*response*/) { + const grpc_http_request* /*request*/, const grpc_core::URI& /*uri*/, + absl::string_view /*body*/, grpc_core::Timestamp /*deadline*/, + grpc_closure* /*on_done*/, grpc_http_response* /*response*/) { EXPECT_EQ("HTTP PUT should not be called", nullptr); return 1; } static int httpcli_get_google_keys_for_email( - const grpc_http_request* /*request*/, const char* host, const char* path, + const grpc_http_request* /*request*/, const grpc_core::URI& uri, grpc_core::Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { *response = http_response(200, good_google_email_keys()); - EXPECT_STREQ(host, "www.googleapis.com"); - EXPECT_STREQ(path, - "/robot/v1/metadata/x509/" - "777-abaslkan11hlb6nmim3bpspl31ud@developer." - "gserviceaccount.com"); + EXPECT_EQ(uri.authority(), "www.googleapis.com"); + EXPECT_EQ(uri.path(), + "/robot/v1/metadata/x509/" + "777-abaslkan11hlb6nmim3bpspl31ud@developer." + "gserviceaccount.com"); grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } @@ -385,12 +382,12 @@ TEST(JwtVerifierTest, JwtVerifierGoogleEmailIssuerSuccess) { } static int httpcli_get_custom_keys_for_email( - const grpc_http_request* /*request*/, const char* host, const char* path, + const grpc_http_request* /*request*/, const grpc_core::URI& uri, grpc_core::Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { *response = http_response(200, gpr_strdup(good_jwk_set)); - EXPECT_STREQ(host, "keys.bar.com"); - EXPECT_STREQ(path, "/jwk/foo@bar.com"); + EXPECT_EQ(uri.authority(), "keys.bar.com"); + EXPECT_EQ(uri.path(), "/jwk/foo@bar.com"); grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } @@ -420,25 +417,25 @@ TEST(JwtVerifierTest, JwtVerifierCustomEmailIssuerSuccess) { } static int httpcli_get_jwk_set(const grpc_http_request* /*request*/, - const char* host, const char* path, + const grpc_core::URI& uri, grpc_core::Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { *response = http_response(200, gpr_strdup(good_jwk_set)); - EXPECT_STREQ(host, "www.googleapis.com"); - EXPECT_STREQ(path, "/oauth2/v3/certs"); + EXPECT_EQ(uri.authority(), "www.googleapis.com"); + EXPECT_EQ(uri.path(), "/oauth2/v3/certs"); grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done, absl::OkStatus()); return 1; } static int httpcli_get_openid_config(const grpc_http_request* /*request*/, - const char* host, const char* path, + const grpc_core::URI& uri, grpc_core::Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { *response = http_response(200, gpr_strdup(good_openid_config)); - EXPECT_STREQ(host, "accounts.google.com"); - EXPECT_STREQ(path, GRPC_OPENID_CONFIG_URL_SUFFIX); + EXPECT_EQ(uri.authority(), "accounts.google.com"); + EXPECT_EQ(uri.path(), GRPC_OPENID_CONFIG_URL_SUFFIX); grpc_core::HttpRequest::SetOverride(httpcli_get_jwk_set, httpcli_post_should_not_be_called, httpcli_put_should_not_be_called); @@ -479,7 +476,7 @@ static void on_verification_key_retrieval_error(void* user_data, } static int httpcli_get_bad_json(const grpc_http_request* /* request */, - const char* /*host*/, const char* /*path*/, + const grpc_core::URI& /*uri*/, grpc_core::Timestamp /*deadline*/, grpc_closure* on_done, grpc_http_response* response) { @@ -581,9 +578,9 @@ TEST(JwtVerifierTest, JwtVerifierBadSignature) { } static int httpcli_get_should_not_be_called( - const grpc_http_request* /*request*/, const char* /*host*/, - const char* /*path*/, grpc_core::Timestamp /*deadline*/, - grpc_closure* /*on_done*/, grpc_http_response* /*response*/) { + const grpc_http_request* /*request*/, const grpc_core::URI& /*uri*/, + grpc_core::Timestamp /*deadline*/, grpc_closure* /*on_done*/, + grpc_http_response* /*response*/) { EXPECT_TRUE(0); return 1; } diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc index b1636f0b5d5..305ea25eb59 100644 --- a/test/core/security/print_google_default_creds_token.cc +++ b/test/core/security/print_google_default_creds_token.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/ssl_credentials_test.cc b/test/core/security/ssl_credentials_test.cc index 2a62fe4a8d8..5d1de6b08b0 100644 --- a/test/core/security/ssl_credentials_test.cc +++ b/test/core/security/ssl_credentials_test.cc @@ -25,7 +25,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/security_connector/ssl_utils.h" diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index b2905467bc8..214a40812ec 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/notification.h" diff --git a/test/core/security/system_roots_test.cc b/test/core/security/system_roots_test.cc index 7dfaae7b92d..5bb566d89b1 100644 --- a/test/core/security/system_roots_test.cc +++ b/test/core/security/system_roots_test.cc @@ -31,7 +31,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/security/tls_security_connector_test.cc b/test/core/security/tls_security_connector_test.cc index 9bc1961b3e7..7c602c37750 100644 --- a/test/core/security/tls_security_connector_test.cc +++ b/test/core/security/tls_security_connector_test.cc @@ -28,7 +28,6 @@ #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc index 5a322f39fa8..cf5a2581c92 100644 --- a/test/core/security/verify_jwt.cc +++ b/test/core/security/verify_jwt.cc @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/slice/percent_encode_fuzzer.cc b/test/core/slice/percent_encode_fuzzer.cc index fc566f51db6..6deef7b8786 100644 --- a/test/core/slice/percent_encode_fuzzer.cc +++ b/test/core/slice/percent_encode_fuzzer.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/slice/percent_encoding.h" #include "src/core/lib/slice/slice.h" diff --git a/test/core/slice/slice_buffer_test.cc b/test/core/slice/slice_buffer_test.cc index 3070b7a4a00..08bcf0429b7 100644 --- a/test/core/slice/slice_buffer_test.cc +++ b/test/core/slice/slice_buffer_test.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include "src/core/lib/slice/slice.h" diff --git a/test/core/test_util/cmdline.cc b/test/core/test_util/cmdline.cc index b635870c384..f3bf0abbc69 100644 --- a/test/core/test_util/cmdline.cc +++ b/test/core/test_util/cmdline.cc @@ -32,7 +32,6 @@ #include "absl/strings/str_join.h" #include -#include #include "src/core/lib/gprpp/memory.h" diff --git a/test/core/test_util/fake_stats_plugin.h b/test/core/test_util/fake_stats_plugin.h index 07724c4c530..e5e93a6b503 100644 --- a/test/core/test_util/fake_stats_plugin.h +++ b/test/core/test_util/fake_stats_plugin.h @@ -355,11 +355,13 @@ class FakeStatsPlugin : public StatsPlugin { void AddCallback(RegisteredMetricCallback* callback) override { VLOG(2) << "FakeStatsPlugin[" << this << "]::AddCallback(" << callback << ")"; + MutexLock lock(&callback_mu_); callbacks_.insert(callback); } void RemoveCallback(RegisteredMetricCallback* callback) override { VLOG(2) << "FakeStatsPlugin[" << this << "]::RemoveCallback(" << callback << ")"; + MutexLock lock(&callback_mu_); callbacks_.erase(callback); } @@ -426,6 +428,7 @@ class FakeStatsPlugin : public StatsPlugin { void TriggerCallbacks() { VLOG(2) << "FakeStatsPlugin[" << this << "]::TriggerCallbacks(): START"; Reporter reporter(*this); + MutexLock lock(&callback_mu_); for (auto* callback : callbacks_) { callback->Run(reporter); } @@ -462,14 +465,14 @@ class FakeStatsPlugin : public StatsPlugin { void ReportInt64( GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, int64_t value, absl::Span label_values, - absl::Span optional_values) override { + absl::Span optional_values) override + ABSL_EXCLUSIVE_LOCKS_REQUIRED(plugin_.callback_mu_) { VLOG(2) << "FakeStatsPlugin[" << this << "]::Reporter::Report(index=" << handle.index << ", value=(int64_t)" << value << ", label_values={" << absl::StrJoin(label_values, ", ") << "}, optional_label_values={" << absl::StrJoin(optional_values, ", ") << "}"; - MutexLock lock(&plugin_.callback_mu_); auto iter = plugin_.int64_callback_gauges_.find(handle.index); if (iter == plugin_.int64_callback_gauges_.end()) return; iter->second.Set(value, label_values, optional_values); @@ -478,14 +481,14 @@ class FakeStatsPlugin : public StatsPlugin { void ReportDouble( GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, double value, absl::Span label_values, - absl::Span optional_values) override { + absl::Span optional_values) override + ABSL_EXCLUSIVE_LOCKS_REQUIRED(plugin_.callback_mu_) { VLOG(2) << "FakeStatsPlugin[" << this << "]::Reporter::Report(index=" << handle.index << ", value=(double)" << value << ", label_values={" << absl::StrJoin(label_values, ", ") << "}, optional_label_values={" << absl::StrJoin(optional_values, ", ") << "}"; - MutexLock lock(&plugin_.callback_mu_); auto iter = plugin_.double_callback_gauges_.find(handle.index); if (iter == plugin_.double_callback_gauges_.end()) return; iter->second.Set(value, label_values, optional_values); @@ -635,7 +638,7 @@ class FakeStatsPlugin : public StatsPlugin { ABSL_GUARDED_BY(&callback_mu_); absl::flat_hash_map> double_callback_gauges_ ABSL_GUARDED_BY(&callback_mu_); - std::set callbacks_; + std::set callbacks_ ABSL_GUARDED_BY(&callback_mu_); }; class FakeStatsPluginBuilder { diff --git a/test/core/test_util/histogram.cc b/test/core/test_util/histogram.cc index fae3d993347..c1b88b99268 100644 --- a/test/core/test_util/histogram.cc +++ b/test/core/test_util/histogram.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/util/useful.h" diff --git a/test/core/test_util/mock_endpoint.cc b/test/core/test_util/mock_endpoint.cc index eeae6858a83..e09fb191cb6 100644 --- a/test/core/test_util/mock_endpoint.cc +++ b/test/core/test_util/mock_endpoint.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include "src/core/lib/event_engine/tcp_socket_utils.h" diff --git a/test/core/test_util/one_corpus_entry_fuzzer.cc b/test/core/test_util/one_corpus_entry_fuzzer.cc index 0737b779d1b..ffde40a4f0f 100644 --- a/test/core/test_util/one_corpus_entry_fuzzer.cc +++ b/test/core/test_util/one_corpus_entry_fuzzer.cc @@ -21,7 +21,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/test/core/test_util/parse_hexstring.cc b/test/core/test_util/parse_hexstring.cc index e41b37ca86c..0ede85e2c09 100644 --- a/test/core/test_util/parse_hexstring.cc +++ b/test/core/test_util/parse_hexstring.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" #include -#include namespace grpc_core { Slice ParseHexstring(absl::string_view hexstring) { diff --git a/test/core/test_util/port.cc b/test/core/test_util/port.cc index ddecc426eb0..123608d61c2 100644 --- a/test/core/test_util/port.cc +++ b/test/core/test_util/port.cc @@ -27,7 +27,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/sync.h" diff --git a/test/core/test_util/port_isolated_runtime_environment.cc b/test/core/test_util/port_isolated_runtime_environment.cc index b037ab70e79..8e841cf1b4d 100644 --- a/test/core/test_util/port_isolated_runtime_environment.cc +++ b/test/core/test_util/port_isolated_runtime_environment.cc @@ -27,7 +27,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/test_util/resolve_localhost_ip46.cc b/test/core/test_util/resolve_localhost_ip46.cc index a16de23f770..ba58738b8e4 100644 --- a/test/core/test_util/resolve_localhost_ip46.cc +++ b/test/core/test_util/resolve_localhost_ip46.cc @@ -25,7 +25,6 @@ #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" -#include #include #include "src/core/lib/iomgr/resolve_address.h" diff --git a/test/core/test_util/tls_utils.cc b/test/core/test_util/tls_utils.cc index 376ce9615ec..aca44f0fbb8 100644 --- a/test/core/test_util/tls_utils.cc +++ b/test/core/test_util/tls_utils.cc @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h b/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h index 0196615e6f2..2506cb0c242 100644 --- a/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h +++ b/test/core/transport/binder/end2end/fuzzers/fuzzer_utils.h @@ -24,8 +24,6 @@ #include "absl/memory/memory.h" #include "absl/status/status.h" -#include - #include "src/core/ext/transport/binder/wire_format/binder.h" #include "src/core/ext/transport/binder/wire_format/wire_reader.h" #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/transport/chttp2/flow_control_fuzzer.cc b/test/core/transport/chttp2/flow_control_fuzzer.cc index de541fed56e..99e82f4853a 100644 --- a/test/core/transport/chttp2/flow_control_fuzzer.cc +++ b/test/core/transport/chttp2/flow_control_fuzzer.cc @@ -32,7 +32,6 @@ #include "absl/types/optional.h" #include -#include #include #include "src/core/ext/transport/chttp2/transport/flow_control.h" diff --git a/test/core/transport/chttp2/graceful_shutdown_test.cc b/test/core/transport/chttp2/graceful_shutdown_test.cc index f4e4da7268f..4f24b8d65af 100644 --- a/test/core/transport/chttp2/graceful_shutdown_test.cc +++ b/test/core/transport/chttp2/graceful_shutdown_test.cc @@ -41,7 +41,6 @@ #include #include #include -#include #include #include "src/core/channelz/channelz.h" diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index a6296636b8e..538988ebf9f 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -28,7 +28,6 @@ #include #include -#include #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" #include "src/core/lib/experiments/config.h" diff --git a/test/core/transport/chttp2/hpack_sync_fuzzer.cc b/test/core/transport/chttp2/hpack_sync_fuzzer.cc index bcc5a50c32f..2697029928d 100644 --- a/test/core/transport/chttp2/hpack_sync_fuzzer.cc +++ b/test/core/transport/chttp2/hpack_sync_fuzzer.cc @@ -27,8 +27,6 @@ #include "absl/strings/escaping.h" #include "absl/strings/match.h" -#include - #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_encoder_table.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" diff --git a/test/core/transport/chttp2/streams_not_seen_test.cc b/test/core/transport/chttp2/streams_not_seen_test.cc index 98b78b3d628..cc296008f84 100644 --- a/test/core/transport/chttp2/streams_not_seen_test.cc +++ b/test/core/transport/chttp2/streams_not_seen_test.cc @@ -47,7 +47,6 @@ #include #include #include -#include #include #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" diff --git a/test/core/transport/chttp2/too_many_pings_test.cc b/test/core/transport/chttp2/too_many_pings_test.cc index 0beb9e2d0a8..8fd0570616f 100644 --- a/test/core/transport/chttp2/too_many_pings_test.cc +++ b/test/core/transport/chttp2/too_many_pings_test.cc @@ -40,7 +40,6 @@ #include #include #include -#include #include #include diff --git a/test/core/transport/interception_chain_test.cc b/test/core/transport/interception_chain_test.cc index 02223f4ff73..c2accf5e85b 100644 --- a/test/core/transport/interception_chain_test.cc +++ b/test/core/transport/interception_chain_test.cc @@ -21,6 +21,7 @@ #include "gtest/gtest.h" #include +#include #include "src/core/lib/channel/promise_based_filter.h" #include "src/core/lib/resource_quota/resource_quota.h" diff --git a/test/core/transport/parsed_metadata_test.cc b/test/core/transport/parsed_metadata_test.cc index bc8a59fab92..df6bc391f84 100644 --- a/test/core/transport/parsed_metadata_test.cc +++ b/test/core/transport/parsed_metadata_test.cc @@ -23,8 +23,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include - #include "src/core/lib/transport/metadata_batch.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/tsi/alts/crypt/aes_gcm_test.cc b/test/core/tsi/alts/crypt/aes_gcm_test.cc index 2929d5bee5a..93ac19732c4 100644 --- a/test/core/tsi/alts/crypt/aes_gcm_test.cc +++ b/test/core/tsi/alts/crypt/aes_gcm_test.cc @@ -23,7 +23,6 @@ #include "absl/types/span.h" #include -#include #include "src/core/tsi/alts/crypt/gsec.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/tsi/alts/frame_protector/alts_counter_test.cc b/test/core/tsi/alts/frame_protector/alts_counter_test.cc index baa516d27f6..b36700c9f27 100644 --- a/test/core/tsi/alts/frame_protector/alts_counter_test.cc +++ b/test/core/tsi/alts/frame_protector/alts_counter_test.cc @@ -21,7 +21,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "test/core/tsi/alts/crypt/gsec_test_util.h" diff --git a/test/core/tsi/alts/frame_protector/alts_crypter_test.cc b/test/core/tsi/alts/frame_protector/alts_crypter_test.cc index fe930e63d70..2f834e411b7 100644 --- a/test/core/tsi/alts/frame_protector/alts_crypter_test.cc +++ b/test/core/tsi/alts/frame_protector/alts_crypter_test.cc @@ -29,7 +29,6 @@ #include "absl/types/span.h" #include -#include #include "test/core/tsi/alts/crypt/gsec_test_util.h" diff --git a/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc b/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc index 132fea59e69..e513caf0678 100644 --- a/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc +++ b/test/core/tsi/alts/frame_protector/alts_frame_protector_test.cc @@ -23,7 +23,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/tsi/alts/crypt/gsec.h" diff --git a/test/core/tsi/alts/frame_protector/frame_handler_test.cc b/test/core/tsi/alts/frame_protector/frame_handler_test.cc index b5ddb31b9b6..feb7a5310aa 100644 --- a/test/core/tsi/alts/frame_protector/frame_handler_test.cc +++ b/test/core/tsi/alts/frame_protector/frame_handler_test.cc @@ -27,7 +27,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/util/useful.h" diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc index dd4a9ea42e6..51c08b6cce8 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc +++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_test.cc @@ -25,7 +25,6 @@ #include "absl/types/span.h" #include -#include #include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h" diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc index 833223e5f1c..248a496bd27 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc +++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol_test.cc @@ -25,7 +25,6 @@ #include "absl/types/span.h" #include -#include #include "test/core/tsi/alts/crypt/gsec_test_util.h" diff --git a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc index 108b4e9ec7e..aaab8c892cf 100644 --- a/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc +++ b/test/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector_test.cc @@ -24,7 +24,6 @@ #include #include -#include #include "src/core/tsi/alts/crypt/gsec.h" #include "src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h" diff --git a/test/core/tsi/crl_ssl_transport_security_test.cc b/test/core/tsi/crl_ssl_transport_security_test.cc index e314218e2d2..37f0f905b16 100644 --- a/test/core/tsi/crl_ssl_transport_security_test.cc +++ b/test/core/tsi/crl_ssl_transport_security_test.cc @@ -29,7 +29,6 @@ #include #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/core/tsi/fake_transport_security_test.cc b/test/core/tsi/fake_transport_security_test.cc index 711a8f2cdbe..69c280717a4 100644 --- a/test/core/tsi/fake_transport_security_test.cc +++ b/test/core/tsi/fake_transport_security_test.cc @@ -26,7 +26,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/security_connector/security_connector.h" diff --git a/test/core/tsi/ssl_session_cache_test.cc b/test/core/tsi/ssl_session_cache_test.cc index 91af924adb9..f9711f2eba1 100644 --- a/test/core/tsi/ssl_session_cache_test.cc +++ b/test/core/tsi/ssl_session_cache_test.cc @@ -26,7 +26,6 @@ #include "absl/log/check.h" #include -#include #include "src/core/lib/gprpp/crash.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/tsi/transport_security_test_lib.cc b/test/core/tsi/transport_security_test_lib.cc index bf0d7415d9a..1c744415db2 100644 --- a/test/core/tsi/transport_security_test_lib.cc +++ b/test/core/tsi/transport_security_test_lib.cc @@ -36,7 +36,6 @@ #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/memory.h" diff --git a/test/core/xds/certificate_provider_store_test.cc b/test/core/xds/certificate_provider_store_test.cc index adcd41f3833..3cbd6146059 100644 --- a/test/core/xds/certificate_provider_store_test.cc +++ b/test/core/xds/certificate_provider_store_test.cc @@ -27,7 +27,6 @@ #include "gtest/gtest.h" #include -#include #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/unique_type_name.h" diff --git a/test/core/xds/xds_client_fuzzer.cc b/test/core/xds/xds_client_fuzzer.cc index ddeaf96f86d..4649329523e 100644 --- a/test/core/xds/xds_client_fuzzer.cc +++ b/test/core/xds/xds_client_fuzzer.cc @@ -336,7 +336,7 @@ class Fuzzer { bool squelch = true; -DEFINE_PROTO_FUZZER(const xds_client_fuzzer::Message& message) { +DEFINE_PROTO_FUZZER(const xds_client_fuzzer::Msg& message) { grpc_init(); grpc_core::Fuzzer fuzzer(message.bootstrap()); for (int i = 0; i < message.actions_size(); i++) { diff --git a/test/core/xds/xds_client_fuzzer.proto b/test/core/xds/xds_client_fuzzer.proto index 6d1274eb9cc..e2ce7aa5d46 100644 --- a/test/core/xds/xds_client_fuzzer.proto +++ b/test/core/xds/xds_client_fuzzer.proto @@ -16,10 +16,10 @@ syntax = "proto3"; -import "src/proto/grpc/testing/xds/v3/discovery.proto"; - package xds_client_fuzzer; +import "src/proto/grpc/testing/xds/v3/discovery.proto"; + // We'd ideally like to use google.rpc.Status instead of creating our // own proto for this, but that winds up causing all sorts of dependency // headaches. @@ -117,7 +117,7 @@ message Action { } } -message Message { +message Msg { string bootstrap = 1; repeated Action actions = 2; } diff --git a/test/core/xds/xds_client_test.cc b/test/core/xds/xds_client_test.cc index be135ae5dab..a970e217360 100644 --- a/test/core/xds/xds_client_test.cc +++ b/test/core/xds/xds_client_test.cc @@ -44,7 +44,6 @@ #include #include -#include #include #include "src/core/lib/event_engine/default_event_engine.h" diff --git a/test/core/xds/xds_cluster_resource_type_test.cc b/test/core/xds/xds_cluster_resource_type_test.cc index 7cf4c192681..57d2eb7c51b 100644 --- a/test/core/xds/xds_cluster_resource_type_test.cc +++ b/test/core/xds/xds_cluster_resource_type_test.cc @@ -1643,54 +1643,32 @@ TEST_F(HostOverrideStatusTest, CanExplicitlySetToEmpty) { EXPECT_EQ(resource.override_host_statuses.ToString(), "{}"); } -using TelemetryLabelTest = XdsClusterTest; +using MetadataTest = XdsClusterTest; -TEST_F(TelemetryLabelTest, ValidServiceLabelsConfig) { - Cluster cluster; - cluster.set_type(cluster.EDS); - cluster.mutable_eds_cluster_config()->mutable_eds_config()->mutable_self(); - auto& filter_map = *cluster.mutable_metadata()->mutable_filter_metadata(); - auto& label_map = - *filter_map["com.google.csm.telemetry_labels"].mutable_fields(); - *label_map["service_name"].mutable_string_value() = "abc"; - *label_map["service_namespace"].mutable_string_value() = "xyz"; - std::string serialized_resource; - ASSERT_TRUE(cluster.SerializeToString(&serialized_resource)); - auto* resource_type = XdsClusterResourceType::Get(); - auto decode_result = - resource_type->Decode(decode_context_, serialized_resource); - ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status(); - auto& resource = - static_cast(**decode_result.resource); - EXPECT_EQ(resource.service_telemetry_label.as_string_view(), "abc"); - EXPECT_EQ(resource.namespace_telemetry_label.as_string_view(), "xyz"); -} - -TEST_F(TelemetryLabelTest, MissingMetadataField) { - Cluster cluster; - cluster.set_type(cluster.EDS); - cluster.mutable_eds_cluster_config()->mutable_eds_config()->mutable_self(); - std::string serialized_resource; - ASSERT_TRUE(cluster.SerializeToString(&serialized_resource)); - auto* resource_type = XdsClusterResourceType::Get(); - auto decode_result = - resource_type->Decode(decode_context_, serialized_resource); - ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status(); - auto& resource = - static_cast(**decode_result.resource); - EXPECT_THAT(resource.service_telemetry_label.as_string_view(), - ::testing::IsEmpty()); - EXPECT_THAT(resource.namespace_telemetry_label.as_string_view(), - ::testing::IsEmpty()); +MATCHER_P(JsonEq, json_str, "") { + std::string actual = JsonDump(arg); + bool ok = ::testing::ExplainMatchResult(json_str, actual, result_listener); + if (!ok) *result_listener << "Actual: " << actual; + return ok; } -TEST_F(TelemetryLabelTest, MissingCsmFilterMetadataField) { +TEST_F(MetadataTest, MetadataSet) { Cluster cluster; cluster.set_type(cluster.EDS); cluster.mutable_eds_cluster_config()->mutable_eds_config()->mutable_self(); auto& filter_map = *cluster.mutable_metadata()->mutable_filter_metadata(); - auto& label_map = *filter_map["some_key"].mutable_fields(); - *label_map["some_value"].mutable_string_value() = "abc"; + auto& label_map = *filter_map["filter_key"].mutable_fields(); + *label_map["string_value"].mutable_string_value() = "abc"; + label_map["bool_value"].set_bool_value(true); + label_map["number_value"].set_number_value(3.14); + label_map["null_value"].set_null_value(::google::protobuf::NULL_VALUE); + auto& list_value_values = + *label_map["list_value"].mutable_list_value()->mutable_values(); + *list_value_values.Add()->mutable_string_value() = "efg"; + list_value_values.Add()->set_number_value(3.14); + auto& struct_value_fields = + *label_map["struct_value"].mutable_struct_value()->mutable_fields(); + struct_value_fields["bool_value"].set_bool_value(false); std::string serialized_resource; ASSERT_TRUE(cluster.SerializeToString(&serialized_resource)); auto* resource_type = XdsClusterResourceType::Get(); @@ -1699,31 +1677,22 @@ TEST_F(TelemetryLabelTest, MissingCsmFilterMetadataField) { ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status(); auto& resource = static_cast(**decode_result.resource); - EXPECT_THAT(resource.service_telemetry_label.as_string_view(), - ::testing::IsEmpty()); - EXPECT_THAT(resource.namespace_telemetry_label.as_string_view(), - ::testing::IsEmpty()); -} - -TEST_F(TelemetryLabelTest, IgnoreNonServiceLabelEntries) { + EXPECT_THAT(resource.metadata, + ::testing::ElementsAre(::testing::Pair( + "filter_key", JsonEq("{" + "\"bool_value\":true," + "\"list_value\":[\"efg\",3.14]," + "\"null_value\":null," + "\"number_value\":3.14," + "\"string_value\":\"abc\"," + "\"struct_value\":{\"bool_value\":false}" + "}")))); +} + +TEST_F(MetadataTest, MetadataUnset) { Cluster cluster; cluster.set_type(cluster.EDS); cluster.mutable_eds_cluster_config()->mutable_eds_config()->mutable_self(); - auto& filter_map = *cluster.mutable_metadata()->mutable_filter_metadata(); - auto& label_map = - *filter_map["com.google.csm.telemetry_labels"].mutable_fields(); - label_map["bool_value"].set_bool_value(true); - label_map["number_value"].set_number_value(3.14); - *label_map["string_value"].mutable_string_value() = "abc"; - *label_map["service_name"].mutable_string_value() = "service"; - label_map["null_value"].set_null_value(::google::protobuf::NULL_VALUE); - auto& list_value_values = - *label_map["list_value"].mutable_list_value()->mutable_values(); - *list_value_values.Add()->mutable_string_value() = "efg"; - list_value_values.Add()->set_number_value(3.14); - auto& struct_value_fields = - *label_map["struct_value"].mutable_struct_value()->mutable_fields(); - struct_value_fields["bool_value"].set_bool_value(false); std::string serialized_resource; ASSERT_TRUE(cluster.SerializeToString(&serialized_resource)); auto* resource_type = XdsClusterResourceType::Get(); @@ -1732,9 +1701,7 @@ TEST_F(TelemetryLabelTest, IgnoreNonServiceLabelEntries) { ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status(); auto& resource = static_cast(**decode_result.resource); - EXPECT_THAT(resource.service_telemetry_label.as_string_view(), "service"); - EXPECT_THAT(resource.namespace_telemetry_label.as_string_view(), - ::testing::IsEmpty()); + EXPECT_THAT(resource.metadata, ::testing::ElementsAre()); } } // namespace diff --git a/test/core/xds/xds_endpoint_resource_type_test.cc b/test/core/xds/xds_endpoint_resource_type_test.cc index 17ec29f4122..82fc99cd94b 100644 --- a/test/core/xds/xds_endpoint_resource_type_test.cc +++ b/test/core/xds/xds_endpoint_resource_type_test.cc @@ -487,8 +487,6 @@ TEST_F(XdsEndpointTest, MissingAddress) { } TEST_F(XdsEndpointTest, MultipleAddressesPerEndpoint) { - testing::ScopedExperimentalEnvVar env( - "GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); ClusterLoadAssignment cla; cla.set_cluster_name("foo"); auto* locality = cla.add_endpoints(); @@ -543,8 +541,6 @@ TEST_F(XdsEndpointTest, MultipleAddressesPerEndpoint) { } TEST_F(XdsEndpointTest, AdditionalAddressesMissingAddress) { - testing::ScopedExperimentalEnvVar env( - "GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); ClusterLoadAssignment cla; cla.set_cluster_name("foo"); auto* locality = cla.add_endpoints(); @@ -575,8 +571,6 @@ TEST_F(XdsEndpointTest, AdditionalAddressesMissingAddress) { } TEST_F(XdsEndpointTest, AdditionalAddressesMissingSocketAddress) { - testing::ScopedExperimentalEnvVar env( - "GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); ClusterLoadAssignment cla; cla.set_cluster_name("foo"); auto* locality = cla.add_endpoints(); @@ -608,8 +602,6 @@ TEST_F(XdsEndpointTest, AdditionalAddressesMissingSocketAddress) { } TEST_F(XdsEndpointTest, AdditionalAddressesInvalidPort) { - testing::ScopedExperimentalEnvVar env( - "GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); ClusterLoadAssignment cla; cla.set_cluster_name("foo"); auto* locality = cla.add_endpoints(); @@ -645,8 +637,6 @@ TEST_F(XdsEndpointTest, AdditionalAddressesInvalidPort) { } TEST_F(XdsEndpointTest, AdditionalAddressesInvalidAddress) { - testing::ScopedExperimentalEnvVar env( - "GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); ClusterLoadAssignment cla; cla.set_cluster_name("foo"); auto* locality = cla.add_endpoints(); @@ -681,7 +671,9 @@ TEST_F(XdsEndpointTest, AdditionalAddressesInvalidAddress) { << decode_result.resource.status(); } -TEST_F(XdsEndpointTest, IgnoresMultipleAddressesPerEndpointWhenNotEnabled) { +TEST_F(XdsEndpointTest, IgnoresMultipleAddressesPerEndpointWhenDisabled) { + testing::ScopedEnvVar env("GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS", + "false"); ClusterLoadAssignment cla; cla.set_cluster_name("foo"); auto* locality = cla.add_endpoints(); diff --git a/test/core/xds/xds_http_filters_test.cc b/test/core/xds/xds_http_filters_test.cc index eb2339e4e33..d57d5f5650c 100644 --- a/test/core/xds/xds_http_filters_test.cc +++ b/test/core/xds/xds_http_filters_test.cc @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "src/core/ext/filters/fault_injection/fault_injection_filter.h" diff --git a/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc b/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc index a41aa0011a0..9331d2042c6 100644 --- a/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc +++ b/test/cpp/client/destroy_grpclb_channel_with_active_connect_stress_test.cc @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc index 21a118e9e72..fbd98164931 100644 --- a/test/cpp/end2end/client_crash_test.cc +++ b/test/cpp/end2end/client_crash_test.cc @@ -22,7 +22,6 @@ #include "absl/memory/memory.h" #include -#include #include #include #include diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 324720902de..e4b3de512ae 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index ef1cfc1382d..a640d8b499a 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/test/cpp/end2end/health_service_end2end_test.cc b/test/cpp/end2end/health_service_end2end_test.cc index 002fa26218b..48209bb5e49 100644 --- a/test/cpp/end2end/health_service_end2end_test.cc +++ b/test/cpp/end2end/health_service_end2end_test.cc @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/end2end/raw_end2end_test.cc b/test/cpp/end2end/raw_end2end_test.cc index 8c304bc4a08..c41bb7a60df 100644 --- a/test/cpp/end2end/raw_end2end_test.cc +++ b/test/cpp/end2end/raw_end2end_test.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/end2end/server_early_return_test.cc b/test/cpp/end2end/server_early_return_test.cc index 010b9d480af..2489b09341c 100644 --- a/test/cpp/end2end/server_early_return_test.cc +++ b/test/cpp/end2end/server_early_return_test.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/end2end/time_change_test.cc b/test/cpp/end2end/time_change_test.cc index af74f8bdd50..fa7dff06028 100644 --- a/test/cpp/end2end/time_change_test.cc +++ b/test/cpp/end2end/time_change_test.cc @@ -26,7 +26,6 @@ #include "absl/memory/memory.h" #include -#include #include #include #include diff --git a/test/cpp/end2end/xds/xds_override_host_end2end_test.cc b/test/cpp/end2end/xds/xds_override_host_end2end_test.cc index b02ab1ae2ef..88f57285c21 100644 --- a/test/cpp/end2end/xds/xds_override_host_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_override_host_end2end_test.cc @@ -703,8 +703,6 @@ TEST_P(OverrideHostTest, TTLSetsMaxAge) { } TEST_P(OverrideHostTest, MultipleAddressesPerEndpoint) { - grpc_core::testing::ScopedExperimentalEnvVar env( - "GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS"); // Create 3 backends, but leave backend 0 unstarted. CreateBackends(3); StartBackend(1); diff --git a/test/cpp/end2end/xds/xds_server.h b/test/cpp/end2end/xds/xds_server.h index 20372a2a3be..4cd3982c955 100644 --- a/test/cpp/end2end/xds/xds_server.h +++ b/test/cpp/end2end/xds/xds_server.h @@ -27,7 +27,6 @@ #include "absl/log/log.h" #include "absl/types/optional.h" -#include #include #include "src/core/lib/address_utils/parse_address.h" diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index f15466edcc4..c42208fd46c 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -21,7 +21,6 @@ #include "absl/flags/flag.h" -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/cpp/microbenchmarks/bm_basic_work_queue.cc b/test/cpp/microbenchmarks/bm_basic_work_queue.cc index d76f0767861..320c8fc5093 100644 --- a/test/cpp/microbenchmarks/bm_basic_work_queue.cc +++ b/test/cpp/microbenchmarks/bm_basic_work_queue.cc @@ -18,7 +18,6 @@ #include "absl/log/check.h" #include -#include #include #include "src/core/lib/event_engine/common_closures.h" diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 0cd5de5c2c4..6b769f7da7f 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -24,7 +24,6 @@ #include "absl/log/check.h" #include -#include #include #include diff --git a/test/cpp/microbenchmarks/fullstack_context_mutators.h b/test/cpp/microbenchmarks/fullstack_context_mutators.h index 466f60b8307..29b668ddf30 100644 --- a/test/cpp/microbenchmarks/fullstack_context_mutators.h +++ b/test/cpp/microbenchmarks/fullstack_context_mutators.h @@ -19,7 +19,6 @@ #ifndef GRPC_TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H #define GRPC_TEST_CPP_MICROBENCHMARKS_FULLSTACK_CONTEXT_MUTATORS_H -#include #include #include #include diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index 8ded4de82cc..dcfd227e53a 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/naming/cancel_ares_query_test.cc b/test/cpp/naming/cancel_ares_query_test.cc index cf8d813f623..775dc1961ce 100644 --- a/test/cpp/naming/cancel_ares_query_test.cc +++ b/test/cpp/naming/cancel_ares_query_test.cc @@ -32,7 +32,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index 906f128d746..39cfbe6b18f 100644 --- a/test/cpp/qps/benchmark_config.cc +++ b/test/cpp/qps/benchmark_config.cc @@ -21,7 +21,6 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" -#include #include #include diff --git a/test/cpp/util/channel_trace_proto_helper.cc b/test/cpp/util/channel_trace_proto_helper.cc index 677862fbf12..8acb762a889 100644 --- a/test/cpp/util/channel_trace_proto_helper.cc +++ b/test/cpp/util/channel_trace_proto_helper.cc @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc index df765c64a49..3cae389d898 100644 --- a/test/cpp/util/cli_call.cc +++ b/test/cpp/util/cli_call.cc @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/test/cpp/util/cli_credentials.cc b/test/cpp/util/cli_credentials.cc index 8b178524df8..d0c355a09cc 100644 --- a/test/cpp/util/cli_credentials.cc +++ b/test/cpp/util/cli_credentials.cc @@ -22,7 +22,6 @@ #include "absl/log/log.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index f5c3a9a037e..a355c15ce20 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -21,7 +21,6 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" -#include #include #include diff --git a/test/cpp/util/metrics_server.cc b/test/cpp/util/metrics_server.cc index 59d3dcead15..57a3abf3ea7 100644 --- a/test/cpp/util/metrics_server.cc +++ b/test/cpp/util/metrics_server.cc @@ -20,7 +20,6 @@ #include "absl/log/log.h" -#include #include #include diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index c94f0a054bd..0198a3f14ff 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -29,7 +29,6 @@ #include "absl/log/check.h" #include "absl/log/log.h" -#include #include #include diff --git a/test/cpp/util/windows/manifest_file.cc b/test/cpp/util/windows/manifest_file.cc index 0bf2c9d3f01..a1f377032fd 100644 --- a/test/cpp/util/windows/manifest_file.cc +++ b/test/cpp/util/windows/manifest_file.cc @@ -29,8 +29,6 @@ #include "absl/strings/str_replace.h" #include "absl/strings/str_split.h" -#include - #include "src/core/lib/gprpp/crash.h" namespace grpc { diff --git a/tools/bazelify_tests/build_defs.bzl b/tools/bazelify_tests/build_defs.bzl index c8b936e06c5..dfa6e9ac277 100644 --- a/tools/bazelify_tests/build_defs.bzl +++ b/tools/bazelify_tests/build_defs.bzl @@ -114,7 +114,7 @@ def grpc_run_tests_harness_test(name, args = [], data = [], size = "medium", tim timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. flaky: Whether this test is flaky. docker_image_version: The docker .current_version file to use for docker containerization. use_login_shell: If True, the run_tests.py command will run under a login shell. @@ -163,7 +163,7 @@ def grpc_run_bazel_distribtest_test(name, args = [], data = [], size = "medium", timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. flaky: Whether this test is flaky. docker_image_version: The docker .current_version file to use for docker containerization. """ @@ -193,7 +193,7 @@ def grpc_run_cpp_distribtest_test(name, args = [], data = [], size = "medium", t timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. flaky: Whether this test is flaky. docker_image_version: The docker .current_version file to use for docker containerization. """ @@ -225,7 +225,7 @@ def grpc_run_simple_command_test(name, args = [], data = [], size = "medium", ti timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. flaky: Whether this test is flaky. docker_image_version: The docker .current_version file to use for docker containerization. """ @@ -260,10 +260,10 @@ def grpc_build_artifact_task(name, timeout = None, artifact_deps = [], tags = [] artifact_deps: List of dependencies on artifacts built by another grpc_build_artifact_task. tags: The tags for the target. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. flaky: Whether this artifact build is flaky. docker_image_version: The docker .current_version file to use for docker containerization. - build_script: The script that builds the aritfacts. + build_script: The script that builds the artifacts. """ out_exitcode_file = str(name + "_exit_code") @@ -284,7 +284,7 @@ def grpc_build_artifact_task(name, timeout = None, artifact_deps = [], tags = [] cmd = "$(location //tools/bazelify_tests:grpc_build_artifact_task.sh) $(location //tools/bazelify_tests:grpc_repo_archive_with_submodules.tar.gz) $(location " + build_script + ") $(location " + out_exitcode_file + ") $(location " + out_build_log + ") $(location " + out_archive_name + ")" - # for each artifact task we depends on, use the correponding tar.gz as extra src and pass its location as an extra cmdline arg. + # for each artifact task we depends on, use the corresponding tar.gz as extra src and pass its location as an extra cmdline arg. for dep in artifact_deps: dep_archive_name = str(dep + ".tar.gz") cmd = cmd + " $(location " + dep_archive_name + ")" @@ -324,7 +324,7 @@ def grpc_run_distribtest_test(name, artifact_deps = [], size = "medium", timeout timeout: The test timeout. tags: The tags for the test. exec_compatible_with: A list of constraint values that must be - satisifed for the platform. + satisfied for the platform. flaky: Whether this test is flaky. docker_image_version: The docker .current_version file to use for docker containerization. build_script: The script that runs the test. @@ -341,7 +341,7 @@ def grpc_run_distribtest_test(name, artifact_deps = [], size = "medium", timeout "$(location " + build_script + ")", ] - # for each artifact task we depends on, use the correponding tar.gz as extra data item and pass its location as an extra arg. + # for each artifact task we depends on, use the corresponding tar.gz as extra data item and pass its location as an extra arg. for dep in artifact_deps: dep_archive_name = str(dep + ".tar.gz") args.append("$(location " + dep_archive_name + ")") diff --git a/tools/bazelify_tests/dockerimage_current_versions.bzl b/tools/bazelify_tests/dockerimage_current_versions.bzl index 06a13752f0c..a07bbf3b702 100644 --- a/tools/bazelify_tests/dockerimage_current_versions.bzl +++ b/tools/bazelify_tests/dockerimage_current_versions.bzl @@ -36,12 +36,12 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/distribtest/csharp_dotnet5_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/csharp_dotnet5_x64@sha256:004e02902825b54c7f0d60eaed0819acf6f10c24853bf8f793001114e9969abd", "tools/dockerfile/distribtest/csharp_ubuntu2204_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/csharp_ubuntu2204_x64@sha256:a439f2ccbc666f231e511a8e58eb7f66a3de4820a4d5aded1e62275cf8ac49f0", "tools/dockerfile/distribtest/php7_debian10_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/php7_debian10_x64@sha256:7791ae6f933d3697e3ff25b238edab52c167e088e35e7435663fa0ba1383587d", - "tools/dockerfile/distribtest/python_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64@sha256:f072c39a2e47d091a937cdcdf6e5517331b27febce8e864399ce16b35d6cc69d", + "tools/dockerfile/distribtest/python_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64@sha256:d7232ef55c81d125b66899b908668156638cd2cfc5b119083eceacb6018da7e4", "tools/dockerfile/distribtest/python_arch_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_arch_x64@sha256:2c1adadeb010e107132cf5137f32a2d18727796631245b110cc74f69c07502e1", "tools/dockerfile/distribtest/python_bullseye_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_bullseye_x64@sha256:80553398f0c59c1dc186052f4f2deaf18fea582f6d1d166eec6ea298639031fb", "tools/dockerfile/distribtest/python_bullseye_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_bullseye_x86@sha256:81300aed2bb5e6b3f9bf9f23ba751e884e0317a9cd79659d37cdef4f1cfd24ca", "tools/dockerfile/distribtest/python_centos7_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_centos7_x64@sha256:13d8f3ae273ac7dab9b5d486ca08045f6ded866c405ed7bb9d2c87574c1b911b", - "tools/dockerfile/distribtest/python_dev_alpine3.7_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_alpine3.7_x64@sha256:9c1ee0b285cb6cd3b4734e3fc0eaa5fa1ee6230f55d87cc21e7364abb1b8c58c", + "tools/dockerfile/distribtest/python_dev_alpine3.7_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_alpine3.7_x64@sha256:c2e80c14210502795712f611c541870bbe80b307ff6cc732a82d3e0c6c1237cb", "tools/dockerfile/distribtest/python_dev_arch_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_arch_x64@sha256:29f179ef2083ee6addd57e90f58781fdc1cb5dc3dd3e228da1af38785b921f35", "tools/dockerfile/distribtest/python_dev_bullseye_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_bullseye_x64@sha256:6c15bd5c350dbc206f45fb512418db51db9a3b73cc304d1d28f4df38bad5a702", "tools/dockerfile/distribtest/python_dev_bullseye_x86.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_bullseye_x86@sha256:0cbb08f31a9d45ccdc41a88e409b215cac69cc1a9b05f456ebd96b398fd8e9ee", @@ -88,9 +88,9 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/interoptest/grpc_interop_ruby.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_interop_ruby@sha256:ce9539e9068b2597d5d43dc2bb7df17b84fd8192759cf7a02132b676ca6fa4ed", "tools/dockerfile/interoptest/lb_interop_fake_servers.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/lb_interop_fake_servers@sha256:b89a51dd9147e1293f50ee64dd719fce5929ca7894d3770a3d80dbdecb99fd52", "tools/dockerfile/test/android_ndk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/android_ndk@sha256:e4fd2e0048c4ffd2a04e4a41154ee469ed61e058cb704ee95071f7a3bdad507a", - "tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:40a08d78ca161e30ab862ba48037fcaf53e812490a6e427da3832382595da746", - "tools/dockerfile/test/bazel_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64@sha256:112e4f5085b43df2c02852f23c665aa5310e5a44ea3f4ae553a21b882a9b56aa", - "tools/dockerfile/test/binder_transport_apk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk@sha256:c800e2d5feb3f6e9a4b837f4c1eb321892766b1e836b3f9d2e5eab8697734ff6", + "tools/dockerfile/test/bazel.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel@sha256:be25af8c0e5faf39a585e7ddd657c4fd66513e4eba0ee0c687109b19ed462518", + "tools/dockerfile/test/bazel_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64@sha256:ce026fedc059c74bade52f4b87c54907a3cf9abb22f6a584dba584e1925bbc42", + "tools/dockerfile/test/binder_transport_apk.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk@sha256:5dddb0d70ee427c7ee20d2b4f9261579218dd6b208b74c2913e0e3c79b3166f7", "tools/dockerfile/test/csharp_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/csharp_debian11_arm64@sha256:4d4bc5f15e03f3d3d8fd889670ecde2c66a2e4d2dd9db80733c05c1d90c8a248", "tools/dockerfile/test/csharp_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/csharp_debian11_x64@sha256:0763d919b17b4cfe5b65aff3bf911c04e9e4d46d11649858742033facd9f534f", "tools/dockerfile/test/cxx_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/cxx_alpine_x64@sha256:5beda19bcf186b6c9606f4265e38c99bb4308f25bc0987e0fc15164f3c205232", @@ -113,5 +113,5 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:b3eb1a17b7b091e3c5648a803076b2c40601242ff91c04d55997af6641305f68", "tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:d2e79919b2e2d4cc36a29682ecb5170641df4fb506cfb453978ffdeb8a841bd9", "tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:6e8b4696ba0661f11a31ed0992a94d2efcd889a018f57160f0e2fb62963f3593", - "tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:f138b3aae124e2d6e1a08c5078fb944db7470deeba17ef083aacf3faf939059e", + "tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:966aa97475368b6fc308a7e9e584ab471e8c6a47b4a6c9e709c0b1b7d4e2d800", } diff --git a/tools/bazelify_tests/grpc_repo_archive.sh b/tools/bazelify_tests/grpc_repo_archive.sh index 2f716ebe80d..76f7c5d505e 100755 --- a/tools/bazelify_tests/grpc_repo_archive.sh +++ b/tools/bazelify_tests/grpc_repo_archive.sh @@ -50,7 +50,7 @@ then exit 1 fi -GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS=$(grep ^STABLE_GRPC_UNCOMMITED_PATCH_CHECKSUM bazel-out/stable-status.txt | cut -d' ' -f2) +GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS=$(grep ^STABLE_GRPC_UNCOMMITTED_PATCH_CHECKSUM bazel-out/stable-status.txt | cut -d' ' -f2) GRPC_GIT_WORKSPACE_DIRTY_FROM_STABLE_STATUS=$(grep ^STABLE_GRPC_GIT_WORKSPACE_DIRTY bazel-out/stable-status.txt | cut -d' ' -f2) pushd ${ORIGINAL_BAZEL_WORKSPACE_ROOT} >/dev/null @@ -65,11 +65,11 @@ fi mkdir -p ${ARCHIVES_DIR}/grpc git archive --format="${ARCHIVE_FORMAT}" HEAD >"${ARCHIVES_DIR}/grpc/$(git rev-parse HEAD).${ARCHIVE_FORMAT}" -if [ "${GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS}" != "" ] +if [ "${GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS}" != "" ] then - git diff HEAD >"${ARCHIVES_DIR}/grpc/grpc_uncommited_${GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS}.patch" + git diff HEAD >"${ARCHIVES_DIR}/grpc/grpc_uncommited_${GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS}.patch" # check that the actual checksum of the patch file is what we expect it to be - echo "${GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS} ${ARCHIVES_DIR}/grpc/grpc_uncommited_${GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS}.patch" | sha256sum --quiet --check + echo "${GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS} ${ARCHIVES_DIR}/grpc/grpc_uncommited_${GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS}.patch" | sha256sum --quiet --check fi # produce archive for each submodule @@ -82,10 +82,10 @@ mkdir grpc tar -xopf "${ARCHIVES_DIR}/grpc/${GRPC_GIT_COMMIT_FROM_STABLE_STATUS}.${ARCHIVE_FORMAT}" -C grpc # apply the patch -if [ "${GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS}" != "" ] +if [ "${GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS}" != "" ] then pushd grpc >/dev/null - patch --quiet -p1 <"${ARCHIVES_DIR}/grpc/grpc_uncommited_${GRPC_UNCOMMITED_PATCH_CHECKSUM_FROM_STABLE_STATUS}.patch" + patch --quiet -p1 <"${ARCHIVES_DIR}/grpc/grpc_uncommited_${GRPC_UNCOMMITTED_PATCH_CHECKSUM_FROM_STABLE_STATUS}.patch" popd >/dev/null fi diff --git a/tools/bazelify_tests/test/BUILD b/tools/bazelify_tests/test/BUILD index 7deb5fcd640..bd12e79d83f 100644 --- a/tools/bazelify_tests/test/BUILD +++ b/tools/bazelify_tests/test/BUILD @@ -72,7 +72,7 @@ grpc_run_tests_harness_test( ], docker_image_version = "tools/dockerfile/test/ruby_debian11_x64.current_version", prepare_script = ":prepare_ruby.sh", - use_login_shell = True, # ruby's docker image uses RVM which wierdly requires login shell + use_login_shell = True, # ruby's docker image uses RVM which weirdly requires login shell ) grpc_run_tests_harness_test( @@ -83,7 +83,7 @@ grpc_run_tests_harness_test( ], docker_image_version = "tools/dockerfile/test/ruby_debian11_x64.current_version", prepare_script = ":prepare_ruby.sh", - use_login_shell = True, # ruby's docker image uses RVM which wierdly requires login shell + use_login_shell = True, # ruby's docker image uses RVM which weirdly requires login shell ) # PHP diff --git a/tools/bazelify_tests/test/supported_bazel_versions.bzl b/tools/bazelify_tests/test/supported_bazel_versions.bzl index 77d1cde5887..3074247802e 100644 --- a/tools/bazelify_tests/test/supported_bazel_versions.bzl +++ b/tools/bazelify_tests/test/supported_bazel_versions.bzl @@ -17,6 +17,6 @@ This file is generated from the supported_bazel_versions.bzl.template """ SUPPORTED_BAZEL_VERSIONS = [ - "7.1.0", + "7.3.1", "6.5.0", ] diff --git a/tools/bazelify_tests/workspace_status_cmd.sh b/tools/bazelify_tests/workspace_status_cmd.sh index 83bafd2140a..4c21c18fa8c 100755 --- a/tools/bazelify_tests/workspace_status_cmd.sh +++ b/tools/bazelify_tests/workspace_status_cmd.sh @@ -28,7 +28,7 @@ then echo "STABLE_GRPC_GIT_WORKSPACE_DIRTY false" else echo "STABLE_GRPC_GIT_WORKSPACE_DIRTY true" - echo "STABLE_GRPC_UNCOMMITED_PATCH_CHECKSUM $(git diff HEAD | sha256sum | cut -f1 -d' ')" + echo "STABLE_GRPC_UNCOMMITTED_PATCH_CHECKSUM $(git diff HEAD | sha256sum | cut -f1 -d' ')" fi # Since only --workspace_status_command is allowed by bazel, also include diff --git a/tools/buildgen/plugins/transitive_dependencies.py b/tools/buildgen/plugins/transitive_dependencies.py index 4a28921cbfa..7350682798e 100644 --- a/tools/buildgen/plugins/transitive_dependencies.py +++ b/tools/buildgen/plugins/transitive_dependencies.py @@ -37,9 +37,9 @@ def transitive_deps(lib_map, node): if next_node: recursive_helper(next_node) else: - # For some deps, the corrensponding library entry doesn't exist, + # For some deps, the corresponding library entry doesn't exist, # but we still want to preserve the dependency so that the build - # system can provide custom handling for that depdendency. + # system can provide custom handling for that dependency. result.append(dep) if node is not start: result.insert(0, node["name"]) diff --git a/tools/codegen/core/gen_config_vars.py b/tools/codegen/core/gen_config_vars.py index 1aa217a3ee3..036a59518bc 100755 --- a/tools/codegen/core/gen_config_vars.py +++ b/tools/codegen/core/gen_config_vars.py @@ -39,7 +39,9 @@ for attr in attrs: print("config has no name: %r" % attr) error = True continue - if "experiment" in attr["name"] and attr["name"] != "experiments": + if ( + "experiment" in attr["name"] and "experimental" not in attr["name"] + ) and attr["name"] != "experiments": print("use experiment system for experiments") error = True if "description" not in attr: diff --git a/tools/codegen/core/gen_huffman_decompressor.cc b/tools/codegen/core/gen_huffman_decompressor.cc index 19e483c1027..9ffc1744aa0 100644 --- a/tools/codegen/core/gen_huffman_decompressor.cc +++ b/tools/codegen/core/gen_huffman_decompressor.cc @@ -148,7 +148,7 @@ SymSet AllSyms() { return syms; } -// What whould we do after reading a set of bits? +// What would we do after reading a set of bits? struct ReadActions { // Emit these symbols std::vector emit; diff --git a/tools/codegen/core/gen_join.py b/tools/codegen/core/gen_join.py index d0bd3434a07..cd90390ae3c 100755 --- a/tools/codegen/core/gen_join.py +++ b/tools/codegen/core/gen_join.py @@ -79,7 +79,7 @@ struct JoinState { return Traits::template EarlyReturn(std::move(*p)); } } - } else if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { + } else { GRPC_TRACE_VLOG(promise_primitives, 2) << "join[" << this << "]: joint ${i+1}/${n} already ready"; } % endfor diff --git a/tools/codegen/core/gen_seq.py b/tools/codegen/core/gen_seq.py index f537fd63f9c..a33072270f3 100755 --- a/tools/codegen/core/gen_seq.py +++ b/tools/codegen/core/gen_seq.py @@ -133,21 +133,17 @@ tail${i}: switch (state) { % for i in range(0,n-1): case State::kState${i}: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) + GRPC_TRACE_VLOG(promise_primitives, 2).AtLocation(whence.file(), whence.line()) << "seq[" << this << "]: begin poll step ${i+1}/${n}"; - } auto result = ${"prior."*(n-1-i)}current_promise(); PromiseResult${i}* p = result.value_if_ready(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) + GRPC_TRACE_VLOG(promise_primitives, 2).AtLocation(whence.file(), whence.line()) << "seq[" << this << "]: poll step ${i+1}/${n} gets " << (p != nullptr ? (PromiseResultTraits${i}::IsOk(*p) ? "ready" : absl::StrCat("early-error:", PromiseResultTraits${i}::ErrorString(*p)).c_str()) : "pending"); - } if (p == nullptr) return Pending{}; if (!PromiseResultTraits${i}::IsOk(*p)) { return PromiseResultTraits${i}::template ReturnValue(std::move(*p)); @@ -162,16 +158,12 @@ tail${i}: % endfor default: case State::kState${n-1}: { - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) + GRPC_TRACE_VLOG(promise_primitives, 2).AtLocation(whence.file(), whence.line()) << "seq[" << this << "]: begin poll step ${n}/${n}"; - } auto result = current_promise(); - if (GRPC_TRACE_FLAG_ENABLED(promise_primitives)) { - VLOG(2).AtLocation(whence.file(), whence.line()) + GRPC_TRACE_VLOG(promise_primitives, 2).AtLocation(whence.file(), whence.line()) << "seq[" << this << "]: poll step ${n}/${n} gets " << (result.ready()? "ready" : "pending"); - } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; return Result(std::move(*p)); diff --git a/tools/distrib/check_protobuf_pod_version.sh b/tools/distrib/check_protobuf_pod_version.sh index be3c8023dfb..aa258ddfcc6 100755 --- a/tools/distrib/check_protobuf_pod_version.sh +++ b/tools/distrib/check_protobuf_pod_version.sh @@ -23,7 +23,7 @@ pushd third_party/protobuf version1=$(git describe --tags | cut -f 1 -d'-') v1=${version1:1} # Protobuf has recently changed the versioning of the release branches/tags -# and the same release commit can be tagged with mutliple tag names +# and the same release commit can be tagged with multiple tag names # (e.g. v3.21.12 is also tagged as v21.12), which ultimately confuses # the output of "git describe --tags" and makes it non-deterministic. # The hack below converts the version number to always become 3.x.y diff --git a/tools/distrib/fix_build_deps.py b/tools/distrib/fix_build_deps.py index 4753db69bb3..79bd9bbbe86 100755 --- a/tools/distrib/fix_build_deps.py +++ b/tools/distrib/fix_build_deps.py @@ -488,7 +488,7 @@ if args.whats_left: ) -# Keeps track of all possible sets of dependencies that could satify the +# Keeps track of all possible sets of dependencies that could satisfy the # problem. (models the list monad in Haskell!) class Choices: def __init__(self, library, substitutions): diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index 1318b94fa1f..d0173a61658 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -133,7 +133,7 @@ class BuildExt(build_ext.build_ext): # behavior in gcc and clang. The clang doesn't take --stdc++11 # flags but gcc does. Since the setuptools of Python only support # all C or all C++ compilation, the mix of C and C++ will crash. - # *By default*, macOS and FreBSD use clang and Linux use gcc + # *By default*, macOS and FreeBSD use clang and Linux use gcc # # If we are not using a permissive compiler that's OK with being # passed wrong std flags, swap out compile function by adding a filter diff --git a/tools/distrib/python/xds_protos/build.py b/tools/distrib/python/xds_protos/build.py index 9c1d2e9061e..0d2e79d405a 100644 --- a/tools/distrib/python/xds_protos/build.py +++ b/tools/distrib/python/xds_protos/build.py @@ -56,7 +56,7 @@ EXCLUDE_PROTO_PACKAGES_LIST = tuple( ) ) -# Compute the pathes +# Compute the paths WORK_DIR = os.path.dirname(os.path.abspath(__file__)) GRPC_ROOT = os.path.abspath(os.path.join(WORK_DIR, "..", "..", "..", "..")) ENVOY_API_PROTO_ROOT = os.path.join(GRPC_ROOT, "third_party", "envoy-api") diff --git a/tools/docker_runners/examples/concurrent_bazel.sh b/tools/docker_runners/examples/concurrent_bazel.sh index e4c667fc197..f70795eef19 100755 --- a/tools/docker_runners/examples/concurrent_bazel.sh +++ b/tools/docker_runners/examples/concurrent_bazel.sh @@ -34,7 +34,7 @@ cd "$(dirname "$0")/../../.." # use the default docker image used for bazel builds export DOCKERFILE_DIR=tools/dockerfile/test/bazel -# Bazel RBE uses application default credentials from localhost to authenticate with RBE servers. Use a trick to make the credentails accessible from inside the docker container." +# Bazel RBE uses application default credentials from localhost to authenticate with RBE servers. Use a trick to make the credentials accessible from inside the docker container." APPLICATION_DEFAULT_CREDENTIALS_DIR="$HOME/.config/gcloud" export DOCKER_EXTRA_ARGS="-v=${APPLICATION_DEFAULT_CREDENTIALS_DIR}:/application_default_credentials:ro -e=GOOGLE_APPLICATION_CREDENTIALS=/application_default_credentials/application_default_credentials.json" diff --git a/tools/docker_runners/examples/coredump_in_docker.sh b/tools/docker_runners/examples/coredump_in_docker.sh index e8352365e21..03cf56440c4 100755 --- a/tools/docker_runners/examples/coredump_in_docker.sh +++ b/tools/docker_runners/examples/coredump_in_docker.sh @@ -22,7 +22,7 @@ cd "$(dirname "$0")/../../.." # To use the correct docker image for your experiments, # note that every invocation of run_tests.py with "--use_docker" # prints the docker image used as a debug message at the end of the run. -# This is expecially important when --compiler/--arch params are +# This is especially important when --compiler/--arch params are # use, since they usually influence with docker image will be used # by run_tests.py export DOCKERFILE_DIR=tools/dockerfile/test/cxx_debian11_x64 diff --git a/tools/docker_runners/examples/gdb_in_docker.sh b/tools/docker_runners/examples/gdb_in_docker.sh index 2282dbdf614..71f07321555 100755 --- a/tools/docker_runners/examples/gdb_in_docker.sh +++ b/tools/docker_runners/examples/gdb_in_docker.sh @@ -22,7 +22,7 @@ cd "$(dirname "$0")/../../.." # To use the correct docker image for your experiments, # note that every invocation of run_tests.py with "--use_docker" # prints the docker image used as a debug message at the end of the run. -# This is expecially important when --compiler/--arch params are +# This is especially important when --compiler/--arch params are # use, since they usually influence with docker image will be used # by run_tests.py export DOCKERFILE_DIR=tools/dockerfile/test/cxx_debian11_x64 diff --git a/tools/docker_runners/examples/run_tests_c_in_docker.sh b/tools/docker_runners/examples/run_tests_c_in_docker.sh index fad762da4f6..b74a750cdfd 100755 --- a/tools/docker_runners/examples/run_tests_c_in_docker.sh +++ b/tools/docker_runners/examples/run_tests_c_in_docker.sh @@ -22,7 +22,7 @@ cd "$(dirname "$0")/../../.." # To use the correct docker image for your experiments, # note that every invocation of run_tests.py with "--use_docker" # prints the docker image used as a debug message at the end of the run. -# This is expecially important when --compiler/--arch params are +# This is especially important when --compiler/--arch params are # use, since they usually influence with docker image will be used # by run_tests.py export DOCKERFILE_DIR=tools/dockerfile/test/cxx_debian11_x64 diff --git a/tools/dockerfile/distribtest/python_alpine_x64.current_version b/tools/dockerfile/distribtest/python_alpine_x64.current_version index ef66d784a77..9828149be61 100644 --- a/tools/dockerfile/distribtest/python_alpine_x64.current_version +++ b/tools/dockerfile/distribtest/python_alpine_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64:c2730a0e20e7951f1f6fa792dc380aba1d6ba4cc@sha256:f072c39a2e47d091a937cdcdf6e5517331b27febce8e864399ce16b35d6cc69d \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64:1d7179a0b971f3f2d5431e3ecd32043697f6d76b@sha256:d7232ef55c81d125b66899b908668156638cd2cfc5b119083eceacb6018da7e4 \ No newline at end of file diff --git a/tools/dockerfile/distribtest/python_alpine_x64/Dockerfile b/tools/dockerfile/distribtest/python_alpine_x64/Dockerfile index f119281d68b..5628c994f7f 100644 --- a/tools/dockerfile/distribtest/python_alpine_x64/Dockerfile +++ b/tools/dockerfile/distribtest/python_alpine_x64/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM python:3.10-alpine3.14 +FROM python:3.10-alpine3.17 # Our test infrastructure demands bash RUN apk update && apk add bash diff --git a/tools/dockerfile/distribtest/python_dev_alpine3.7_x64.current_version b/tools/dockerfile/distribtest/python_dev_alpine3.7_x64.current_version index fb6d76c1c1f..8e11c7a89e8 100644 --- a/tools/dockerfile/distribtest/python_dev_alpine3.7_x64.current_version +++ b/tools/dockerfile/distribtest/python_dev_alpine3.7_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_alpine3.7_x64:2872be8abc221922814403d8c793b95f7542f7e7@sha256:9c1ee0b285cb6cd3b4734e3fc0eaa5fa1ee6230f55d87cc21e7364abb1b8c58c \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/python_dev_alpine3.7_x64:498c08930a1776e309bc452c51ef3e0f0d8d5583@sha256:c2e80c14210502795712f611c541870bbe80b307ff6cc732a82d3e0c6c1237cb \ No newline at end of file diff --git a/tools/dockerfile/distribtest/python_dev_alpine3.7_x64/Dockerfile b/tools/dockerfile/distribtest/python_dev_alpine3.7_x64/Dockerfile index 30850cd3526..c4b2c4ed2aa 100644 --- a/tools/dockerfile/distribtest/python_dev_alpine3.7_x64/Dockerfile +++ b/tools/dockerfile/distribtest/python_dev_alpine3.7_x64/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.11 +FROM alpine:3.17 RUN apk add --update build-base linux-headers python3 python3-dev py3-pip diff --git a/tools/dockerfile/push_testing_images.sh b/tools/dockerfile/push_testing_images.sh index 8001fa6f37d..4948bde6a8d 100755 --- a/tools/dockerfile/push_testing_images.sh +++ b/tools/dockerfile/push_testing_images.sh @@ -37,7 +37,7 @@ cd - # $ gcloud auth login # Various check that the environment is setup correctly. -# The enviroment checks are skipped when running as a sanity check on CI. +# The environment checks are skipped when running as a sanity check on CI. if [ "${CHECK_MODE}" == "" ] then # Check that docker is installed and sudoless docker works. @@ -178,7 +178,7 @@ do then echo "Running 'docker build' for ${DOCKER_IMAGE_NAME}" echo "==========" - # Buliding a docker image with two tags; + # Building a docker image with two tags; # - one for image identification based on Dockerfile hash # - one to exclude it from the GCP Vulnerability Scanner docker build \ diff --git a/tools/dockerfile/test/bazel.current_version b/tools/dockerfile/test/bazel.current_version index d099060f754..a3d78435b01 100644 --- a/tools/dockerfile/test/bazel.current_version +++ b/tools/dockerfile/test/bazel.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/bazel:f49cc7eb69c326a62a936c5b4cdadc5f651df857@sha256:40a08d78ca161e30ab862ba48037fcaf53e812490a6e427da3832382595da746 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/bazel:de71ae928884a4697890b8ff8eda4f7fe59abec2@sha256:be25af8c0e5faf39a585e7ddd657c4fd66513e4eba0ee0c687109b19ed462518 \ No newline at end of file diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index aecc460d1d5..7b3a688f9a5 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update && apt-get -y install \ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 7.1.0 +ENV BAZEL_VERSION 7.3.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/bazel_arm64.current_version b/tools/dockerfile/test/bazel_arm64.current_version index 8c5a4ea3300..9d7f06c6674 100644 --- a/tools/dockerfile/test/bazel_arm64.current_version +++ b/tools/dockerfile/test/bazel_arm64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64:359ba8a4ea06e806f244b9488794fa23d0ae339f@sha256:112e4f5085b43df2c02852f23c665aa5310e5a44ea3f4ae553a21b882a9b56aa \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/bazel_arm64:ae4306eccb3a8985d0a63fac0dc14019c58b1c79@sha256:ce026fedc059c74bade52f4b87c54907a3cf9abb22f6a584dba584e1925bbc42 \ No newline at end of file diff --git a/tools/dockerfile/test/bazel_arm64/Dockerfile b/tools/dockerfile/test/bazel_arm64/Dockerfile index 5d357ee5541..518888b84a5 100644 --- a/tools/dockerfile/test/bazel_arm64/Dockerfile +++ b/tools/dockerfile/test/bazel_arm64/Dockerfile @@ -97,7 +97,7 @@ RUN apt-get update && apt-get -y install libc++-dev clang && apt-get clean # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 7.1.0 +ENV BAZEL_VERSION 7.3.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/binder_transport_apk.current_version b/tools/dockerfile/test/binder_transport_apk.current_version index 947022c7b44..ebb3af308e6 100644 --- a/tools/dockerfile/test/binder_transport_apk.current_version +++ b/tools/dockerfile/test/binder_transport_apk.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk:d67135c8089a0721c8918828145d949127c34e7f@sha256:c800e2d5feb3f6e9a4b837f4c1eb321892766b1e836b3f9d2e5eab8697734ff6 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/binder_transport_apk:bbd5ccb5bcc5e63beccba6b3b2e8c907a8335731@sha256:5dddb0d70ee427c7ee20d2b4f9261579218dd6b208b74c2913e0e3c79b3166f7 \ No newline at end of file diff --git a/tools/dockerfile/test/binder_transport_apk/Dockerfile b/tools/dockerfile/test/binder_transport_apk/Dockerfile index 79260545bfa..24d50cee474 100644 --- a/tools/dockerfile/test/binder_transport_apk/Dockerfile +++ b/tools/dockerfile/test/binder_transport_apk/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update && apt-get -y install \ # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 7.1.0 +ENV BAZEL_VERSION 7.3.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/dockerfile/test/cxx_alpine_x64.current_version b/tools/dockerfile/test/cxx_alpine_x64.current_version index 05cf2895d09..147481bdfc9 100644 --- a/tools/dockerfile/test/cxx_alpine_x64.current_version +++ b/tools/dockerfile/test/cxx_alpine_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/cxx_alpine_x64:e515716fa53187d8eaa9d2cb606e9f6cb1d21393@sha256:5beda19bcf186b6c9606f4265e38c99bb4308f25bc0987e0fc15164f3c205232 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/cxx_alpine_x64:0806b6d19bc92699c32c4c8d6e293f44b05f6322@sha256:10587bea5d163bf5c34c6157ebd1863d22863d9d38bbaf5135ffc6fbf2b73004 \ No newline at end of file diff --git a/tools/dockerfile/test/cxx_alpine_x64/Dockerfile b/tools/dockerfile/test/cxx_alpine_x64/Dockerfile index 5fa24a52fde..8a4cb96aa79 100644 --- a/tools/dockerfile/test/cxx_alpine_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_alpine_x64/Dockerfile @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.15 +FROM alpine:3.17 # Install Git and basic packages. RUN apk update && apk add \ autoconf \ automake \ + bash \ bzip2 \ build-base \ cmake \ diff --git a/tools/dockerfile/test/python_alpine_x64.current_version b/tools/dockerfile/test/python_alpine_x64.current_version index 1e78d54944c..eb27db8aef0 100644 --- a/tools/dockerfile/test/python_alpine_x64.current_version +++ b/tools/dockerfile/test/python_alpine_x64.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64:6f340690c07d16a23deaa8b3270c634631ddd865@sha256:c541f0ce00ca542ed4ae86870b6b73c929227127c13e532d98a9afd28604b830 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64:49f0e3830de77a1a4891ad944774dc6f758d8599@sha256:0a4e3c166fb676d85ea26d9fffec3858d59a2f243a3acc1c2f9bd293a590a98c \ No newline at end of file diff --git a/tools/dockerfile/test/python_alpine_x64/Dockerfile b/tools/dockerfile/test/python_alpine_x64/Dockerfile index 4cdb814936e..44e06e340d5 100644 --- a/tools/dockerfile/test/python_alpine_x64/Dockerfile +++ b/tools/dockerfile/test/python_alpine_x64/Dockerfile @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM alpine:3.15 +FROM alpine:3.17 # Install Git and basic packages. -RUN apk update && apk add autoconf automake bzip2 build-base cmake ccache curl gcc git libtool linux-headers make perl strace python3-dev py3-pip unzip wget zip +RUN apk update && apk add autoconf automake bash \ + bzip2 build-base cmake ccache curl gcc git libtool linux-headers make perl strace python3-dev py3-pip unzip wget zip #================= # Setup git to access working directory across docker boundary. @@ -26,8 +27,6 @@ RUN git config --global --add safe.directory '*' RUN git config --global protocol.file.allow always -RUN ln -s /usr/bin/python3 /usr/bin/python - # Install Python packages from PyPI RUN python3 -m pip install --upgrade pip==19.3.1 diff --git a/tools/dockerfile/test/sanity.current_version b/tools/dockerfile/test/sanity.current_version index b3dd4ec2cac..db46fffa969 100644 --- a/tools/dockerfile/test/sanity.current_version +++ b/tools/dockerfile/test/sanity.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:be1a47c2ca2af05342eebeeb0d5853453b7cfb60@sha256:f138b3aae124e2d6e1a08c5078fb944db7470deeba17ef083aacf3faf939059e \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:f21b7692698957bebcd72e8ab5d24c485cb4cbaf@sha256:966aa97475368b6fc308a7e9e584ab471e8c6a47b4a6c9e709c0b1b7d4e2d800 \ No newline at end of file diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index d97974a7199..0955b9c9df9 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -108,7 +108,7 @@ RUN apt-get update && apt-get install -y jq git && apt-get clean # Bazel installation # Must be in sync with tools/bazel -ENV BAZEL_VERSION 7.1.0 +ENV BAZEL_VERSION 7.3.1 # The correct bazel version is already preinstalled, no need to use //tools/bazel wrapper. ENV DISABLE_BAZEL_WRAPPER 1 diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index af16cffbd10..351040cc192 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -1737,7 +1737,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -2312,7 +2312,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index e790bc82575..bdcc33a9a70 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -3746,7 +3746,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -4321,7 +4321,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 9748cec3244..9a92a5424c2 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -1535,7 +1535,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -2110,7 +2110,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 9f54ff2eba1..978ef442a36 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -3462,7 +3462,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -4037,7 +4037,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/doxygen/Doxyfile.objc b/tools/doxygen/Doxyfile.objc index a212a28a910..b8ac808811b 100644 --- a/tools/doxygen/Doxyfile.objc +++ b/tools/doxygen/Doxyfile.objc @@ -1486,7 +1486,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -2061,7 +2061,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/doxygen/Doxyfile.objc.internal b/tools/doxygen/Doxyfile.objc.internal index 5661dd708c5..0a95c92d783 100644 --- a/tools/doxygen/Doxyfile.objc.internal +++ b/tools/doxygen/Doxyfile.objc.internal @@ -1513,7 +1513,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -2088,7 +2088,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/doxygen/Doxyfile.php b/tools/doxygen/Doxyfile.php index 4908e4f06e9..3c8936d9dc2 100644 --- a/tools/doxygen/Doxyfile.php +++ b/tools/doxygen/Doxyfile.php @@ -1473,7 +1473,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -2048,7 +2048,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = GRPC_FINAL= GRPC_OVERIDE= +PREDEFINED = GRPC_FINAL= GRPC_OVERRIDE= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh b/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh index dafc453c72e..300cace3a37 100755 --- a/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh +++ b/tools/internal_ci/linux/grpc_binder_transport_apk_build_in_docker.sh @@ -19,7 +19,7 @@ echo $ANDROID_HOME echo $ANDROID_NDK_HOME # Android platforms only works with Bazel >= 7.0 -export OVERRIDE_BAZEL_VERSION=7.1.0 +export OVERRIDE_BAZEL_VERSION=7.3.1 python3 tools/run_tests/python_utils/bazel_report_helper.py --report_path bazel_binder_example_app bazel_binder_example_app/bazel_wrapper \ diff --git a/tools/internal_ci/linux/psm-fallback-python.cfg b/tools/internal_ci/linux/psm-fallback-python.cfg new file mode 100644 index 00000000000..2a7883ff8c6 --- /dev/null +++ b/tools/internal_ci/linux/psm-fallback-python.cfg @@ -0,0 +1,30 @@ +# Copyright 2024 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/psm-interop-test-python.sh" +timeout_mins: 30 +action { + define_artifacts { + regex: "artifacts/**/*sponge_log.xml" + regex: "artifacts/**/*.log" + strip_prefix: "artifacts" + } +} +env_vars { + key: "PSM_TEST_SUITE" + value: "fallback" +} diff --git a/tools/internal_ci/macos/grpc_ios_binary_size.sh b/tools/internal_ci/macos/grpc_ios_binary_size.sh index 94cc2d6b388..56877ea6ed0 100755 --- a/tools/internal_ci/macos/grpc_ios_binary_size.sh +++ b/tools/internal_ci/macos/grpc_ios_binary_size.sh @@ -32,7 +32,7 @@ then # running on PR, generate size diff DIFF_BASE="origin/${KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH}" else - # running as continous build, only generate numbers for the current revision + # running as continuous build, only generate numbers for the current revision DIFF_BASE="" fi diff --git a/tools/run_tests/artifacts/build_artifact_ruby.sh b/tools/run_tests/artifacts/build_artifact_ruby.sh index d98ac93255a..9c0715db417 100755 --- a/tools/run_tests/artifacts/build_artifact_ruby.sh +++ b/tools/run_tests/artifacts/build_artifact_ruby.sh @@ -41,7 +41,7 @@ ruby --version # log gem versions for easier debugging if things go wrong gem list || true -# avoid polluting the global gem diretory +# avoid polluting the global gem directory # by configuring "bundle install" to install all the gems # into a project-local directory export BUNDLE_PATH=bundle_local_gems diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index 0445f6bb920..e7b3c057fc1 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -321,7 +321,7 @@ class CXXLanguage(Language): ) # Scenario was added in https://github.com/grpc/grpc/pull/12987, but its purpose is unclear - # (beyond excercising some params that other scenarios don't) + # (beyond exercising some params that other scenarios don't) yield _ping_pong_scenario( "cpp_protobuf_async_unary_75Kqps_600channel_60Krpcs_300Breq_50Bresp", rpc_type="UNARY", diff --git a/tools/run_tests/python_utils/upload_rbe_results.py b/tools/run_tests/python_utils/upload_rbe_results.py index 8f506fdba59..e8db158eefa 100755 --- a/tools/run_tests/python_utils/upload_rbe_results.py +++ b/tools/run_tests/python_utils/upload_rbe_results.py @@ -310,7 +310,7 @@ if __name__ == "__main__": "test_target": action["id"]["targetId"], "test_class_name": "N/A", "test_case": "N/A", - "result": "UNPARSEABLE", + "result": "UNPARSABLE", "timestamp": "N/A", }, } diff --git a/tools/run_tests/run_grpclb_interop_tests.py b/tools/run_tests/run_grpclb_interop_tests.py index da0c6bafb4d..43068901c8f 100755 --- a/tools/run_tests/run_grpclb_interop_tests.py +++ b/tools/run_tests/run_grpclb_interop_tests.py @@ -554,7 +554,7 @@ def wait_until_dns_server_is_up(dns_server_ip): time.sleep(0.1) raise Exception( "Failed to reach DNS server over TCP and/or UDP. " - "Exitting without running tests." + "Exiting without running tests." ) diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py index 064dbf3328d..d6717ff8858 100755 --- a/tools/run_tests/run_performance_tests.py +++ b/tools/run_tests/run_performance_tests.py @@ -447,7 +447,7 @@ def create_scenarios( if custom_server_lang and custom_client_lang: raise Exception( "Cannot set both custom CLIENT_LANGUAGE and" - " SERVER_LANGUAGEin the same scenario" + " SERVER_LANGUAGE in the same scenario" ) if custom_server_lang: if not workers_by_lang.get(custom_server_lang, []): @@ -528,7 +528,7 @@ profile_output_files = [] # Note the base names of perf text reports are used when creating and processing # perf data. The scenario name uniqifies the output name in the final # perf reports directory. -# Alos, the perf profiles need to be fetched and processed after each scenario +# Also, the perf profiles need to be fetched and processed after each scenario # in order to avoid clobbering the output files. def run_collect_perf_profile_jobs( hosts_and_base_names, scenario_name, flame_graph_reports diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index e2b5f92262e..a663675eaec 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -320,7 +320,7 @@ class CLanguage(object): self._cmake_architecture_windows = ( "x64" if self.args.arch == "x64" else "Win32" ) - # when builing with Ninja, the VS common tools need to be activated first + # when building with Ninja, the VS common tools need to be activated first self._activate_vs_tools_windows = activate_vs_tools # "x64_x86" means create 32bit binaries, but use 64bit toolkit to secure more memory for the build self._vs_tools_architecture_windows = ( @@ -885,7 +885,7 @@ class PythonLanguage(object): elif args.compiler == "pypy3": return (pypy32_config,) elif args.compiler == "python_alpine": - return (python39_config,) + return (python310_config,) elif args.compiler == "all_the_cpythons": return ( python38_config, diff --git a/tools/run_tests/run_xds_tests.py b/tools/run_tests/run_xds_tests.py index a72f2aa2e14..644b69ee135 100755 --- a/tools/run_tests/run_xds_tests.py +++ b/tools/run_tests/run_xds_tests.py @@ -123,7 +123,7 @@ def parse_test_cases(arg): test_cases = test_cases.union([arg]) if not all([test_case in all_test_cases for test_case in test_cases]): raise Exception("Failed to parse test cases %s" % arg) - # Perserve order. + # Preserve order. return [x for x in all_test_cases if x in test_cases] @@ -2179,7 +2179,7 @@ def test_circuit_breaking( """ Since backend service circuit_breakers configuration cannot be unset, which causes trouble for restoring validate_for_proxy flag in target - proxy/global forwarding rule. This test uses dedicated backend sevices. + proxy/global forwarding rule. This test uses dedicated backend services. The url_map and backend services undergoes the following state changes: Before test: diff --git a/tools/run_tests/sanity/banned_functions.py b/tools/run_tests/sanity/banned_functions.py index 9db09d82699..cd00ec58c57 100755 --- a/tools/run_tests/sanity/banned_functions.py +++ b/tools/run_tests/sanity/banned_functions.py @@ -20,15 +20,8 @@ # Any new instance of a deprecated function being used in the code will be # flagged by the script. If there is a new instance of a deprecated function in # a Pull Request, then the Sanity tests will fail for the Pull Request. -# We are currently working on clearing out the usage of deprecated functions in -# the entire gRPC code base. -# While our cleaning is in progress we have a temporary allow list. The allow -# list has a list of files where clean up of deprecated functions is pending. -# As we clean up the deprecated function from files, we will remove them from -# the allow list. -# It would be wise to do the file clean up and the altering of the allow list -# in the same PR. This will make sure that any roll back of a clean up PR will -# also alter the allow list and avoid build failures. +# The allow list has a list of files where clean up of deprecated functions is +# pending. import os import sys @@ -76,22 +69,18 @@ DEPRECATED_FUNCTION_TEMP_ALLOW_LIST = { "./src/core/util/posix/log.cc", "./src/core/util/windows/log.cc", ], - "gpr_log_func_args": [], - "gpr_set_log_function(": [], - "GPR_ASSERT": [], - "gpr_assertion_failed": [], - "GPR_DEBUG_ASSERT": [], - "gpr_log_severity_string": [], - "gpr_set_log_verbosity(": [], + "gpr_log_func_args": [], # Safe to delete this entry after Nov 2024. + "gpr_set_log_function(": [], # Safe to delete this entry after Nov 2024. + "GPR_ASSERT": [], # Safe to delete this entry after Nov 2024. + "gpr_assertion_failed": [], # Safe to delete this entry after Nov 2024. + "GPR_DEBUG_ASSERT": [], # Safe to delete this entry after Nov 2024. + "gpr_log_severity_string": [], # Safe to delete this entry after Nov 2024. + "gpr_set_log_verbosity(": [], # Safe to delete this entry after Nov 2024. } errors = 0 num_files = 0 for root, dirs, files in os.walk("."): - if root.startswith( - "./tools/distrib/python/grpcio_tools" - ) or root.startswith("./src/python"): - continue for filename in files: num_files += 1 path = os.path.join(root, filename) @@ -107,7 +96,7 @@ for root, dirs, files in os.walk("."): if deprecated in text: print( ( - 'Illegal use of "%s" in %s . Use absl functions instead.' + 'Illegal use of "%s" in %s. Use absl functions instead.' % (deprecated, path) ) ) @@ -121,5 +110,5 @@ if errors > 0: # https://github.com/grpc/grpc/issues/15381 # Basically, a change rendered this script useless and we did not realize it. # This check ensures that this type of issue doesn't occur again. -assert num_files > 18000 # we have more files -# print(('Number of files checked : %d ' % (num_files))) +assert num_files > 18000 +print("Number of files checked : %d " % (num_files))