From 913223d0d976ff547aa7b528c29548af97044298 Mon Sep 17 00:00:00 2001 From: Hannah Shi Date: Wed, 24 Jan 2024 16:52:27 -0800 Subject: [PATCH 1/8] [ObjC] add privacy manifests to boringssl grpc (#35616) BoringSSL-GRPC uses sources from https://github.com/google/boringssl.git, which doesn't contain PrivacyInfo.xcprivacy file. This PR embeds the manifest data into the podspec and extract during pod install, similar to file boringssl_prefix_symbols.h -- Will need to regenerate the podspec after #35542 merged. Closes #35616 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35616 from HannahShiSFB:privacy-manifests-boring-ssl d068be244b603140b512e1e9ab27488b3fb05ebb PiperOrigin-RevId: 601274520 --- src/objective-c/BoringSSL-GRPC.podspec | 12 ++++++++++- .../BoringSSL-GRPC.podspec.template | 20 +++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/objective-c/BoringSSL-GRPC.podspec b/src/objective-c/BoringSSL-GRPC.podspec index 5d4f8578fcf..610c3367a59 100644 --- a/src/objective-c/BoringSSL-GRPC.podspec +++ b/src/objective-c/BoringSSL-GRPC.podspec @@ -124,7 +124,7 @@ Pod::Spec.new do |s| ss.header_mappings_dir = 'src' ss.resource_bundles = { - s.module_name => 'src/objective-c/PrivacyInfo.xcprivacy' + s.module_name => 'src/PrivacyInfo.xcprivacy' } ss.source_files = 'src/ssl/*.{h,c,cc}', @@ -691,6 +691,16 @@ Pod::Spec.new do |s| zwQA EOF + # PrivacyInfo.xcprivacy is not part of BoringSSL repo, inject it during pod installation + base64 --decode $opts < src/PrivacyInfo.xcprivacy + H4sICAAAAAAC/1ByaXZhY3lJbmZvLnhjcHJpdmFjeQC1kl9PwjAUxZ/Hp6h9Z1di/JsxAhskJAQXGQ8+ + Nt0VG7a1aRuw395OHUhE8UHflrNzzj2/pNHgpSrJBrURsu7TXnhOCdZcFqJe9ekyn3Rv6CDuRGfpfZI/ + ZmOiSmEsyZaj2TQhtAswVKpEgDRPSTabLnLiOwDGc0ros7XqDmC73YascYVcVo3RQKalQm3dzJd1fSAs + bEH9mff2gzleLQS3cSeI1uji+SLTYsO4yzXja78ygkb2f59YaRC++BJZlsgtFimzLHcKzS7BtGYOvm1O + ZcVEfdI+5ByNwWKYTY/U+4+gBQh+TrZBbzNW+wFHnQmzuJLaTUSJuajQWFapCD4SJ488IDNyDxV8mrm/ + m1z1rsPeYSnscaDl+RewhTMWq5GUtsH7Y7KLy8ntL8h2WqtE8PY0484rAb5xoDEDAAA= + EOF + # We are renaming openssl to openssl_grpc so that there is no conflict with openssl if it exists find . -type f \\( -path '*.h' -or -path '*.cc' -or -path '*.c' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include 'src/objective-c/PrivacyInfo.xcprivacy' + s.module_name => 'src/PrivacyInfo.xcprivacy' } ss.source_files = 'src/ssl/*.{h,c,cc}', @@ -205,7 +206,14 @@ *) opts="--ignore-garbage" ;; esac base64 --decode $opts < src/include/openssl/boringssl_prefix_symbols.h - % for line in compress_boringssl_prefix_header(): + % for line in compress_and_encode_file('src/boringssl/boringssl_prefix_symbols.h'): + ${line.decode('utf-8')} + % endfor + EOF + + # PrivacyInfo.xcprivacy is not part of BoringSSL repo, inject it during pod installation + base64 --decode $opts < src/PrivacyInfo.xcprivacy + % for line in compress_and_encode_file('src/objective-c/PrivacyInfo.xcprivacy'): ${line.decode('utf-8')} % endfor EOF From 576c37192c9cf4eebd5942bd8eea1d0d89e70edb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 24 Jan 2024 18:20:40 -0800 Subject: [PATCH 2/8] [cmake] build fix (#35661) A fuzzer changed name, and we don't support building fuzzers with cmake. Closes #35661 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35661 from ctiller:cmakey 9750b4c4edf098fa51347d3b091f0245ce285542 PiperOrigin-RevId: 601295049 --- CMakeLists.txt | 189 ------------------ build_autogenerated.yaml | 143 ------------- .../extract_metadata_from_bazel_xml.py | 1 + tools/run_tests/generated/tests.json | 54 ----- 4 files changed, 1 insertion(+), 386 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffb73d56ed5..43f54c32be8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -823,12 +823,6 @@ protobuf_generate_grpc_cpp_with_import_path_correction( protobuf_generate_grpc_cpp_with_import_path_correction( src/proto/grpc/testing/xds/v3/wrr_locality.proto src/proto/grpc/testing/xds/v3/wrr_locality.proto ) -protobuf_generate_grpc_cpp_with_import_path_correction( - test/core/end2end/fuzzers/api_fuzzer.proto test/core/end2end/fuzzers/api_fuzzer.proto -) -protobuf_generate_grpc_cpp_with_import_path_correction( - test/core/end2end/fuzzers/fuzzer_input.proto test/core/end2end/fuzzers/fuzzer_input.proto -) protobuf_generate_grpc_cpp_with_import_path_correction( test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto ) @@ -841,9 +835,6 @@ protobuf_generate_grpc_cpp_with_import_path_correction( protobuf_generate_grpc_cpp_with_import_path_correction( test/core/util/fuzz_config_vars.proto test/core/util/fuzz_config_vars.proto ) -protobuf_generate_grpc_cpp_with_import_path_correction( - test/core/util/fuzzing_channel_args.proto test/core/util/fuzzing_channel_args.proto -) if(gRPC_BUILD_TESTS) add_custom_target(buildtests_c) @@ -1344,12 +1335,6 @@ if(gRPC_BUILD_TESTS) add_dependencies(buildtests_cxx server_context_test_spouse_test) add_dependencies(buildtests_cxx server_early_return_test) add_dependencies(buildtests_cxx server_finishes_request_test) - if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) - add_dependencies(buildtests_cxx server_fuzzer_chaotic_good) - endif() - if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) - add_dependencies(buildtests_cxx server_fuzzer_chttp2) - endif() add_dependencies(buildtests_cxx server_interceptors_end2end_test) add_dependencies(buildtests_cxx server_registered_method_bad_client_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) @@ -26061,180 +26046,6 @@ target_link_libraries(server_finishes_request_test ) -endif() -if(gRPC_BUILD_TESTS) -if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) - - add_executable(server_fuzzer_chaotic_good - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.grpc.pb.h - src/core/ext/transport/chaotic_good/frame.cc - src/core/ext/transport/chaotic_good/frame_header.cc - src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc - src/core/ext/transport/chaotic_good/settings_metadata.cc - src/core/lib/transport/promise_endpoint.cc - test/core/end2end/fuzzers/fuzzing_common.cc - test/core/end2end/fuzzers/network_input.cc - test/core/end2end/fuzzers/server_fuzzer.cc - test/core/end2end/fuzzers/server_fuzzer_chaotic_good.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc - test/core/util/cmdline.cc - test/core/util/fuzz_config_vars.cc - test/core/util/fuzz_config_vars_helpers.cc - test/core/util/fuzzer_corpus_test.cc - test/core/util/fuzzer_util.cc - test/core/util/fuzzing_channel_args.cc - test/core/util/grpc_profiler.cc - test/core/util/histogram.cc - test/core/util/mock_endpoint.cc - test/core/util/parse_hexstring.cc - test/core/util/passthru_endpoint.cc - test/core/util/resolve_localhost_ip46.cc - test/core/util/slice_splitter.cc - test/core/util/tracer_util.cc - ) - if(WIN32 AND MSVC) - if(BUILD_SHARED_LIBS) - target_compile_definitions(server_fuzzer_chaotic_good - PRIVATE - "GPR_DLL_IMPORTS" - "GRPC_DLL_IMPORTS" - ) - endif() - endif() - target_compile_features(server_fuzzer_chaotic_good PUBLIC cxx_std_14) - target_include_directories(server_fuzzer_chaotic_good - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - ${_gRPC_RE2_INCLUDE_DIR} - ${_gRPC_SSL_INCLUDE_DIR} - ${_gRPC_UPB_GENERATED_DIR} - ${_gRPC_UPB_GRPC_GENERATED_DIR} - ${_gRPC_UPB_INCLUDE_DIR} - ${_gRPC_XXHASH_INCLUDE_DIR} - ${_gRPC_ZLIB_INCLUDE_DIR} - third_party/googletest/googletest/include - third_party/googletest/googletest - third_party/googletest/googlemock/include - third_party/googletest/googlemock - ${_gRPC_PROTO_GENS_DIR} - ) - - target_link_libraries(server_fuzzer_chaotic_good - ${_gRPC_ALLTARGETS_LIBRARIES} - gtest - ${_gRPC_PROTOBUF_LIBRARIES} - grpc_test_util - grpc++_test_config - ) - - -endif() -endif() -if(gRPC_BUILD_TESTS) -if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) - - add_executable(server_fuzzer_chttp2 - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/api_fuzzer.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/end2end/fuzzers/fuzzer_input.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzz_config_vars.grpc.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.grpc.pb.cc - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.pb.h - ${_gRPC_PROTO_GENS_DIR}/test/core/util/fuzzing_channel_args.grpc.pb.h - src/core/ext/transport/chaotic_good/frame_header.cc - test/core/end2end/fuzzers/fuzzing_common.cc - test/core/end2end/fuzzers/network_input.cc - test/core/end2end/fuzzers/server_fuzzer.cc - test/core/end2end/fuzzers/server_fuzzer_chttp2.cc - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc - test/core/util/cmdline.cc - test/core/util/fuzz_config_vars.cc - test/core/util/fuzz_config_vars_helpers.cc - test/core/util/fuzzer_corpus_test.cc - test/core/util/fuzzer_util.cc - test/core/util/fuzzing_channel_args.cc - test/core/util/grpc_profiler.cc - test/core/util/histogram.cc - test/core/util/mock_endpoint.cc - test/core/util/parse_hexstring.cc - test/core/util/passthru_endpoint.cc - test/core/util/resolve_localhost_ip46.cc - test/core/util/slice_splitter.cc - test/core/util/tracer_util.cc - ) - if(WIN32 AND MSVC) - if(BUILD_SHARED_LIBS) - target_compile_definitions(server_fuzzer_chttp2 - PRIVATE - "GPR_DLL_IMPORTS" - "GRPC_DLL_IMPORTS" - ) - endif() - endif() - target_compile_features(server_fuzzer_chttp2 PUBLIC cxx_std_14) - target_include_directories(server_fuzzer_chttp2 - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - ${_gRPC_RE2_INCLUDE_DIR} - ${_gRPC_SSL_INCLUDE_DIR} - ${_gRPC_UPB_GENERATED_DIR} - ${_gRPC_UPB_GRPC_GENERATED_DIR} - ${_gRPC_UPB_INCLUDE_DIR} - ${_gRPC_XXHASH_INCLUDE_DIR} - ${_gRPC_ZLIB_INCLUDE_DIR} - third_party/googletest/googletest/include - third_party/googletest/googletest - third_party/googletest/googlemock/include - third_party/googletest/googlemock - ${_gRPC_PROTO_GENS_DIR} - ) - - target_link_libraries(server_fuzzer_chttp2 - ${_gRPC_ALLTARGETS_LIBRARIES} - gtest - ${_gRPC_PROTOBUF_LIBRARIES} - grpc_test_util - grpc++_test_config - ) - - -endif() endif() if(gRPC_BUILD_TESTS) diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 0797938aa16..dae8fee9f04 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -15358,149 +15358,6 @@ targets: - grpc_authorization_provider - grpc_unsecure - grpc_test_util -- name: server_fuzzer_chaotic_good - gtest: true - build: test - language: c++ - headers: - - src/core/ext/transport/chaotic_good/frame.h - - src/core/ext/transport/chaotic_good/frame_header.h - - src/core/ext/transport/chaotic_good/server/chaotic_good_server.h - - src/core/ext/transport/chaotic_good/settings_metadata.h - - src/core/lib/promise/event_engine_wakeup_scheduler.h - - src/core/lib/promise/inter_activity_latch.h - - src/core/lib/promise/wait_set.h - - src/core/lib/transport/promise_endpoint.h - - test/core/end2end/fuzzers/fuzzing_common.h - - test/core/end2end/fuzzers/network_input.h - - test/core/end2end/fuzzers/server_fuzzer.h - - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h - - test/core/util/cmdline.h - - test/core/util/evaluate_args_test_util.h - - test/core/util/fuzz_config_vars.h - - test/core/util/fuzz_config_vars_helpers.h - - test/core/util/fuzzer_util.h - - test/core/util/fuzzing_channel_args.h - - test/core/util/grpc_profiler.h - - test/core/util/histogram.h - - test/core/util/mock_authorization_endpoint.h - - test/core/util/mock_endpoint.h - - test/core/util/parse_hexstring.h - - test/core/util/passthru_endpoint.h - - test/core/util/resolve_localhost_ip46.h - - test/core/util/slice_splitter.h - - test/core/util/tracer_util.h - src: - - test/core/end2end/fuzzers/api_fuzzer.proto - - test/core/end2end/fuzzers/fuzzer_input.proto - - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/util/fuzz_config_vars.proto - - test/core/util/fuzzing_channel_args.proto - - src/core/ext/transport/chaotic_good/frame.cc - - src/core/ext/transport/chaotic_good/frame_header.cc - - src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc - - src/core/ext/transport/chaotic_good/settings_metadata.cc - - src/core/lib/transport/promise_endpoint.cc - - test/core/end2end/fuzzers/fuzzing_common.cc - - test/core/end2end/fuzzers/network_input.cc - - test/core/end2end/fuzzers/server_fuzzer.cc - - test/core/end2end/fuzzers/server_fuzzer_chaotic_good.cc - - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc - - test/core/util/cmdline.cc - - test/core/util/fuzz_config_vars.cc - - test/core/util/fuzz_config_vars_helpers.cc - - test/core/util/fuzzer_corpus_test.cc - - test/core/util/fuzzer_util.cc - - test/core/util/fuzzing_channel_args.cc - - test/core/util/grpc_profiler.cc - - test/core/util/histogram.cc - - test/core/util/mock_endpoint.cc - - test/core/util/parse_hexstring.cc - - test/core/util/passthru_endpoint.cc - - test/core/util/resolve_localhost_ip46.cc - - test/core/util/slice_splitter.cc - - test/core/util/tracer_util.cc - deps: - - gtest - - protobuf - - grpc_test_util - - grpc++_test_config - args: - - test/core/end2end/fuzzers/server_fuzzer_chaotic_good_corpus - - -runs=20000 - - -max_total_time=300 - - --directory=test/core/end2end/fuzzers/server_fuzzer_chaotic_good_corpus - platforms: - - linux - - posix - - mac - uses_polling: false -- name: server_fuzzer_chttp2 - gtest: true - build: test - language: c++ - headers: - - src/core/ext/transport/chaotic_good/frame_header.h - - test/core/end2end/fuzzers/fuzzing_common.h - - test/core/end2end/fuzzers/network_input.h - - test/core/end2end/fuzzers/server_fuzzer.h - - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h - - test/core/util/cmdline.h - - test/core/util/evaluate_args_test_util.h - - test/core/util/fuzz_config_vars.h - - test/core/util/fuzz_config_vars_helpers.h - - test/core/util/fuzzer_util.h - - test/core/util/fuzzing_channel_args.h - - test/core/util/grpc_profiler.h - - test/core/util/histogram.h - - test/core/util/mock_authorization_endpoint.h - - test/core/util/mock_endpoint.h - - test/core/util/parse_hexstring.h - - test/core/util/passthru_endpoint.h - - test/core/util/resolve_localhost_ip46.h - - test/core/util/slice_splitter.h - - test/core/util/tracer_util.h - src: - - test/core/end2end/fuzzers/api_fuzzer.proto - - test/core/end2end/fuzzers/fuzzer_input.proto - - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto - - test/core/util/fuzz_config_vars.proto - - test/core/util/fuzzing_channel_args.proto - - src/core/ext/transport/chaotic_good/frame_header.cc - - test/core/end2end/fuzzers/fuzzing_common.cc - - test/core/end2end/fuzzers/network_input.cc - - test/core/end2end/fuzzers/server_fuzzer.cc - - test/core/end2end/fuzzers/server_fuzzer_chttp2.cc - - test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc - - test/core/util/cmdline.cc - - test/core/util/fuzz_config_vars.cc - - test/core/util/fuzz_config_vars_helpers.cc - - test/core/util/fuzzer_corpus_test.cc - - test/core/util/fuzzer_util.cc - - test/core/util/fuzzing_channel_args.cc - - test/core/util/grpc_profiler.cc - - test/core/util/histogram.cc - - test/core/util/mock_endpoint.cc - - test/core/util/parse_hexstring.cc - - test/core/util/passthru_endpoint.cc - - test/core/util/resolve_localhost_ip46.cc - - test/core/util/slice_splitter.cc - - test/core/util/tracer_util.cc - deps: - - gtest - - protobuf - - grpc_test_util - - grpc++_test_config - args: - - test/core/end2end/fuzzers/server_fuzzer_chttp2_corpus - - -runs=20000 - - -max_total_time=300 - - --directory=test/core/end2end/fuzzers/server_fuzzer_chttp2_corpus - platforms: - - linux - - posix - - mac - uses_polling: false - name: server_interceptors_end2end_test gtest: true build: test diff --git a/tools/buildgen/extract_metadata_from_bazel_xml.py b/tools/buildgen/extract_metadata_from_bazel_xml.py index 1bb4fc221ef..2a289c5e2bb 100755 --- a/tools/buildgen/extract_metadata_from_bazel_xml.py +++ b/tools/buildgen/extract_metadata_from_bazel_xml.py @@ -904,6 +904,7 @@ def _exclude_unwanted_cc_tests(tests: List[str]) -> List[str]: # we don't need to generate fuzzers outside of bazel tests = [test for test in tests if not test.endswith("_fuzzer")] + tests = [test for test in tests if "_fuzzer_" not in test] return tests diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 54882d5251c..6d3fc272028 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -9043,60 +9043,6 @@ ], "uses_polling": true }, - { - "args": [ - "test/core/end2end/fuzzers/server_fuzzer_chaotic_good_corpus", - "-runs=20000", - "-max_total_time=300", - "--directory=test/core/end2end/fuzzers/server_fuzzer_chaotic_good_corpus" - ], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": true, - "language": "c++", - "name": "server_fuzzer_chaotic_good", - "platforms": [ - "linux", - "mac", - "posix" - ], - "uses_polling": false - }, - { - "args": [ - "test/core/end2end/fuzzers/server_fuzzer_chttp2_corpus", - "-runs=20000", - "-max_total_time=300", - "--directory=test/core/end2end/fuzzers/server_fuzzer_chttp2_corpus" - ], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": true, - "language": "c++", - "name": "server_fuzzer_chttp2", - "platforms": [ - "linux", - "mac", - "posix" - ], - "uses_polling": false - }, { "args": [], "benchmark": false, From 984daf98d783b2269acfadf9503b514008ad2cc3 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 25 Jan 2024 01:54:53 -0800 Subject: [PATCH 3/8] [CSM o11y] Re-experimentalize CSM OTel Plugin Option (#35660) We are no longer sure about this API, so re-experimentalizing it. This PR will be backported to 1.61 as well. Closes #35660 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35660 from yashykt:ReexperimentalizeCsmPluginOption 4f114a54d9914c70d49358f7e84e7bfdab576590 PiperOrigin-RevId: 601378856 --- include/grpcpp/ext/csm_observability.h | 3 +-- src/cpp/ext/csm/csm_observability.cc | 3 +-- test/cpp/ext/csm/csm_observability_test.cc | 2 +- test/cpp/interop/xds_interop_client.cc | 2 +- test/cpp/interop/xds_interop_server.cc | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/grpcpp/ext/csm_observability.h b/include/grpcpp/ext/csm_observability.h index 238078202cb..a3b50a72387 100644 --- a/include/grpcpp/ext/csm_observability.h +++ b/include/grpcpp/ext/csm_observability.h @@ -90,8 +90,6 @@ class CsmObservabilityBuilder { std::unique_ptr builder_; }; -} // namespace experimental - /// Creates an OpenTelemetryPluginOption that would add additional labels on /// gRPC metrics to enhance observability for CSM users. /// @@ -102,6 +100,7 @@ class CsmObservabilityBuilder { /// .BuildAndRegisterGlobal(); std::unique_ptr MakeCsmOpenTelemetryPluginOption(); +} // namespace experimental } // namespace grpc #endif // GRPCPP_EXT_CSM_OBSERVABILITY_H diff --git a/src/cpp/ext/csm/csm_observability.cc b/src/cpp/ext/csm/csm_observability.cc index 11ea288017b..3037b559dae 100644 --- a/src/cpp/ext/csm/csm_observability.cc +++ b/src/cpp/ext/csm/csm_observability.cc @@ -141,10 +141,9 @@ absl::StatusOr CsmObservabilityBuilder::BuildAndRegister() { return CsmObservability(); } -} // namespace experimental - std::unique_ptr MakeCsmOpenTelemetryPluginOption() { return std::make_unique(); } +} // namespace experimental } // namespace grpc diff --git a/test/cpp/ext/csm/csm_observability_test.cc b/test/cpp/ext/csm/csm_observability_test.cc index 6ca73969bc1..520c6f4f3c4 100644 --- a/test/cpp/ext/csm/csm_observability_test.cc +++ b/test/cpp/ext/csm/csm_observability_test.cc @@ -65,7 +65,7 @@ TEST(CsmChannelTargetSelectorTest, XdsTargetsWithTDAuthority) { TEST(CsmPluginOptionTest, Basic) { OpenTelemetryPluginBuilder() - .AddPluginOption(MakeCsmOpenTelemetryPluginOption()) + .AddPluginOption(experimental::MakeCsmOpenTelemetryPluginOption()) .BuildAndRegisterGlobal(); } diff --git a/test/cpp/interop/xds_interop_client.cc b/test/cpp/interop/xds_interop_client.cc index 82d660d0575..a896e07b5c7 100644 --- a/test/cpp/interop/xds_interop_client.cc +++ b/test/cpp/interop/xds_interop_client.cc @@ -404,7 +404,7 @@ void EnableCsmObservability() { std::make_shared(); meter_provider->AddMetricReader(std::move(prometheus_exporter)); grpc::OpenTelemetryPluginBuilder() - .AddPluginOption(grpc::MakeCsmOpenTelemetryPluginOption()) + .AddPluginOption(grpc::experimental::MakeCsmOpenTelemetryPluginOption()) .SetMeterProvider(std::move(meter_provider)) .BuildAndRegisterGlobal(); } diff --git a/test/cpp/interop/xds_interop_server.cc b/test/cpp/interop/xds_interop_server.cc index 49b4a82da6f..15dc66e4446 100644 --- a/test/cpp/interop/xds_interop_server.cc +++ b/test/cpp/interop/xds_interop_server.cc @@ -55,7 +55,7 @@ void EnableCsmObservability() { std::make_shared(); meter_provider->AddMetricReader(std::move(prometheus_exporter)); grpc::OpenTelemetryPluginBuilder() - .AddPluginOption(grpc::MakeCsmOpenTelemetryPluginOption()) + .AddPluginOption(grpc::experimental::MakeCsmOpenTelemetryPluginOption()) .SetMeterProvider(std::move(meter_provider)) .BuildAndRegisterGlobal(); } From 19ad49d169d70150fc65285d44f4f2782a844c8e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 25 Jan 2024 08:00:00 -0800 Subject: [PATCH 4/8] [bazel] disable fuzzer on mac (#35662) Closes #35662 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35662 from ctiller:nononono 4f7d2fb893905df791437e3ce1dd65b967bd78dd PiperOrigin-RevId: 601448944 --- test/core/end2end/fuzzers/BUILD | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/fuzzers/BUILD b/test/core/end2end/fuzzers/BUILD index daca49bcf9c..4ed7b7850ee 100644 --- a/test/core/end2end/fuzzers/BUILD +++ b/test/core/end2end/fuzzers/BUILD @@ -145,7 +145,10 @@ grpc_proto_fuzzer( corpus = "server_fuzzer_chttp2_corpus", language = "C++", proto = None, - tags = ["no_windows"], + tags = [ + "no_mac", + "no_windows", + ], uses_event_engine = False, uses_polling = False, deps = [ @@ -160,7 +163,10 @@ grpc_proto_fuzzer( corpus = "server_fuzzer_chaotic_good_corpus", language = "C++", proto = None, - tags = ["no_windows"], + tags = [ + "no_mac", + "no_windows", + ], uses_event_engine = False, uses_polling = False, deps = [ From 76c45b98d1603555272d6bf468331d27b16d03f2 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 25 Jan 2024 08:37:31 -0800 Subject: [PATCH 5/8] [otel] Return absl::Status as a return from BuildAndRegisterGlobal (#35659) Just to be future-proof, I'm amending the `void` return status of `BuildAndRegisterGlobal` in `OpenTelemetryPluginBuilder` to absl::Status. This will be backported to 1.61 as well. Closes #35659 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35659 from yashykt:UpdateOtelApiToAddStatus 07d3f41b8af09349db8bf572d2feb0405445ac93 PiperOrigin-RevId: 601458408 --- include/grpcpp/ext/otel_plugin.h | 3 ++- src/cpp/ext/csm/csm_observability.cc | 5 ++++- src/cpp/ext/otel/otel_plugin.cc | 9 +++++---- src/cpp/ext/otel/otel_plugin.h | 2 +- test/cpp/ext/csm/csm_observability_test.cc | 12 +++++++----- test/cpp/ext/otel/otel_test_library.cc | 2 +- test/cpp/interop/observability_client.cc | 2 +- test/cpp/interop/xds_interop_client.cc | 10 ++++++---- test/cpp/interop/xds_interop_server.cc | 10 ++++++---- 9 files changed, 33 insertions(+), 22 deletions(-) diff --git a/include/grpcpp/ext/otel_plugin.h b/include/grpcpp/ext/otel_plugin.h index a815106dfda..51afdaa83dd 100644 --- a/include/grpcpp/ext/otel_plugin.h +++ b/include/grpcpp/ext/otel_plugin.h @@ -27,6 +27,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/status/status.h" #include "absl/strings/string_view.h" #include "opentelemetry/metrics/meter_provider.h" @@ -107,7 +108,7 @@ class OpenTelemetryPluginBuilder { std::unique_ptr option); /// Registers a global plugin that acts on all channels and servers running on /// the process. - void BuildAndRegisterGlobal(); + absl::Status BuildAndRegisterGlobal(); private: std::unique_ptr impl_; diff --git a/src/cpp/ext/csm/csm_observability.cc b/src/cpp/ext/csm/csm_observability.cc index 3037b559dae..978442f9278 100644 --- a/src/cpp/ext/csm/csm_observability.cc +++ b/src/cpp/ext/csm/csm_observability.cc @@ -137,7 +137,10 @@ absl::StatusOr CsmObservabilityBuilder::BuildAndRegister() { google::cloud::otel::MakeResourceDetector() ->Detect() .GetAttributes())); - builder_->BuildAndRegisterGlobal(); + auto status = builder_->BuildAndRegisterGlobal(); + if (!status.ok()) { + return status; + } return CsmObservability(); } diff --git a/src/cpp/ext/otel/otel_plugin.cc b/src/cpp/ext/otel/otel_plugin.cc index 8f3593e94f1..d7e5ddb78bb 100644 --- a/src/cpp/ext/otel/otel_plugin.cc +++ b/src/cpp/ext/otel/otel_plugin.cc @@ -163,13 +163,13 @@ OpenTelemetryPluginBuilderImpl& OpenTelemetryPluginBuilderImpl::AddPluginOption( return *this; } -void OpenTelemetryPluginBuilderImpl::BuildAndRegisterGlobal() { +absl::Status OpenTelemetryPluginBuilderImpl::BuildAndRegisterGlobal() { opentelemetry::nostd::shared_ptr meter_provider = meter_provider_; delete g_otel_plugin_state_; g_otel_plugin_state_ = new struct OpenTelemetryPluginState; if (meter_provider == nullptr) { - return; + return absl::OkStatus(); } auto meter = meter_provider->GetMeter("grpc-c++", GRPC_CPP_VERSION_STRING); if (metrics_.contains(grpc::OpenTelemetryPluginBuilder:: @@ -269,6 +269,7 @@ void OpenTelemetryPluginBuilderImpl::BuildAndRegisterGlobal() { args.GetString(GRPC_ARG_SERVER_URI).value_or("")); }); }); + return absl::OkStatus(); } } // namespace internal @@ -331,8 +332,8 @@ OpenTelemetryPluginBuilder& OpenTelemetryPluginBuilder::AddPluginOption( return *this; } -void OpenTelemetryPluginBuilder::BuildAndRegisterGlobal() { - impl_->BuildAndRegisterGlobal(); +absl::Status OpenTelemetryPluginBuilder::BuildAndRegisterGlobal() { + return impl_->BuildAndRegisterGlobal(); } } // namespace grpc diff --git a/src/cpp/ext/otel/otel_plugin.h b/src/cpp/ext/otel/otel_plugin.h index 4ba5054ceda..61264dbb0e6 100644 --- a/src/cpp/ext/otel/otel_plugin.h +++ b/src/cpp/ext/otel/otel_plugin.h @@ -206,7 +206,7 @@ class OpenTelemetryPluginBuilderImpl { generic_method_attribute_filter); OpenTelemetryPluginBuilderImpl& AddPluginOption( std::unique_ptr option); - void BuildAndRegisterGlobal(); + absl::Status BuildAndRegisterGlobal(); private: std::shared_ptr meter_provider_; diff --git a/test/cpp/ext/csm/csm_observability_test.cc b/test/cpp/ext/csm/csm_observability_test.cc index 520c6f4f3c4..60517193aa2 100644 --- a/test/cpp/ext/csm/csm_observability_test.cc +++ b/test/cpp/ext/csm/csm_observability_test.cc @@ -32,8 +32,8 @@ namespace testing { namespace { TEST(CsmObservabilityBuilderTest, Basic) { - EXPECT_TRUE( - experimental::CsmObservabilityBuilder().BuildAndRegister().status().ok()); + EXPECT_EQ(experimental::CsmObservabilityBuilder().BuildAndRegister().status(), + absl::OkStatus()); } TEST(GsmDependencyTest, GoogleCloudOpenTelemetryDependency) { @@ -64,9 +64,11 @@ TEST(CsmChannelTargetSelectorTest, XdsTargetsWithTDAuthority) { } TEST(CsmPluginOptionTest, Basic) { - OpenTelemetryPluginBuilder() - .AddPluginOption(experimental::MakeCsmOpenTelemetryPluginOption()) - .BuildAndRegisterGlobal(); + EXPECT_EQ( + OpenTelemetryPluginBuilder() + .AddPluginOption(experimental::MakeCsmOpenTelemetryPluginOption()) + .BuildAndRegisterGlobal(), + absl::OkStatus()); } } // namespace diff --git a/test/cpp/ext/otel/otel_test_library.cc b/test/cpp/ext/otel/otel_test_library.cc index 1be27d2898b..1daeca3b928 100644 --- a/test/cpp/ext/otel/otel_test_library.cc +++ b/test/cpp/ext/otel/otel_test_library.cc @@ -115,7 +115,7 @@ void OpenTelemetryPluginEnd2EndTest::Init(Options config) { for (auto& option : config.plugin_options) { ot_builder.AddPluginOption(std::move(option)); } - ot_builder.BuildAndRegisterGlobal(); + ASSERT_EQ(ot_builder.BuildAndRegisterGlobal(), absl::OkStatus()); ChannelArguments channel_args; if (!config.labels_to_inject.empty()) { labels_to_inject_ = config.labels_to_inject; diff --git a/test/cpp/interop/observability_client.cc b/test/cpp/interop/observability_client.cc index 6d8e29ebf5c..72822c4a61a 100644 --- a/test/cpp/interop/observability_client.cc +++ b/test/cpp/interop/observability_client.cc @@ -238,7 +238,7 @@ int main(int argc, char** argv) { meter_provider->AddMetricReader(std::move(prometheus_exporter)); grpc::OpenTelemetryPluginBuilder otel_builder; otel_builder.SetMeterProvider(std::move(meter_provider)); - otel_builder.BuildAndRegisterGlobal(); + assert(otel_builder.BuildAndRegisterGlobal().ok()); } grpc::testing::ChannelCreationFunc channel_creation_func; diff --git a/test/cpp/interop/xds_interop_client.cc b/test/cpp/interop/xds_interop_client.cc index a896e07b5c7..55084235f3e 100644 --- a/test/cpp/interop/xds_interop_client.cc +++ b/test/cpp/interop/xds_interop_client.cc @@ -403,10 +403,12 @@ void EnableCsmObservability() { auto meter_provider = std::make_shared(); meter_provider->AddMetricReader(std::move(prometheus_exporter)); - grpc::OpenTelemetryPluginBuilder() - .AddPluginOption(grpc::experimental::MakeCsmOpenTelemetryPluginOption()) - .SetMeterProvider(std::move(meter_provider)) - .BuildAndRegisterGlobal(); + assert(grpc::OpenTelemetryPluginBuilder() + .AddPluginOption( + grpc::experimental::MakeCsmOpenTelemetryPluginOption()) + .SetMeterProvider(std::move(meter_provider)) + .BuildAndRegisterGlobal() + .ok()); } void RunServer(const int port, StatsWatchers* stats_watchers, diff --git a/test/cpp/interop/xds_interop_server.cc b/test/cpp/interop/xds_interop_server.cc index 15dc66e4446..8a66e173bc2 100644 --- a/test/cpp/interop/xds_interop_server.cc +++ b/test/cpp/interop/xds_interop_server.cc @@ -54,10 +54,12 @@ void EnableCsmObservability() { auto meter_provider = std::make_shared(); meter_provider->AddMetricReader(std::move(prometheus_exporter)); - grpc::OpenTelemetryPluginBuilder() - .AddPluginOption(grpc::experimental::MakeCsmOpenTelemetryPluginOption()) - .SetMeterProvider(std::move(meter_provider)) - .BuildAndRegisterGlobal(); + assert(grpc::OpenTelemetryPluginBuilder() + .AddPluginOption( + grpc::experimental::MakeCsmOpenTelemetryPluginOption()) + .SetMeterProvider(std::move(meter_provider)) + .BuildAndRegisterGlobal() + .ok()); } int main(int argc, char** argv) { From 80f3a905565e39d78b4fb5ac0774ec173a927ec1 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Thu, 25 Jan 2024 10:04:06 -0800 Subject: [PATCH 6/8] [Python O11Y] Add observability example (#35637) --- examples/python/Makefile | 4 + examples/python/observability/README.md | 63 +++++++++++++++ .../python/observability/helloworld_pb2.py | 30 +++++++ .../python/observability/helloworld_pb2.pyi | 17 ++++ .../observability/helloworld_pb2_grpc.py | 70 ++++++++++++++++ .../observability_greeter_client.py | 71 ++++++++++++++++ .../observability_greeter_server.py | 80 +++++++++++++++++++ .../observability/open_telemetry_exporter.py | 75 +++++++++++++++++ .../python/observability/requirements.txt | 2 + 9 files changed, 412 insertions(+) create mode 100644 examples/python/observability/README.md create mode 100644 examples/python/observability/helloworld_pb2.py create mode 100644 examples/python/observability/helloworld_pb2.pyi create mode 100644 examples/python/observability/helloworld_pb2_grpc.py create mode 100644 examples/python/observability/observability_greeter_client.py create mode 100644 examples/python/observability/observability_greeter_server.py create mode 100644 examples/python/observability/open_telemetry_exporter.py create mode 100644 examples/python/observability/requirements.txt diff --git a/examples/python/Makefile b/examples/python/Makefile index f0f478d8368..87447c152a5 100644 --- a/examples/python/Makefile +++ b/examples/python/Makefile @@ -84,6 +84,10 @@ ARTIFACTS += compression/helloworld_pb2.py ARTIFACTS += compression/helloworld_pb2_grpc.py ARTIFACTS += compression/helloworld_pb2.pyi +ARTIFACTS += observability/helloworld_pb2.py +ARTIFACTS += observability/helloworld_pb2_grpc.py +ARTIFACTS += observability/helloworld_pb2.pyi + .PHONY: all all: ${ARTIFACTS} diff --git a/examples/python/observability/README.md b/examples/python/observability/README.md new file mode 100644 index 00000000000..09c9f27e525 --- /dev/null +++ b/examples/python/observability/README.md @@ -0,0 +1,63 @@ +gRPC Observability Example +===================== + +The examples here demonstrate how to setup gRPC Python Observability with Opentelemetry. + +More details about how to use gRPC Python Observability APIs can be found in [OpenTelemetry Metrics gRFC](https://github.com/grpc/proposal/blob/master/A66-otel-stats.md#opentelemetry-metrics). + +### Install Requirements + +1. Navigate to this directory: + +```sh +cd examples/python/observability +``` + +2. Install requirements: + +```sh +python -m pip install -r requirements.txt +``` + +### Run the Server + +Start the server: + +```sh +python -m observability_greeter_server +``` + +### Run the Client + +Note that client should start within 10 seconds of the server becoming active. + +```sh +python -m observability_greeter_client +``` + +### Verifying Metrics + +The example will print a list of metric names collected. + +Server Side: + +``` +Server started, listening on 50051 +Metrics exported on Server side: +grpc.server.call.started +grpc.server.call.sent_total_compressed_message_size +grpc.server.call.rcvd_total_compressed_message_size +grpc.server.call.duration +``` + +Client Side: + +``` +Greeter client received: Hello You +Metrics exported on client side: +grpc.client.call.duration +grpc.client.attempt.started +grpc.client.attempt.sent_total_compressed_message_size +grpc.client.attempt.rcvd_total_compressed_message_size +grpc.client.attempt.duration +``` diff --git a/examples/python/observability/helloworld_pb2.py b/examples/python/observability/helloworld_pb2.py new file mode 100644 index 00000000000..f5b4f2d27dc --- /dev/null +++ b/examples/python/observability/helloworld_pb2.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: helloworld.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import builder as _builder +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10helloworld.proto\x12\nhelloworld\"\x1c\n\x0cHelloRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x1d\n\nHelloReply\x12\x0f\n\x07message\x18\x01 \x01(\t2I\n\x07Greeter\x12>\n\x08SayHello\x12\x18.helloworld.HelloRequest\x1a\x16.helloworld.HelloReply\"\x00\x42\x36\n\x1bio.grpc.examples.helloworldB\x0fHelloWorldProtoP\x01\xa2\x02\x03HLWb\x06proto3') + +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'helloworld_pb2', globals()) +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\033io.grpc.examples.helloworldB\017HelloWorldProtoP\001\242\002\003HLW' + _HELLOREQUEST._serialized_start=32 + _HELLOREQUEST._serialized_end=60 + _HELLOREPLY._serialized_start=62 + _HELLOREPLY._serialized_end=91 + _GREETER._serialized_start=93 + _GREETER._serialized_end=166 +# @@protoc_insertion_point(module_scope) diff --git a/examples/python/observability/helloworld_pb2.pyi b/examples/python/observability/helloworld_pb2.pyi new file mode 100644 index 00000000000..8c4b5b22805 --- /dev/null +++ b/examples/python/observability/helloworld_pb2.pyi @@ -0,0 +1,17 @@ +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Optional as _Optional + +DESCRIPTOR: _descriptor.FileDescriptor + +class HelloReply(_message.Message): + __slots__ = ["message"] + MESSAGE_FIELD_NUMBER: _ClassVar[int] + message: str + def __init__(self, message: _Optional[str] = ...) -> None: ... + +class HelloRequest(_message.Message): + __slots__ = ["name"] + NAME_FIELD_NUMBER: _ClassVar[int] + name: str + def __init__(self, name: _Optional[str] = ...) -> None: ... diff --git a/examples/python/observability/helloworld_pb2_grpc.py b/examples/python/observability/helloworld_pb2_grpc.py new file mode 100644 index 00000000000..47c186976e1 --- /dev/null +++ b/examples/python/observability/helloworld_pb2_grpc.py @@ -0,0 +1,70 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +import helloworld_pb2 as helloworld__pb2 + + +class GreeterStub(object): + """The greeting service definition. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SayHello = channel.unary_unary( + '/helloworld.Greeter/SayHello', + request_serializer=helloworld__pb2.HelloRequest.SerializeToString, + response_deserializer=helloworld__pb2.HelloReply.FromString, + ) + + +class GreeterServicer(object): + """The greeting service definition. + """ + + def SayHello(self, request, context): + """Sends a greeting + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_GreeterServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SayHello': grpc.unary_unary_rpc_method_handler( + servicer.SayHello, + request_deserializer=helloworld__pb2.HelloRequest.FromString, + response_serializer=helloworld__pb2.HelloReply.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'helloworld.Greeter', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class Greeter(object): + """The greeting service definition. + """ + + @staticmethod + def SayHello(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/helloworld.Greeter/SayHello', + helloworld__pb2.HelloRequest.SerializeToString, + helloworld__pb2.HelloReply.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/examples/python/observability/observability_greeter_client.py b/examples/python/observability/observability_greeter_client.py new file mode 100644 index 00000000000..25f7d68a4c8 --- /dev/null +++ b/examples/python/observability/observability_greeter_client.py @@ -0,0 +1,71 @@ +# 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. +"""gRPC Python helloworld.Greeter client with observability enabled.""" + +from collections import defaultdict +import logging +import time +from typing import Optional + +import grpc +import grpc_observability +import helloworld_pb2 +import helloworld_pb2_grpc +import open_telemetry_exporter +from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader + +OTEL_EXPORT_INTERVAL_S = 0.5 + + +class BaseOpenTelemetryPlugin(grpc_observability.OpenTelemetryPlugin): + def __init__(self, provider: MeterProvider): + self.provider = provider + + def get_meter_provider(self) -> Optional[MeterProvider]: + return self.provider + + +def run(): + all_metrics = defaultdict(list) + otel_exporter = open_telemetry_exporter.OTelMetricExporter(all_metrics) + reader = PeriodicExportingMetricReader( + exporter=otel_exporter, + export_interval_millis=OTEL_EXPORT_INTERVAL_S * 1000, + ) + provider = MeterProvider(metric_readers=[reader]) + otel_plugin = BaseOpenTelemetryPlugin(provider) + + with grpc_observability.OpenTelemetryObservability(plugins=[otel_plugin]): + with grpc.insecure_channel(target="localhost:50051") as channel: + stub = helloworld_pb2_grpc.GreeterStub(channel) + try: + response = stub.SayHello( + helloworld_pb2.HelloRequest(name="You") + ) + print(f"Greeter client received: {response.message}") + except grpc.RpcError as rpc_error: + print("Call failed with code: ", rpc_error.code()) + + # Sleep to make sure all metrics are exported. + time.sleep(5) + + print("Metrics exported on client side:") + for metric in all_metrics: + print(metric) + + +if __name__ == "__main__": + logging.basicConfig() + run() diff --git a/examples/python/observability/observability_greeter_server.py b/examples/python/observability/observability_greeter_server.py new file mode 100644 index 00000000000..1f5a9689be6 --- /dev/null +++ b/examples/python/observability/observability_greeter_server.py @@ -0,0 +1,80 @@ +# 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. +"""The Python implementation of the GRPC helloworld.Greeter server with observability enabled.""" + +from collections import defaultdict +from concurrent import futures +import logging +import time +from typing import Optional + +import grpc +import grpc_observability +import helloworld_pb2 +import helloworld_pb2_grpc +import open_telemetry_exporter +from opentelemetry.sdk.metrics import MeterProvider +from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader + +_OTEL_EXPORT_INTERVAL_S = 0.5 +_SERVER_PORT = "50051" + + +class BaseOpenTelemetryPlugin(grpc_observability.OpenTelemetryPlugin): + def __init__(self, provider: MeterProvider): + self.provider = provider + + def get_meter_provider(self) -> Optional[MeterProvider]: + return self.provider + + +class Greeter(helloworld_pb2_grpc.GreeterServicer): + def SayHello(self, request, context): + message = request.name + return helloworld_pb2.HelloReply(message=f"Hello {message}") + + +def serve(): + all_metrics = defaultdict(list) + otel_exporter = open_telemetry_exporter.OTelMetricExporter( + all_metrics, print_live=False + ) + reader = PeriodicExportingMetricReader( + exporter=otel_exporter, + export_interval_millis=_OTEL_EXPORT_INTERVAL_S * 1000, + ) + provider = MeterProvider(metric_readers=[reader]) + otel_plugin = BaseOpenTelemetryPlugin(provider) + + with grpc_observability.OpenTelemetryObservability(plugins=[otel_plugin]): + server = grpc.server( + thread_pool=futures.ThreadPoolExecutor(max_workers=10), + ) + helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) + server.add_insecure_port("[::]:" + _SERVER_PORT) + server.start() + print("Server started, listening on " + _SERVER_PORT) + + # Sleep to make sure client made RPC call and all metrics are exported. + time.sleep(10) + print("Metrics exported on Server side:") + for metric in all_metrics: + print(metric) + + server.stop(0) + + +if __name__ == "__main__": + logging.basicConfig() + serve() diff --git a/examples/python/observability/open_telemetry_exporter.py b/examples/python/observability/open_telemetry_exporter.py new file mode 100644 index 00000000000..51260577bfe --- /dev/null +++ b/examples/python/observability/open_telemetry_exporter.py @@ -0,0 +1,75 @@ +# 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. + +from typing import Dict, List + +from opentelemetry.sdk.metrics.export import AggregationTemporality +from opentelemetry.sdk.metrics.export import MetricExportResult +from opentelemetry.sdk.metrics.export import MetricExporter +from opentelemetry.sdk.metrics.export import MetricsData + + +class OTelMetricExporter(MetricExporter): + """Implementation of :class:`MetricExporter` that export metrics to the + provided metric_list. + + all_metrics: A dict whose keys are grpc_observability._opentelemetry_measures.Metric.name, + value is a list of labels recorded for that metric. + An example item of this dict: + {"grpc.client.attempt.started": + [{'grpc.method': 'test/UnaryUnary', 'grpc.target': 'localhost:42517'}, + {'grpc.method': 'other', 'grpc.target': 'localhost:42517'}]} + """ + + def __init__( + self, + all_metrics: Dict[str, List], + preferred_temporality: Dict[type, AggregationTemporality] = None, + preferred_aggregation: Dict[ + type, "opentelemetry.sdk.metrics.view.Aggregation" + ] = None, + print_live: bool = False, + ): + super().__init__( + preferred_temporality=preferred_temporality, + preferred_aggregation=preferred_aggregation, + ) + self._all_metrics = all_metrics + self._print_live = print_live + + def export( + self, + metrics_data: MetricsData, + timeout_millis: float = 10_000, + **kwargs, + ) -> MetricExportResult: + self.record_metric(metrics_data) + return MetricExportResult.SUCCESS + + def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None: + pass + + def force_flush(self, timeout_millis: float = 10_000) -> bool: + return True + + def record_metric(self, metrics_data: MetricsData) -> None: + for resource_metric in metrics_data.resource_metrics: + for scope_metric in resource_metric.scope_metrics: + for metric in scope_metric.metrics: + for data_point in metric.data.data_points: + self._all_metrics[metric.name].append( + data_point.attributes + ) + if self._print_live: + print(f"Metric exporter received: {metric.name}") diff --git a/examples/python/observability/requirements.txt b/examples/python/observability/requirements.txt new file mode 100644 index 00000000000..c20bd70143d --- /dev/null +++ b/examples/python/observability/requirements.txt @@ -0,0 +1,2 @@ +grpcio>=1.62.0 +grpcio-observability>=1.62.0 From bdfacdec7f1c825d0a49c76efd418bd407a04ed3 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Thu, 25 Jan 2024 10:29:33 -0800 Subject: [PATCH 7/8] [Python AIO] Raise resource_exhausted error in case of concurrent RPC limit exceeded (#35376) Fix: https://github.com/grpc/grpc/issues/30424 Currently the implementation of `maximum_concurrent_rpcs` flag in AIO is different with docstring, in implementation, we're waiting for RPCs to finish and continue execution instead of raising `resource_exhausted` as mentioned in docstring. This PR changes the implementation of `maximum_concurrent_rpcs` flag in AIO stack to match the docstring. Closes #35376 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35376 from XuanWang-Amos:fix_aio_concurrent_rpc 5b2b59fb9f1fff03d8b9681681ff98ebd29a4509 PiperOrigin-RevId: 601490418 --- .../grpc/_cython/_cygrpc/aio/server.pxd.pxi | 3 +- .../grpc/_cython/_cygrpc/aio/server.pyx.pxi | 52 ++++++++++--------- .../tests_aio/unit/server_test.py | 29 ++++++++--- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pxd.pxi index ce82592db12..15050e6b21e 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pxd.pxi @@ -72,8 +72,7 @@ cdef enum AioServerStatus: cdef class _ConcurrentRpcLimiter: cdef int _maximum_concurrent_rpcs cdef int _active_rpcs - cdef object _active_rpcs_condition # asyncio.Condition - cdef object _loop # asyncio.EventLoop + cdef bint limiter_concurrency_exceeded cdef class AioServer: diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi index a21c1ec0082..d166bd9fabf 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi @@ -783,7 +783,7 @@ async def _schedule_rpc_coro(object rpc_coro, async def _handle_rpc(list generic_handlers, tuple interceptors, - RPCState rpc_state, object loop): + RPCState rpc_state, object loop, bint concurrency_exceeded): cdef object method_handler # Finds the method handler (application logic) method_handler = await _find_method_handler( @@ -804,6 +804,18 @@ async def _handle_rpc(list generic_handlers, tuple interceptors, ) return + if concurrency_exceeded: + rpc_state.status_sent = True + await _send_error_status_from_server( + rpc_state, + StatusCode.resource_exhausted, + 'Concurrent RPC limit exceeded!', + _IMMUTABLE_EMPTY_METADATA, + rpc_state.create_send_initial_metadata_op_if_not_sent(), + loop + ) + return + # Handles unary-unary case if not method_handler.request_streaming and not method_handler.response_streaming: await _handle_unary_unary_rpc(method_handler, @@ -847,33 +859,23 @@ cdef CallbackFailureHandler SERVER_SHUTDOWN_FAILURE_HANDLER = CallbackFailureHan cdef class _ConcurrentRpcLimiter: - def __cinit__(self, int maximum_concurrent_rpcs, object loop): + def __cinit__(self, int maximum_concurrent_rpcs): if maximum_concurrent_rpcs <= 0: raise ValueError("maximum_concurrent_rpcs should be a postive integer") self._maximum_concurrent_rpcs = maximum_concurrent_rpcs self._active_rpcs = 0 - self._active_rpcs_condition = asyncio.Condition() - self._loop = loop + self.limiter_concurrency_exceeded = False - async def check_before_request_call(self): - await self._active_rpcs_condition.acquire() - try: - predicate = lambda: self._active_rpcs < self._maximum_concurrent_rpcs - await self._active_rpcs_condition.wait_for(predicate) + def check_before_request_call(self): + if self._active_rpcs >= self._maximum_concurrent_rpcs: + self.limiter_concurrency_exceeded = True + else: self._active_rpcs += 1 - finally: - self._active_rpcs_condition.release() - - async def _decrease_active_rpcs_count_with_lock(self): - await self._active_rpcs_condition.acquire() - try: - self._active_rpcs -= 1 - self._active_rpcs_condition.notify() - finally: - self._active_rpcs_condition.release() def _decrease_active_rpcs_count(self, unused_future): - self._loop.create_task(self._decrease_active_rpcs_count_with_lock()) + self._active_rpcs -= 1 + if self._active_rpcs < self._maximum_concurrent_rpcs: + self.limiter_concurrency_exceeded = False def decrease_once_finished(self, object rpc_task): rpc_task.add_done_callback(self._decrease_active_rpcs_count) @@ -915,8 +917,7 @@ cdef class AioServer: self._thread_pool = thread_pool if maximum_concurrent_rpcs is not None: - self._limiter = _ConcurrentRpcLimiter(maximum_concurrent_rpcs, - loop) + self._limiter = _ConcurrentRpcLimiter(maximum_concurrent_rpcs) def add_generic_rpc_handlers(self, object generic_rpc_handlers): self._generic_handlers.extend(generic_rpc_handlers) @@ -959,8 +960,10 @@ cdef class AioServer: if self._status != AIO_SERVER_STATUS_RUNNING: break + concurrency_exceeded = False if self._limiter is not None: - await self._limiter.check_before_request_call() + self._limiter.check_before_request_call() + concurrency_exceeded = self._limiter.limiter_concurrency_exceeded # Accepts new request from Core rpc_state = await self._request_call() @@ -973,7 +976,8 @@ cdef class AioServer: rpc_coro = _handle_rpc(self._generic_handlers, self._interceptors, rpc_state, - self._loop) + self._loop, + concurrency_exceeded) # Fires off a task that listens on the cancellation from client. rpc_task = self._loop.create_task( diff --git a/src/python/grpcio_tests/tests_aio/unit/server_test.py b/src/python/grpcio_tests/tests_aio/unit/server_test.py index 2f2333f1b6d..db6274e4540 100644 --- a/src/python/grpcio_tests/tests_aio/unit/server_test.py +++ b/src/python/grpcio_tests/tests_aio/unit/server_test.py @@ -588,14 +588,29 @@ class TestServer(AioTestBase): coro_wrapper(channel.unary_unary(_BLOCK_BRIEFLY)(_REQUEST)) ) rpc_tasks.append(task) - await_tasks = asyncio.wait( - rpc_tasks, return_when=asyncio.FIRST_EXCEPTION + await_tasks = asyncio.wait(rpc_tasks, return_when=asyncio.ALL_COMPLETED) + + done, _ = await await_tasks + exceptions = [] + for task in done: + exception = task.exception() + if exception: + exceptions.append(exception) + + # Check whether the number of tasks raised RESOURCE_EXHAUSTED is roughly + # 2 * _MAXIMUM_CONCURRENT_RPCS. + self.assertAlmostEqual( + len(exceptions), + 2 * _MAXIMUM_CONCURRENT_RPCS, + delta=_MAXIMUM_CONCURRENT_RPCS, ) - # Each batch took test_constants.SHORT_TIMEOUT /2 - start_time = time.time() - await await_tasks - elapsed_time = time.time() - start_time - self.assertGreater(elapsed_time, test_constants.SHORT_TIMEOUT * 3 / 2) + for exception in exceptions: + self.assertTrue(isinstance(exception, aio.AioRpcError)) + self.assertEqual( + grpc.StatusCode.RESOURCE_EXHAUSTED, exception.code() + ) + self.assertIn("Concurrent RPC limit exceeded", exception.details()) + # Clean-up await channel.close() await server.stop(0) From ab795b0adc34965385c69fb5fd14620094c6f716 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 25 Jan 2024 10:43:58 -0800 Subject: [PATCH 8/8] Revert "[EventEngine] Enable the EventEngine DNS Resolver on Posix (#35573)" (#35667) This reverts commit 6318e9e7e98fa8076dfb78c4446073bc09221c30. Closes #35667 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35667 from ctiller:a 032999b51e548fe68758b3c5a74cbb65435ce5e1 PiperOrigin-RevId: 601495207 --- bazel/experiments.bzl | 12 ++++++------ src/core/lib/experiments/experiments.cc | 2 +- src/core/lib/experiments/experiments.h | 3 +-- src/core/lib/experiments/rollouts.yaml | 2 +- .../ext/filters/census/stats_plugin_end2end_test.cc | 11 ++--------- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/bazel/experiments.bzl b/bazel/experiments.bzl index 101ef62303d..a41430e9d7c 100644 --- a/bazel/experiments.bzl +++ b/bazel/experiments.bzl @@ -218,6 +218,9 @@ EXPERIMENTS = { "bad_client_test": [ "rfc_max_concurrent_streams", ], + "cancel_ares_query_test": [ + "event_engine_dns", + ], "compression_test": [ "v3_compression_filter", ], @@ -254,6 +257,9 @@ EXPERIMENTS = { "logging_test": [ "promise_based_server_call", ], + "resolver_component_tests_runner_invoker": [ + "event_engine_dns", + ], "resource_quota_test": [ "free_large_allocator", "unconstrained_max_quota_buffer_size", @@ -264,9 +270,6 @@ EXPERIMENTS = { ], }, "on": { - "cancel_ares_query_test": [ - "event_engine_dns", - ], "core_end2end_test": [ "event_engine_listener", ], @@ -287,9 +290,6 @@ EXPERIMENTS = { "round_robin_delegate_to_pick_first", "wrr_delegate_to_pick_first", ], - "resolver_component_tests_runner_invoker": [ - "event_engine_dns", - ], "surface_registered_method_lookup": [ "registered_method_lookup_in_transport", ], diff --git a/src/core/lib/experiments/experiments.cc b/src/core/lib/experiments/experiments.cc index aa1d6e14445..3c40e129ae1 100644 --- a/src/core/lib/experiments/experiments.cc +++ b/src/core/lib/experiments/experiments.cc @@ -717,7 +717,7 @@ const ExperimentMetadata g_experiment_metadata[] = { {"event_engine_client", description_event_engine_client, additional_constraints_event_engine_client, nullptr, 0, false, true}, {"event_engine_dns", description_event_engine_dns, - additional_constraints_event_engine_dns, nullptr, 0, true, false}, + additional_constraints_event_engine_dns, nullptr, 0, false, false}, {"event_engine_listener", description_event_engine_listener, additional_constraints_event_engine_listener, nullptr, 0, true, true}, {"free_large_allocator", description_free_large_allocator, diff --git a/src/core/lib/experiments/experiments.h b/src/core/lib/experiments/experiments.h index a27a8c5443b..d631bf357a4 100644 --- a/src/core/lib/experiments/experiments.h +++ b/src/core/lib/experiments/experiments.h @@ -195,8 +195,7 @@ inline bool IsCanaryClientPrivacyEnabled() { return false; } inline bool IsClientIdlenessEnabled() { return true; } inline bool IsClientPrivacyEnabled() { return false; } inline bool IsEventEngineClientEnabled() { return false; } -#define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_DNS -inline bool IsEventEngineDnsEnabled() { return true; } +inline bool IsEventEngineDnsEnabled() { return false; } #define GRPC_EXPERIMENT_IS_INCLUDED_EVENT_ENGINE_LISTENER inline bool IsEventEngineListenerEnabled() { return true; } inline bool IsFreeLargeAllocatorEnabled() { return false; } diff --git a/src/core/lib/experiments/rollouts.yaml b/src/core/lib/experiments/rollouts.yaml index 80ee4676d85..a49bcd7e6af 100644 --- a/src/core/lib/experiments/rollouts.yaml +++ b/src/core/lib/experiments/rollouts.yaml @@ -60,7 +60,7 @@ default: # not tested on iOS at all ios: broken - posix: true + posix: false # TODO(yijiem): resolve when the WindowsEventEngine DNS Resolver is # implemented windows: broken diff --git a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc index f7e1ffa45bc..a75651fd6b6 100644 --- a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc +++ b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc @@ -32,7 +32,6 @@ #include #include -#include "src/core/lib/experiments/experiments.h" #include "src/cpp/ext/filters/census/context.h" #include "src/cpp/ext/filters/census/grpc_plugin.h" #include "src/cpp/ext/filters/census/open_census_call_tracer.h" @@ -663,14 +662,8 @@ TEST_F(StatsPluginEnd2EndTest, auto sent_span_data = GetSpanByName(recorded_spans, absl::StrCat("Sent.", client_method_name_)); ASSERT_NE(sent_span_data, recorded_spans.end()); - // TODO(yijiem): the EventEngine DNS resolver might be faster in getting the - // result before TryCheckResolution and the call would not be queued: - // https://github.com/grpc/grpc/blob/master/src/core/ext/filters/client_channel/client_channel.cc#L2340. - // We could use a FakeResolver and introduce a delay to deflake this test. - if (!grpc_core::IsEventEngineDnsEnabled()) { - EXPECT_TRUE(IsAnnotationPresent(sent_span_data, - "Delayed name resolution complete.")); - } + EXPECT_TRUE( + IsAnnotationPresent(sent_span_data, "Delayed name resolution complete.")); // Check presence of trace annotation for removal from channel's pending // lb pick queue. auto attempt_span_data = GetSpanByName(