Merge remote-tracking branch 'upstream/master' into transport_endpoint_cleanup

pull/36597/head
Mark D. Roth 6 months ago
commit 6bd73e402e
  1. 8
      .github/workflows/pr-auto-fix.yaml
  2. 75
      BUILD
  3. 170
      CMakeLists.txt
  4. 1
      MAINTAINERS.md
  5. 52
      Makefile
  6. 64
      Package.swift
  7. 7
      bazel/experiments.bzl
  8. 158
      build_autogenerated.yaml
  9. 66
      config.m4
  10. 66
      config.w32
  11. 12
      examples/cpp/otel/BUILD
  12. 9
      examples/cpp/otel/CMakeLists.txt
  13. 6
      examples/cpp/otel/greeter_callback_client.cc
  14. 6
      examples/cpp/otel/greeter_callback_server.cc
  15. 50
      examples/cpp/otel/util.cc
  16. 31
      examples/cpp/otel/util.h
  17. 24
      gRPC-C++.podspec
  18. 78
      gRPC-Core.podspec
  19. 64
      grpc.gemspec
  20. 24
      include/grpcpp/ext/otel_plugin.h
  21. 64
      package.xml
  22. 6
      src/core/BUILD
  23. 2
      src/core/channelz/channel_trace.cc
  24. 4
      src/core/channelz/channelz.cc
  25. 12
      src/core/channelz/channelz.h
  26. 3
      src/core/channelz/channelz_registry.cc
  27. 2
      src/core/client_channel/client_channel_filter.cc
  28. 2
      src/core/client_channel/client_channel_filter.h
  29. 2
      src/core/client_channel/config_selector.cc
  30. 2
      src/core/client_channel/config_selector.h
  31. 5
      src/core/client_channel/dynamic_filters.cc
  32. 2
      src/core/client_channel/dynamic_filters.h
  33. 2
      src/core/client_channel/retry_filter.h
  34. 2
      src/core/client_channel/retry_filter_legacy_call_data.cc
  35. 7
      src/core/client_channel/subchannel.cc
  36. 2
      src/core/client_channel/subchannel.h
  37. 2
      src/core/client_channel/subchannel_pool_interface.h
  38. 2
      src/core/client_channel/subchannel_stream_client.cc
  39. 1
      src/core/ext/filters/backend_metrics/backend_metric_filter.cc
  40. 1
      src/core/ext/filters/backend_metrics/backend_metric_filter.h
  41. 1
      src/core/ext/filters/fault_injection/fault_injection_filter.cc
  42. 1
      src/core/ext/filters/fault_injection/fault_injection_filter.h
  43. 1
      src/core/ext/filters/http/client/http_client_filter.cc
  44. 1
      src/core/ext/filters/http/client/http_client_filter.h
  45. 1
      src/core/ext/filters/http/client_authority_filter.cc
  46. 1
      src/core/ext/filters/http/client_authority_filter.h
  47. 2
      src/core/ext/filters/http/message_compress/compression_filter.cc
  48. 2
      src/core/ext/filters/http/message_compress/compression_filter.h
  49. 1
      src/core/ext/filters/http/server/http_server_filter.cc
  50. 1
      src/core/ext/filters/http/server/http_server_filter.h
  51. 1
      src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
  52. 1
      src/core/ext/filters/load_reporting/server_load_reporting_filter.h
  53. 499
      src/core/ext/filters/logging/logging_filter.cc
  54. 77
      src/core/ext/filters/logging/logging_filter.h
  55. 45
      src/core/ext/filters/logging/logging_sink.h
  56. 2
      src/core/ext/filters/message_size/message_size_filter.cc
  57. 2
      src/core/ext/filters/message_size/message_size_filter.h
  58. 1
      src/core/ext/filters/rbac/rbac_filter.cc
  59. 1
      src/core/ext/filters/rbac/rbac_filter.h
  60. 1
      src/core/ext/filters/stateful_session/stateful_session_filter.cc
  61. 1
      src/core/ext/filters/stateful_session/stateful_session_filter.h
  62. 3
      src/core/ext/gcp/metadata_query.cc
  63. 3
      src/core/ext/transport/binder/client/channel_create.cc
  64. 17
      src/core/ext/transport/binder/client/endpoint_binder_pool.cc
  65. 7
      src/core/ext/transport/binder/client/jni_utils.cc
  66. 6
      src/core/ext/transport/binder/transport/binder_transport.cc
  67. 11
      src/core/ext/transport/binder/utils/ndk_binder.cc
  68. 19
      src/core/ext/transport/binder/utils/transport_stream_receiver_impl.cc
  69. 5
      src/core/ext/transport/binder/wire_format/binder_android.cc
  70. 25
      src/core/ext/transport/binder/wire_format/wire_writer.cc
  71. 27
      src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc
  72. 2
      src/core/ext/transport/chttp2/alpn/alpn.cc
  73. 3
      src/core/ext/transport/chttp2/client/chttp2_connector.cc
  74. 19
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  75. 20
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  76. 2
      src/core/ext/transport/chttp2/transport/flow_control.cc
  77. 2
      src/core/ext/transport/chttp2/transport/frame_settings.cc
  78. 6
      src/core/ext/transport/chttp2/transport/hpack_parser_table.cc
  79. 2
      src/core/ext/transport/chttp2/transport/http2_settings.cc
  80. 2
      src/core/ext/transport/chttp2/transport/http2_settings.h
  81. 10
      src/core/ext/transport/chttp2/transport/parsing.cc
  82. 2
      src/core/ext/transport/chttp2/transport/writing.cc
  83. 11
      src/core/ext/transport/inproc/legacy_inproc_transport.cc
  84. 2
      src/core/handshaker/http_connect/http_connect_handshaker.cc
  85. 5
      src/core/handshaker/http_connect/http_proxy_mapper.cc
  86. 2
      src/core/handshaker/security/secure_endpoint.cc
  87. 13
      src/core/lib/address_utils/parse_address.cc
  88. 2
      src/core/lib/avl/avl.h
  89. 2
      src/core/lib/channel/channel_args.cc
  90. 2
      src/core/lib/channel/channel_args.h
  91. 5
      src/core/lib/channel/channel_stack.cc
  92. 2
      src/core/lib/channel/channel_stack.h
  93. 2
      src/core/lib/channel/connected_channel.cc
  94. 7
      src/core/lib/channel/context.h
  95. 301
      src/core/lib/channel/promise_based_filter.h
  96. 2
      src/core/lib/channel/status_util.cc
  97. 2
      src/core/lib/compression/compression.cc
  98. 9
      src/core/lib/compression/message_compress.cc
  99. 2
      src/core/lib/debug/event_log.h
  100. 5
      src/core/lib/debug/trace.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -22,7 +22,7 @@ jobs:
with:
format: YYYYWWd
- name: Cache bazel
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
env:
cache-name: bazel-cache
with:
@ -66,7 +66,7 @@ jobs:
run: test "${{ steps.check.outputs.result }}" = "stay"
# Setup to run sanity suite
- name: Install Python Interpreter
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.8
- name: Install Python Packages
@ -75,7 +75,7 @@ jobs:
sudo apt-get update
sudo apt-get install python3-dev
- name: Check out repository code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
submodules: True
- name: Get the upstream code
@ -90,7 +90,7 @@ jobs:
run: ANDROID_NDK_HOME= ${{ github.workspace }}/tools/distrib/sanitize.sh
# Report back with a PR if things are broken
- name: Create Pull Request
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6.0.0
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
delete-branch: true
branch-suffix: short-commit-hash

75
BUILD

@ -734,31 +734,6 @@ grpc_cc_library(
grpc_cc_library(
name = "gpr",
srcs = [
"//src/core:lib/gpr/alloc.cc",
"//src/core:lib/gpr/android/log.cc",
"//src/core:lib/gpr/iphone/cpu.cc",
"//src/core:lib/gpr/linux/cpu.cc",
"//src/core:lib/gpr/linux/log.cc",
"//src/core:lib/gpr/log.cc",
"//src/core:lib/gpr/msys/tmpfile.cc",
"//src/core:lib/gpr/posix/cpu.cc",
"//src/core:lib/gpr/posix/log.cc",
"//src/core:lib/gpr/posix/string.cc",
"//src/core:lib/gpr/posix/sync.cc",
"//src/core:lib/gpr/posix/time.cc",
"//src/core:lib/gpr/posix/tmpfile.cc",
"//src/core:lib/gpr/string.cc",
"//src/core:lib/gpr/sync.cc",
"//src/core:lib/gpr/sync_abseil.cc",
"//src/core:lib/gpr/time.cc",
"//src/core:lib/gpr/time_precise.cc",
"//src/core:lib/gpr/windows/cpu.cc",
"//src/core:lib/gpr/windows/log.cc",
"//src/core:lib/gpr/windows/string.cc",
"//src/core:lib/gpr/windows/string_util.cc",
"//src/core:lib/gpr/windows/sync.cc",
"//src/core:lib/gpr/windows/time.cc",
"//src/core:lib/gpr/windows/tmpfile.cc",
"//src/core:lib/gprpp/crash.cc",
"//src/core:lib/gprpp/fork.cc",
"//src/core:lib/gprpp/host_port.cc",
@ -768,12 +743,33 @@ grpc_cc_library(
"//src/core:lib/gprpp/time_util.cc",
"//src/core:lib/gprpp/windows/stat.cc",
"//src/core:lib/gprpp/windows/thd.cc",
"//src/core:util/alloc.cc",
"//src/core:util/android/log.cc",
"//src/core:util/iphone/cpu.cc",
"//src/core:util/linux/cpu.cc",
"//src/core:util/linux/log.cc",
"//src/core:util/log.cc",
"//src/core:util/msys/tmpfile.cc",
"//src/core:util/posix/cpu.cc",
"//src/core:util/posix/log.cc",
"//src/core:util/posix/string.cc",
"//src/core:util/posix/sync.cc",
"//src/core:util/posix/time.cc",
"//src/core:util/posix/tmpfile.cc",
"//src/core:util/string.cc",
"//src/core:util/sync.cc",
"//src/core:util/sync_abseil.cc",
"//src/core:util/time.cc",
"//src/core:util/time_precise.cc",
"//src/core:util/windows/cpu.cc",
"//src/core:util/windows/log.cc",
"//src/core:util/windows/string.cc",
"//src/core:util/windows/string_util.cc",
"//src/core:util/windows/sync.cc",
"//src/core:util/windows/time.cc",
"//src/core:util/windows/tmpfile.cc",
],
hdrs = [
"//src/core:lib/gpr/alloc.h",
"//src/core:lib/gpr/string.h",
"//src/core:lib/gpr/time_precise.h",
"//src/core:lib/gpr/tmpfile.h",
"//src/core:lib/gprpp/crash.h",
"//src/core:lib/gprpp/fork.h",
"//src/core:lib/gprpp/host_port.h",
@ -783,6 +779,10 @@ grpc_cc_library(
"//src/core:lib/gprpp/sync.h",
"//src/core:lib/gprpp/thd.h",
"//src/core:lib/gprpp/time_util.h",
"//src/core:util/alloc.h",
"//src/core:util/string.h",
"//src/core:util/time_precise.h",
"//src/core:util/tmpfile.h",
],
external_deps = [
"absl/base",
@ -1307,6 +1307,7 @@ grpc_cc_library(
"include/grpcpp/security/alts_util.h",
],
external_deps = [
"absl/log:log",
"@com_google_protobuf//upb:base",
"@com_google_protobuf//upb:mem",
"@com_google_protobuf//upb:message",
@ -2082,6 +2083,7 @@ grpc_cc_library(
"//src/core:call_final_info",
"//src/core:call_finalization",
"//src/core:call_spine",
"//src/core:cancel_callback",
"//src/core:channel_args",
"//src/core:channel_args_preconditioning",
"//src/core:channel_fwd",
@ -2159,6 +2161,7 @@ grpc_cc_library(
],
external_deps = [
"absl/log:check",
"absl/log:log",
],
language = "c++",
deps = [
@ -2191,6 +2194,9 @@ grpc_cc_library(
"src/cpp/server/load_reporter/load_reporting_service_server_builder_option.cc",
"src/cpp/server/load_reporter/util.cc",
],
external_deps = [
"absl/log:log",
],
language = "c++",
public_hdrs = [
"include/grpcpp/ext/server_load_reporting.h",
@ -2219,6 +2225,7 @@ grpc_cc_library(
],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/memory",
"protobuf_headers",
],
@ -2243,6 +2250,9 @@ grpc_cc_library(
hdrs = [
"src/cpp/server/load_reporter/get_cpu_stats.h",
],
external_deps = [
"absl/log:log",
],
language = "c++",
deps = [
"gpr",
@ -2261,6 +2271,7 @@ grpc_cc_library(
],
external_deps = [
"absl/log:check",
"absl/log:log",
"opencensus-stats",
"opencensus-tags",
"protobuf_headers",
@ -4895,11 +4906,11 @@ grpc_cc_library(
grpc_cc_library(
name = "subprocess",
srcs = [
"//src/core:lib/gpr/subprocess_posix.cc",
"//src/core:lib/gpr/subprocess_windows.cc",
"//src/core:util/subprocess_posix.cc",
"//src/core:util/subprocess_windows.cc",
],
hdrs = [
"//src/core:lib/gpr/subprocess.h",
"//src/core:util/subprocess.h",
],
external_deps = [
"absl/log:check",

170
CMakeLists.txt generated

@ -1458,7 +1458,6 @@ if(gRPC_BUILD_TESTS)
add_dependencies(buildtests_cxx test_core_event_engine_posix_timer_heap_test)
add_dependencies(buildtests_cxx test_core_event_engine_posix_timer_list_test)
add_dependencies(buildtests_cxx test_core_event_engine_slice_buffer_test)
add_dependencies(buildtests_cxx test_core_gpr_time_test)
add_dependencies(buildtests_cxx test_core_gprpp_time_test)
add_dependencies(buildtests_cxx test_core_iomgr_timer_heap_test)
add_dependencies(buildtests_cxx test_core_security_credentials_test)
@ -1468,6 +1467,7 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx test_core_transport_test_suite_chaotic_good_test)
endif()
add_dependencies(buildtests_cxx test_core_util_time_test)
add_dependencies(buildtests_cxx test_cpp_client_credentials_test)
add_dependencies(buildtests_cxx test_cpp_end2end_ssl_credentials_test)
add_dependencies(buildtests_cxx test_cpp_ext_chaotic_good_test)
@ -1661,32 +1661,6 @@ add_library(gpr
src/core/lib/config/config_vars_non_generated.cc
src/core/lib/config/load_config.cc
src/core/lib/event_engine/thread_local.cc
src/core/lib/gpr/alloc.cc
src/core/lib/gpr/android/log.cc
src/core/lib/gpr/atm.cc
src/core/lib/gpr/iphone/cpu.cc
src/core/lib/gpr/linux/cpu.cc
src/core/lib/gpr/linux/log.cc
src/core/lib/gpr/log.cc
src/core/lib/gpr/msys/tmpfile.cc
src/core/lib/gpr/posix/cpu.cc
src/core/lib/gpr/posix/log.cc
src/core/lib/gpr/posix/string.cc
src/core/lib/gpr/posix/sync.cc
src/core/lib/gpr/posix/time.cc
src/core/lib/gpr/posix/tmpfile.cc
src/core/lib/gpr/string.cc
src/core/lib/gpr/sync.cc
src/core/lib/gpr/sync_abseil.cc
src/core/lib/gpr/time.cc
src/core/lib/gpr/time_precise.cc
src/core/lib/gpr/windows/cpu.cc
src/core/lib/gpr/windows/log.cc
src/core/lib/gpr/windows/string.cc
src/core/lib/gpr/windows/string_util.cc
src/core/lib/gpr/windows/sync.cc
src/core/lib/gpr/windows/time.cc
src/core/lib/gpr/windows/tmpfile.cc
src/core/lib/gprpp/crash.cc
src/core/lib/gprpp/examine_stack.cc
src/core/lib/gprpp/fork.cc
@ -1702,6 +1676,32 @@ add_library(gpr
src/core/lib/gprpp/windows/env.cc
src/core/lib/gprpp/windows/stat.cc
src/core/lib/gprpp/windows/thd.cc
src/core/util/alloc.cc
src/core/util/android/log.cc
src/core/util/atm.cc
src/core/util/iphone/cpu.cc
src/core/util/linux/cpu.cc
src/core/util/linux/log.cc
src/core/util/log.cc
src/core/util/msys/tmpfile.cc
src/core/util/posix/cpu.cc
src/core/util/posix/log.cc
src/core/util/posix/string.cc
src/core/util/posix/sync.cc
src/core/util/posix/time.cc
src/core/util/posix/tmpfile.cc
src/core/util/string.cc
src/core/util/sync.cc
src/core/util/sync_abseil.cc
src/core/util/time.cc
src/core/util/time_precise.cc
src/core/util/windows/cpu.cc
src/core/util/windows/log.cc
src/core/util/windows/string.cc
src/core/util/windows/string_util.cc
src/core/util/windows/sync.cc
src/core/util/windows/time.cc
src/core/util/windows/tmpfile.cc
)
target_compile_features(gpr PUBLIC cxx_std_14)
@ -4737,8 +4737,8 @@ endif()
if(gRPC_BUILD_TESTS)
add_library(grpc++_test_util
src/core/lib/gpr/subprocess_posix.cc
src/core/lib/gpr/subprocess_windows.cc
src/core/util/subprocess_posix.cc
src/core/util/subprocess_windows.cc
test/core/end2end/data/client_certs.cc
test/core/end2end/data/server1_cert.cc
test/core/end2end/data/server1_key.cc
@ -6089,8 +6089,8 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(address_sorting_test_unsecure
src/core/lib/gpr/subprocess_posix.cc
src/core/lib/gpr/subprocess_windows.cc
src/core/util/subprocess_posix.cc
src/core/util/subprocess_windows.cc
test/core/test_util/cmdline.cc
test/core/test_util/fuzzer_util.cc
test/core/test_util/grpc_profiler.cc
@ -6313,7 +6313,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(alloc_test
test/core/gpr/alloc_test.cc
test/core/util/alloc_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -7624,8 +7624,8 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(bad_ssl_alpn_test
src/core/lib/gpr/subprocess_posix.cc
src/core/lib/gpr/subprocess_windows.cc
src/core/util/subprocess_posix.cc
src/core/util/subprocess_windows.cc
test/core/bad_ssl/bad_ssl_test.cc
test/core/end2end/cq_verifier.cc
test/core/test_util/cmdline.cc
@ -7680,8 +7680,8 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(bad_ssl_cert_test
src/core/lib/gpr/subprocess_posix.cc
src/core/lib/gpr/subprocess_windows.cc
src/core/util/subprocess_posix.cc
src/core/util/subprocess_windows.cc
test/core/bad_ssl/bad_ssl_test.cc
test/core/end2end/cq_verifier.cc
test/core/test_util/cmdline.cc
@ -11722,7 +11722,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(cpu_test
test/core/gpr/cpu_test.cc
test/core/util/cpu_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -12918,7 +12918,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(env_test
test/core/gpr/env_test.cc
test/core/util/env_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -19118,7 +19118,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(log_test
test/core/gpr/log_test.cc
test/core/util/log_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -28540,7 +28540,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(spinlock_test
test/core/gpr/spinlock_test.cc
test/core/util/spinlock_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -29286,7 +29286,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(string_test
test/core/gpr/string_test.cc
test/core/util/string_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -29371,7 +29371,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(sync_test
test/core/gpr/sync_test.cc
test/core/util/sync_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
@ -29998,48 +29998,6 @@ target_link_libraries(test_core_event_engine_slice_buffer_test
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(test_core_gpr_time_test
test/core/gpr/time_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
target_compile_definitions(test_core_gpr_time_test
PRIVATE
"GPR_DLL_IMPORTS"
"GRPC_DLL_IMPORTS"
)
endif()
endif()
target_compile_features(test_core_gpr_time_test PUBLIC cxx_std_14)
target_include_directories(test_core_gpr_time_test
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(test_core_gpr_time_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
@ -30387,6 +30345,48 @@ endif()
endif()
if(gRPC_BUILD_TESTS)
add_executable(test_core_util_time_test
test/core/util/time_test.cc
)
if(WIN32 AND MSVC)
if(BUILD_SHARED_LIBS)
target_compile_definitions(test_core_util_time_test
PRIVATE
"GPR_DLL_IMPORTS"
"GRPC_DLL_IMPORTS"
)
endif()
endif()
target_compile_features(test_core_util_time_test PUBLIC cxx_std_14)
target_include_directories(test_core_util_time_test
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(test_core_util_time_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
grpc_test_util
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(test_cpp_client_credentials_test
test/cpp/client/credentials_test.cc
test/cpp/util/tls_test_utils.cc
@ -32064,7 +32064,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(useful_test
test/core/gpr/useful_test.cc
test/core/util/useful_test.cc
)
target_compile_features(useful_test PUBLIC cxx_std_14)
target_include_directories(useful_test

@ -40,6 +40,7 @@ for general contribution guidelines.
- [vishalpowar](https://github.com/vishalpowar), Google LLC
- [wenbozhu](https://github.com/wenbozhu), Google LLC
- [yashykt](https://github.com/yashykt), Google LLC
- [yijiem](https://github.com/yijiem), Google LLC
- [ZhouyihaiDing](https://github.com/ZhouyihaiDing), Google LLC
<!-- go/keep-sorted end -->

52
Makefile generated

@ -1141,32 +1141,6 @@ LIBGRPC_SRC = \
src/core/lib/event_engine/work_queue/basic_work_queue.cc \
src/core/lib/experiments/config.cc \
src/core/lib/experiments/experiments.cc \
src/core/lib/gpr/alloc.cc \
src/core/lib/gpr/android/log.cc \
src/core/lib/gpr/atm.cc \
src/core/lib/gpr/iphone/cpu.cc \
src/core/lib/gpr/linux/cpu.cc \
src/core/lib/gpr/linux/log.cc \
src/core/lib/gpr/log.cc \
src/core/lib/gpr/msys/tmpfile.cc \
src/core/lib/gpr/posix/cpu.cc \
src/core/lib/gpr/posix/log.cc \
src/core/lib/gpr/posix/string.cc \
src/core/lib/gpr/posix/sync.cc \
src/core/lib/gpr/posix/time.cc \
src/core/lib/gpr/posix/tmpfile.cc \
src/core/lib/gpr/string.cc \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_abseil.cc \
src/core/lib/gpr/time.cc \
src/core/lib/gpr/time_precise.cc \
src/core/lib/gpr/windows/cpu.cc \
src/core/lib/gpr/windows/log.cc \
src/core/lib/gpr/windows/string.cc \
src/core/lib/gpr/windows/string_util.cc \
src/core/lib/gpr/windows/sync.cc \
src/core/lib/gpr/windows/time.cc \
src/core/lib/gpr/windows/tmpfile.cc \
src/core/lib/gprpp/crash.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
@ -1485,6 +1459,32 @@ LIBGRPC_SRC = \
src/core/tsi/ssl_transport_security_utils.cc \
src/core/tsi/transport_security.cc \
src/core/tsi/transport_security_grpc.cc \
src/core/util/alloc.cc \
src/core/util/android/log.cc \
src/core/util/atm.cc \
src/core/util/iphone/cpu.cc \
src/core/util/linux/cpu.cc \
src/core/util/linux/log.cc \
src/core/util/log.cc \
src/core/util/msys/tmpfile.cc \
src/core/util/posix/cpu.cc \
src/core/util/posix/log.cc \
src/core/util/posix/string.cc \
src/core/util/posix/sync.cc \
src/core/util/posix/time.cc \
src/core/util/posix/tmpfile.cc \
src/core/util/string.cc \
src/core/util/sync.cc \
src/core/util/sync_abseil.cc \
src/core/util/time.cc \
src/core/util/time_precise.cc \
src/core/util/windows/cpu.cc \
src/core/util/windows/log.cc \
src/core/util/windows/string.cc \
src/core/util/windows/string_util.cc \
src/core/util/windows/sync.cc \
src/core/util/windows/time.cc \
src/core/util/windows/tmpfile.cc \
src/core/xds/grpc/certificate_provider_store.cc \
src/core/xds/grpc/file_watcher_certificate_provider_factory.cc \
src/core/xds/grpc/xds_audit_logger_registry.cc \

64
Package.swift generated

@ -1255,38 +1255,6 @@ let package = Package(
"src/core/lib/experiments/config.h",
"src/core/lib/experiments/experiments.cc",
"src/core/lib/experiments/experiments.h",
"src/core/lib/gpr/alloc.cc",
"src/core/lib/gpr/alloc.h",
"src/core/lib/gpr/android/log.cc",
"src/core/lib/gpr/atm.cc",
"src/core/lib/gpr/iphone/cpu.cc",
"src/core/lib/gpr/linux/cpu.cc",
"src/core/lib/gpr/linux/log.cc",
"src/core/lib/gpr/log.cc",
"src/core/lib/gpr/msys/tmpfile.cc",
"src/core/lib/gpr/posix/cpu.cc",
"src/core/lib/gpr/posix/log.cc",
"src/core/lib/gpr/posix/string.cc",
"src/core/lib/gpr/posix/sync.cc",
"src/core/lib/gpr/posix/time.cc",
"src/core/lib/gpr/posix/tmpfile.cc",
"src/core/lib/gpr/spinlock.h",
"src/core/lib/gpr/string.cc",
"src/core/lib/gpr/string.h",
"src/core/lib/gpr/sync.cc",
"src/core/lib/gpr/sync_abseil.cc",
"src/core/lib/gpr/time.cc",
"src/core/lib/gpr/time_precise.cc",
"src/core/lib/gpr/time_precise.h",
"src/core/lib/gpr/tmpfile.h",
"src/core/lib/gpr/useful.h",
"src/core/lib/gpr/windows/cpu.cc",
"src/core/lib/gpr/windows/log.cc",
"src/core/lib/gpr/windows/string.cc",
"src/core/lib/gpr/windows/string_util.cc",
"src/core/lib/gpr/windows/sync.cc",
"src/core/lib/gpr/windows/time.cc",
"src/core/lib/gpr/windows/tmpfile.cc",
"src/core/lib/gprpp/atomic_utils.h",
"src/core/lib/gprpp/bitset.h",
"src/core/lib/gprpp/chunked_vector.h",
@ -1956,6 +1924,38 @@ let package = Package(
"src/core/tsi/transport_security_grpc.cc",
"src/core/tsi/transport_security_grpc.h",
"src/core/tsi/transport_security_interface.h",
"src/core/util/alloc.cc",
"src/core/util/alloc.h",
"src/core/util/android/log.cc",
"src/core/util/atm.cc",
"src/core/util/iphone/cpu.cc",
"src/core/util/linux/cpu.cc",
"src/core/util/linux/log.cc",
"src/core/util/log.cc",
"src/core/util/msys/tmpfile.cc",
"src/core/util/posix/cpu.cc",
"src/core/util/posix/log.cc",
"src/core/util/posix/string.cc",
"src/core/util/posix/sync.cc",
"src/core/util/posix/time.cc",
"src/core/util/posix/tmpfile.cc",
"src/core/util/spinlock.h",
"src/core/util/string.cc",
"src/core/util/string.h",
"src/core/util/sync.cc",
"src/core/util/sync_abseil.cc",
"src/core/util/time.cc",
"src/core/util/time_precise.cc",
"src/core/util/time_precise.h",
"src/core/util/tmpfile.h",
"src/core/util/useful.h",
"src/core/util/windows/cpu.cc",
"src/core/util/windows/log.cc",
"src/core/util/windows/string.cc",
"src/core/util/windows/string_util.cc",
"src/core/util/windows/sync.cc",
"src/core/util/windows/time.cc",
"src/core/util/windows/tmpfile.cc",
"src/core/xds/grpc/certificate_provider_store.cc",
"src/core/xds/grpc/certificate_provider_store.h",
"src/core/xds/grpc/file_watcher_certificate_provider_factory.cc",

@ -31,7 +31,6 @@ EXPERIMENT_ENABLES = {
"monitoring_experiment": "monitoring_experiment",
"multiping": "multiping",
"peer_state_based_framing": "peer_state_based_framing",
"pending_queue_cap": "pending_queue_cap",
"pick_first_new": "pick_first_new",
"promise_based_client_call": "event_engine_client,event_engine_listener,promise_based_client_call",
"chaotic_good": "chaotic_good,event_engine_client,event_engine_listener,promise_based_client_call",
@ -75,6 +74,9 @@ EXPERIMENTS = {
],
},
"on": {
"cancel_ares_query_test": [
"event_engine_dns",
],
"core_end2end_test": [
"event_engine_client",
"event_engine_listener",
@ -91,6 +93,9 @@ EXPERIMENTS = {
"lb_unit_test": [
"pick_first_new",
],
"resolver_component_tests_runner_invoker": [
"event_engine_dns",
],
"xds_end2end_test": [
"pick_first_new",
],

@ -55,11 +55,6 @@ libs:
- src/core/lib/config/config_vars.h
- src/core/lib/config/load_config.h
- src/core/lib/event_engine/thread_local.h
- src/core/lib/gpr/alloc.h
- src/core/lib/gpr/string.h
- src/core/lib/gpr/time_precise.h
- src/core/lib/gpr/tmpfile.h
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/construct_destruct.h
- src/core/lib/gprpp/crash.h
- src/core/lib/gprpp/debug_location.h
@ -76,37 +71,16 @@ libs:
- src/core/lib/gprpp/tchar.h
- src/core/lib/gprpp/thd.h
- src/core/lib/gprpp/time_util.h
- src/core/util/alloc.h
- src/core/util/string.h
- src/core/util/time_precise.h
- src/core/util/tmpfile.h
- src/core/util/useful.h
src:
- src/core/lib/config/config_vars.cc
- src/core/lib/config/config_vars_non_generated.cc
- src/core/lib/config/load_config.cc
- src/core/lib/event_engine/thread_local.cc
- src/core/lib/gpr/alloc.cc
- src/core/lib/gpr/android/log.cc
- src/core/lib/gpr/atm.cc
- src/core/lib/gpr/iphone/cpu.cc
- src/core/lib/gpr/linux/cpu.cc
- src/core/lib/gpr/linux/log.cc
- src/core/lib/gpr/log.cc
- src/core/lib/gpr/msys/tmpfile.cc
- src/core/lib/gpr/posix/cpu.cc
- src/core/lib/gpr/posix/log.cc
- src/core/lib/gpr/posix/string.cc
- src/core/lib/gpr/posix/sync.cc
- src/core/lib/gpr/posix/time.cc
- src/core/lib/gpr/posix/tmpfile.cc
- src/core/lib/gpr/string.cc
- src/core/lib/gpr/sync.cc
- src/core/lib/gpr/sync_abseil.cc
- src/core/lib/gpr/time.cc
- src/core/lib/gpr/time_precise.cc
- src/core/lib/gpr/windows/cpu.cc
- src/core/lib/gpr/windows/log.cc
- src/core/lib/gpr/windows/string.cc
- src/core/lib/gpr/windows/string_util.cc
- src/core/lib/gpr/windows/sync.cc
- src/core/lib/gpr/windows/time.cc
- src/core/lib/gpr/windows/tmpfile.cc
- src/core/lib/gprpp/crash.cc
- src/core/lib/gprpp/examine_stack.cc
- src/core/lib/gprpp/fork.cc
@ -122,6 +96,32 @@ libs:
- src/core/lib/gprpp/windows/env.cc
- src/core/lib/gprpp/windows/stat.cc
- src/core/lib/gprpp/windows/thd.cc
- src/core/util/alloc.cc
- src/core/util/android/log.cc
- src/core/util/atm.cc
- src/core/util/iphone/cpu.cc
- src/core/util/linux/cpu.cc
- src/core/util/linux/log.cc
- src/core/util/log.cc
- src/core/util/msys/tmpfile.cc
- src/core/util/posix/cpu.cc
- src/core/util/posix/log.cc
- src/core/util/posix/string.cc
- src/core/util/posix/sync.cc
- src/core/util/posix/time.cc
- src/core/util/posix/tmpfile.cc
- src/core/util/string.cc
- src/core/util/sync.cc
- src/core/util/sync_abseil.cc
- src/core/util/time.cc
- src/core/util/time_precise.cc
- src/core/util/windows/cpu.cc
- src/core/util/windows/log.cc
- src/core/util/windows/string.cc
- src/core/util/windows/string_util.cc
- src/core/util/windows/sync.cc
- src/core/util/windows/time.cc
- src/core/util/windows/tmpfile.cc
deps:
- absl/base:base
- absl/base:core_headers
@ -882,7 +882,6 @@ libs:
- src/core/lib/event_engine/work_queue/work_queue.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/chunked_vector.h
@ -1214,6 +1213,7 @@ libs:
- src/core/tsi/transport_security.h
- src/core/tsi/transport_security_grpc.h
- src/core/tsi/transport_security_interface.h
- src/core/util/spinlock.h
- src/core/xds/grpc/certificate_provider_store.h
- src/core/xds/grpc/file_watcher_certificate_provider_factory.h
- src/core/xds/grpc/upb_utils.h
@ -2420,7 +2420,6 @@ libs:
- src/core/lib/event_engine/work_queue/work_queue.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/chunked_vector.h
@ -2684,6 +2683,7 @@ libs:
- src/core/tsi/transport_security.h
- src/core/tsi/transport_security_grpc.h
- src/core/tsi/transport_security_interface.h
- src/core/util/spinlock.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
- third_party/upb/upb/mini_descriptor/decode.h
@ -4015,7 +4015,7 @@ libs:
language: c++
public_headers: []
headers:
- src/core/lib/gpr/subprocess.h
- src/core/util/subprocess.h
- test/core/end2end/data/ssl_test_data.h
- test/core/test_util/cmdline.h
- test/core/test_util/evaluate_args_test_util.h
@ -4034,8 +4034,8 @@ libs:
- test/cpp/util/subprocess.h
- test/cpp/util/test_credentials_provider.h
src:
- src/core/lib/gpr/subprocess_posix.cc
- src/core/lib/gpr/subprocess_windows.cc
- src/core/util/subprocess_posix.cc
- src/core/util/subprocess_windows.cc
- test/core/end2end/data/client_certs.cc
- test/core/end2end/data/server1_cert.cc
- test/core/end2end/data/server1_key.cc
@ -4510,7 +4510,6 @@ libs:
- src/core/lib/event_engine/work_queue/work_queue.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/chunked_vector.h
@ -4611,6 +4610,7 @@ libs:
- src/core/lib/promise/activity.h
- src/core/lib/promise/all_ok.h
- src/core/lib/promise/arena_promise.h
- src/core/lib/promise/cancel_callback.h
- src/core/lib/promise/context.h
- src/core/lib/promise/detail/basic_seq.h
- src/core/lib/promise/detail/join_state.h
@ -4730,6 +4730,7 @@ libs:
- src/core/tsi/transport_security.h
- src/core/tsi/transport_security_grpc.h
- src/core/tsi/transport_security_interface.h
- src/core/util/spinlock.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
- third_party/upb/upb/mini_descriptor/decode.h
@ -5281,7 +5282,7 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/subprocess.h
- src/core/util/subprocess.h
- test/core/test_util/cmdline.h
- test/core/test_util/evaluate_args_test_util.h
- test/core/test_util/fuzzer_util.h
@ -5297,8 +5298,8 @@ targets:
- test/cpp/util/string_ref_helper.h
- test/cpp/util/subprocess.h
src:
- src/core/lib/gpr/subprocess_posix.cc
- src/core/lib/gpr/subprocess_windows.cc
- src/core/util/subprocess_posix.cc
- src/core/util/subprocess_windows.cc
- test/core/test_util/cmdline.cc
- test/core/test_util/fuzzer_util.cc
- test/core/test_util/grpc_profiler.cc
@ -5406,7 +5407,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/alloc_test.cc
- test/core/util/alloc_test.cc
deps:
- gtest
- grpc_test_util
@ -5884,7 +5885,7 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/subprocess.h
- src/core/util/subprocess.h
- test/core/end2end/cq_verifier.h
- test/core/test_util/cmdline.h
- test/core/test_util/evaluate_args_test_util.h
@ -5897,8 +5898,8 @@ targets:
- test/core/test_util/slice_splitter.h
- test/core/test_util/tracer_util.h
src:
- src/core/lib/gpr/subprocess_posix.cc
- src/core/lib/gpr/subprocess_windows.cc
- src/core/util/subprocess_posix.cc
- src/core/util/subprocess_windows.cc
- test/core/bad_ssl/bad_ssl_test.cc
- test/core/end2end/cq_verifier.cc
- test/core/test_util/cmdline.cc
@ -5922,7 +5923,7 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/subprocess.h
- src/core/util/subprocess.h
- test/core/end2end/cq_verifier.h
- test/core/test_util/cmdline.h
- test/core/test_util/evaluate_args_test_util.h
@ -5935,8 +5936,8 @@ targets:
- test/core/test_util/slice_splitter.h
- test/core/test_util/tracer_util.h
src:
- src/core/lib/gpr/subprocess_posix.cc
- src/core/lib/gpr/subprocess_windows.cc
- src/core/util/subprocess_posix.cc
- src/core/util/subprocess_windows.cc
- test/core/bad_ssl/bad_ssl_test.cc
- test/core/end2end/cq_verifier.cc
- test/core/test_util/cmdline.cc
@ -6235,8 +6236,8 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/bitset.h
- src/core/util/useful.h
src:
- test/core/gprpp/bitset_test.cc
deps:
@ -6372,7 +6373,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/chunked_vector.h
@ -6438,6 +6438,7 @@ targets:
- src/core/lib/transport/simple_slice_based_metadata.h
- src/core/lib/transport/status_conversion.h
- src/core/lib/transport/timeout_encoding.h
- src/core/util/spinlock.h
- test/core/promise/poll_matcher.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
@ -7660,7 +7661,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/chunked_vector.h
@ -7704,6 +7704,7 @@ targets:
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/util/spinlock.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
- third_party/upb/upb/mini_descriptor/decode.h
@ -8401,7 +8402,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/cpu_test.cc
- test/core/util/cpu_test.cc
deps:
- gtest
- grpc_test_util
@ -8994,7 +8995,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/env_test.cc
- test/core/util/env_test.cc
deps:
- gtest
- grpc_test_util
@ -9173,7 +9174,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/down_cast.h
@ -9201,6 +9201,7 @@ targets:
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/util/spinlock.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
- third_party/upb/upb/mini_descriptor/decode.h
@ -9784,7 +9785,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/cpp_impl_of.h
@ -9829,6 +9829,7 @@ targets:
- src/core/lib/slice/slice_string_helpers.h
- src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/http2_errors.h
- src/core/util/spinlock.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
- third_party/upb/upb/mini_descriptor/decode.h
@ -9915,7 +9916,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/cpp_impl_of.h
@ -9967,6 +9967,7 @@ targets:
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/util/spinlock.h
- test/core/promise/test_wakeup_schedulers.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
@ -11668,7 +11669,6 @@ targets:
- src/core/lib/event_engine/work_queue/work_queue.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/chunked_vector.h
@ -11767,6 +11767,7 @@ targets:
- src/core/lib/promise/activity.h
- src/core/lib/promise/all_ok.h
- src/core/lib/promise/arena_promise.h
- src/core/lib/promise/cancel_callback.h
- src/core/lib/promise/context.h
- src/core/lib/promise/detail/basic_seq.h
- src/core/lib/promise/detail/join_state.h
@ -11861,6 +11862,7 @@ targets:
- src/core/service_config/service_config_call_data.h
- src/core/service_config/service_config_parser.h
- src/core/tsi/alts/handshaker/transport_security_common_api.h
- src/core/util/spinlock.h
- test/core/promise/poll_matcher.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
@ -12160,7 +12162,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/cpp_impl_of.h
@ -12204,6 +12205,7 @@ targets:
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/util/spinlock.h
- test/core/promise/test_context.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
@ -12776,7 +12778,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/log_test.cc
- test/core/util/log_test.cc
deps:
- gtest
- grpc_test_util
@ -12833,7 +12835,6 @@ targets:
- src/core/lib/event_engine/event_engine_context.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/atomic_utils.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/cpp_impl_of.h
@ -12885,6 +12886,7 @@ targets:
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/util/spinlock.h
- test/core/promise/test_wakeup_schedulers.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
@ -14074,7 +14076,6 @@ targets:
- src/core/lib/debug/trace.h
- src/core/lib/experiments/config.h
- src/core/lib/experiments/experiments.h
- src/core/lib/gpr/spinlock.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/manual_constructor.h
- src/core/lib/gprpp/status_helper.h
@ -14091,6 +14092,7 @@ targets:
- src/core/lib/slice/slice_internal.h
- src/core/lib/slice/slice_refcount.h
- src/core/lib/slice/slice_string_helpers.h
- src/core/util/spinlock.h
- third_party/upb/upb/generated_code_support.h
- third_party/upb/upb/mini_descriptor/build_enum.h
- third_party/upb/upb/mini_descriptor/decode.h
@ -18691,7 +18693,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/spinlock_test.cc
- test/core/util/spinlock_test.cc
deps:
- gtest
- grpc_test_util
@ -18986,7 +18988,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/string_test.cc
- test/core/util/string_test.cc
deps:
- gtest
- grpc_test_util
@ -19015,7 +19017,7 @@ targets:
language: c++
headers: []
src:
- test/core/gpr/sync_test.cc
- test/core/util/sync_test.cc
deps:
- gtest
- grpc_test_util
@ -19054,9 +19056,9 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/bitset.h
- src/core/lib/gprpp/table.h
- src/core/util/useful.h
src:
- test/core/gprpp/table_test.cc
deps:
@ -19343,17 +19345,6 @@ targets:
- absl/status:statusor
- absl/utility:utility
- gpr
- name: test_core_gpr_time_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/gpr/time_test.cc
deps:
- gtest
- grpc_test_util
uses_polling: false
- name: test_core_gprpp_time_test
gtest: true
build: test
@ -19525,6 +19516,17 @@ targets:
- linux
- posix
uses_polling: false
- name: test_core_util_time_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/util/time_test.cc
deps:
- gtest
- grpc_test_util
uses_polling: false
- name: test_cpp_client_credentials_test
gtest: true
build: test
@ -20225,8 +20227,8 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/useful.h
- src/core/lib/gprpp/unique_type_name.h
- src/core/util/useful.h
src:
- test/core/gprpp/unique_type_name_test.cc
deps:
@ -20262,9 +20264,9 @@ targets:
build: test
language: c++
headers:
- src/core/lib/gpr/useful.h
- src/core/util/useful.h
src:
- test/core/gpr/useful_test.cc
- test/core/util/useful_test.cc
deps:
- gtest
uses_polling: false

66
config.m4 generated

@ -516,32 +516,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/event_engine/work_queue/basic_work_queue.cc \
src/core/lib/experiments/config.cc \
src/core/lib/experiments/experiments.cc \
src/core/lib/gpr/alloc.cc \
src/core/lib/gpr/android/log.cc \
src/core/lib/gpr/atm.cc \
src/core/lib/gpr/iphone/cpu.cc \
src/core/lib/gpr/linux/cpu.cc \
src/core/lib/gpr/linux/log.cc \
src/core/lib/gpr/log.cc \
src/core/lib/gpr/msys/tmpfile.cc \
src/core/lib/gpr/posix/cpu.cc \
src/core/lib/gpr/posix/log.cc \
src/core/lib/gpr/posix/string.cc \
src/core/lib/gpr/posix/sync.cc \
src/core/lib/gpr/posix/time.cc \
src/core/lib/gpr/posix/tmpfile.cc \
src/core/lib/gpr/string.cc \
src/core/lib/gpr/sync.cc \
src/core/lib/gpr/sync_abseil.cc \
src/core/lib/gpr/time.cc \
src/core/lib/gpr/time_precise.cc \
src/core/lib/gpr/windows/cpu.cc \
src/core/lib/gpr/windows/log.cc \
src/core/lib/gpr/windows/string.cc \
src/core/lib/gpr/windows/string_util.cc \
src/core/lib/gpr/windows/sync.cc \
src/core/lib/gpr/windows/time.cc \
src/core/lib/gpr/windows/tmpfile.cc \
src/core/lib/gprpp/crash.cc \
src/core/lib/gprpp/examine_stack.cc \
src/core/lib/gprpp/fork.cc \
@ -860,6 +834,32 @@ if test "$PHP_GRPC" != "no"; then
src/core/tsi/ssl_transport_security_utils.cc \
src/core/tsi/transport_security.cc \
src/core/tsi/transport_security_grpc.cc \
src/core/util/alloc.cc \
src/core/util/android/log.cc \
src/core/util/atm.cc \
src/core/util/iphone/cpu.cc \
src/core/util/linux/cpu.cc \
src/core/util/linux/log.cc \
src/core/util/log.cc \
src/core/util/msys/tmpfile.cc \
src/core/util/posix/cpu.cc \
src/core/util/posix/log.cc \
src/core/util/posix/string.cc \
src/core/util/posix/sync.cc \
src/core/util/posix/time.cc \
src/core/util/posix/tmpfile.cc \
src/core/util/string.cc \
src/core/util/sync.cc \
src/core/util/sync_abseil.cc \
src/core/util/time.cc \
src/core/util/time_precise.cc \
src/core/util/windows/cpu.cc \
src/core/util/windows/log.cc \
src/core/util/windows/string.cc \
src/core/util/windows/string_util.cc \
src/core/util/windows/sync.cc \
src/core/util/windows/time.cc \
src/core/util/windows/tmpfile.cc \
src/core/xds/grpc/certificate_provider_store.cc \
src/core/xds/grpc/file_watcher_certificate_provider_factory.cc \
src/core/xds/grpc/xds_audit_logger_registry.cc \
@ -1526,13 +1526,6 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/windows)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/event_engine/work_queue)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/experiments)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr/android)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr/iphone)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr/linux)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr/msys)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr/posix)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gpr/windows)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gprpp)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gprpp/linux)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/gprpp/posix)
@ -1606,6 +1599,13 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/alts/zero_copy_frame_protector)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/ssl/key_logging)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/ssl/session_cache)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/android)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/iphone)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/linux)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/msys)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/posix)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/util/windows)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/xds/grpc)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/xds/xds_client)
PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc)

66
config.w32 generated

@ -481,32 +481,6 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\event_engine\\work_queue\\basic_work_queue.cc " +
"src\\core\\lib\\experiments\\config.cc " +
"src\\core\\lib\\experiments\\experiments.cc " +
"src\\core\\lib\\gpr\\alloc.cc " +
"src\\core\\lib\\gpr\\android\\log.cc " +
"src\\core\\lib\\gpr\\atm.cc " +
"src\\core\\lib\\gpr\\iphone\\cpu.cc " +
"src\\core\\lib\\gpr\\linux\\cpu.cc " +
"src\\core\\lib\\gpr\\linux\\log.cc " +
"src\\core\\lib\\gpr\\log.cc " +
"src\\core\\lib\\gpr\\msys\\tmpfile.cc " +
"src\\core\\lib\\gpr\\posix\\cpu.cc " +
"src\\core\\lib\\gpr\\posix\\log.cc " +
"src\\core\\lib\\gpr\\posix\\string.cc " +
"src\\core\\lib\\gpr\\posix\\sync.cc " +
"src\\core\\lib\\gpr\\posix\\time.cc " +
"src\\core\\lib\\gpr\\posix\\tmpfile.cc " +
"src\\core\\lib\\gpr\\string.cc " +
"src\\core\\lib\\gpr\\sync.cc " +
"src\\core\\lib\\gpr\\sync_abseil.cc " +
"src\\core\\lib\\gpr\\time.cc " +
"src\\core\\lib\\gpr\\time_precise.cc " +
"src\\core\\lib\\gpr\\windows\\cpu.cc " +
"src\\core\\lib\\gpr\\windows\\log.cc " +
"src\\core\\lib\\gpr\\windows\\string.cc " +
"src\\core\\lib\\gpr\\windows\\string_util.cc " +
"src\\core\\lib\\gpr\\windows\\sync.cc " +
"src\\core\\lib\\gpr\\windows\\time.cc " +
"src\\core\\lib\\gpr\\windows\\tmpfile.cc " +
"src\\core\\lib\\gprpp\\crash.cc " +
"src\\core\\lib\\gprpp\\examine_stack.cc " +
"src\\core\\lib\\gprpp\\fork.cc " +
@ -825,6 +799,32 @@ if (PHP_GRPC != "no") {
"src\\core\\tsi\\ssl_transport_security_utils.cc " +
"src\\core\\tsi\\transport_security.cc " +
"src\\core\\tsi\\transport_security_grpc.cc " +
"src\\core\\util\\alloc.cc " +
"src\\core\\util\\android\\log.cc " +
"src\\core\\util\\atm.cc " +
"src\\core\\util\\iphone\\cpu.cc " +
"src\\core\\util\\linux\\cpu.cc " +
"src\\core\\util\\linux\\log.cc " +
"src\\core\\util\\log.cc " +
"src\\core\\util\\msys\\tmpfile.cc " +
"src\\core\\util\\posix\\cpu.cc " +
"src\\core\\util\\posix\\log.cc " +
"src\\core\\util\\posix\\string.cc " +
"src\\core\\util\\posix\\sync.cc " +
"src\\core\\util\\posix\\time.cc " +
"src\\core\\util\\posix\\tmpfile.cc " +
"src\\core\\util\\string.cc " +
"src\\core\\util\\sync.cc " +
"src\\core\\util\\sync_abseil.cc " +
"src\\core\\util\\time.cc " +
"src\\core\\util\\time_precise.cc " +
"src\\core\\util\\windows\\cpu.cc " +
"src\\core\\util\\windows\\log.cc " +
"src\\core\\util\\windows\\string.cc " +
"src\\core\\util\\windows\\string_util.cc " +
"src\\core\\util\\windows\\sync.cc " +
"src\\core\\util\\windows\\time.cc " +
"src\\core\\util\\windows\\tmpfile.cc " +
"src\\core\\xds\\grpc\\certificate_provider_store.cc " +
"src\\core\\xds\\grpc\\file_watcher_certificate_provider_factory.cc " +
"src\\core\\xds\\grpc\\xds_audit_logger_registry.cc " +
@ -1663,13 +1663,6 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\windows");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\event_engine\\work_queue");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\experiments");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr\\android");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr\\iphone");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr\\linux");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr\\msys");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr\\posix");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gpr\\windows");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gprpp");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gprpp\\linux");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\gprpp\\posix");
@ -1746,6 +1739,13 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\ssl");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\ssl\\key_logging");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\ssl\\session_cache");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\android");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\iphone");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\linux");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\msys");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\posix");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\util\\windows");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\xds");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\xds\\grpc");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\xds\\xds_client");

@ -14,11 +14,22 @@
licenses(["notice"])
cc_library(
name = "util",
srcs = ["util.cc"],
hdrs = ["util.h"],
deps = [
"//:grpc++",
"@io_opentelemetry_cpp//sdk/src/metrics",
],
)
cc_binary(
name = "greeter_callback_client",
srcs = ["greeter_callback_client.cc"],
defines = ["BAZEL_BUILD"],
deps = [
"util",
"//:grpc++",
"//:grpcpp_otel_plugin",
"//examples/protos:helloworld_cc_grpc",
@ -34,6 +45,7 @@ cc_binary(
srcs = ["greeter_callback_server.cc"],
defines = ["BAZEL_BUILD"],
deps = [
"util",
"//:grpc++",
"//:grpc++_reflection",
"//:grpcpp_otel_plugin",

@ -50,6 +50,7 @@ add_custom_command(
# Include generated *.pb.h files
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
include_directories("${CMAKE_SOURCE_DIR}")
# hw_grpc_proto
add_library(hw_grpc_proto
@ -62,6 +63,13 @@ target_link_libraries(hw_grpc_proto
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
# util
add_library(util
"util.cc")
target_link_libraries(util
opentelemetry-cpp::metrics
${_GRPC_GRPCPP})
# Targets greeter_callback_(client|server)
foreach(_target
greeter_callback_client greeter_callback_server)
@ -75,5 +83,6 @@ foreach(_target
${_REFLECTION}
${_GRPC_GRPCPP}
gRPC::grpcpp_otel_plugin
util
${_PROTOBUF_LIBPROTOBUF})
endforeach()

@ -33,9 +33,11 @@
#include <grpcpp/grpcpp.h>
#ifdef BAZEL_BUILD
#include "examples/cpp/otel/util.h"
#include "examples/protos/helloworld.grpc.pb.h"
#else
#include "helloworld.grpc.pb.h"
#include "util.h"
#endif
ABSL_FLAG(std::string, target, "localhost:50051", "Server address");
@ -110,6 +112,10 @@ int main(int argc, char** argv) {
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
// The default histogram boundaries are not granular enough for RPCs. Override
// the "grpc.client.attempt.duration" view as recommended by
// https://github.com/grpc/proposal/blob/master/A66-otel-stats.md.
AddLatencyView(meter_provider.get(), "grpc.client.attempt.duration", "s");
meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto status = grpc::OpenTelemetryPluginBuilder()
.SetMeterProvider(std::move(meter_provider))

@ -33,9 +33,11 @@
#include <grpcpp/health_check_service_interface.h>
#ifdef BAZEL_BUILD
#include "examples/cpp/otel/util.h"
#include "examples/protos/helloworld.grpc.pb.h"
#else
#include "helloworld.grpc.pb.h"
#include "util.h"
#endif
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
@ -96,6 +98,10 @@ int main(int argc, char** argv) {
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
// The default histogram boundaries are not granular enough for RPCs. Override
// the "grpc.server.call.duration" view as recommended by
// https://github.com/grpc/proposal/blob/master/A66-otel-stats.md.
AddLatencyView(meter_provider.get(), "grpc.server.call.duration", "s");
meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto status = grpc::OpenTelemetryPluginBuilder()
.SetMeterProvider(std::move(meter_provider))

@ -0,0 +1,50 @@
//
//
// 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.
//
//
#ifdef BAZEL_BUILD
#include "examples/cpp/otel/util.h"
#else
#include "util.h"
#endif
#include "opentelemetry/sdk/metrics/view/instrument_selector_factory.h"
#include "opentelemetry/sdk/metrics/view/meter_selector_factory.h"
#include "opentelemetry/sdk/metrics/view/view_factory.h"
#include <grpcpp/grpcpp.h>
void AddLatencyView(opentelemetry::sdk::metrics::MeterProvider* provider,
const std::string& name, const std::string& unit) {
auto histogram_config = std::make_shared<
opentelemetry::sdk::metrics::HistogramAggregationConfig>();
histogram_config->boundaries_ = {
0, 0.00001, 0.00005, 0.0001, 0.0003, 0.0006, 0.0008, 0.001, 0.002,
0.003, 0.004, 0.005, 0.006, 0.008, 0.01, 0.013, 0.016, 0.02,
0.025, 0.03, 0.04, 0.05, 0.065, 0.08, 0.1, 0.13, 0.16,
0.2, 0.25, 0.3, 0.4, 0.5, 0.65, 0.8, 1, 2,
5, 10, 20, 50, 100};
provider->AddView(
opentelemetry::sdk::metrics::InstrumentSelectorFactory::Create(
opentelemetry::sdk::metrics::InstrumentType::kHistogram, name, unit),
opentelemetry::sdk::metrics::MeterSelectorFactory::Create(
"grpc-c++", grpc::Version(), ""),
opentelemetry::sdk::metrics::ViewFactory::Create(
name, "", unit,
opentelemetry::sdk::metrics::AggregationType::kHistogram,
std::move(histogram_config)));
}

@ -0,0 +1,31 @@
//
//
// 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.
//
//
#ifndef GRPCPP_EXAMPLES_CPP_OTEL_UTIL_H
#define GRPCPP_EXAMPLES_CPP_OTEL_UTIL_H
#include <string>
#include "opentelemetry/sdk/metrics/meter_provider.h"
// Helper function that adds view for gRPC latency instrument \a name with unit
// \a unit with bucket boundaries that are more useful for RPCs.
void AddLatencyView(opentelemetry::sdk::metrics::MeterProvider* provider,
const std::string& name, const std::string& unit);
#endif // GRPCPP_EXAMPLES_CPP_OTEL_UTIL_H

24
gRPC-C++.podspec generated

@ -964,12 +964,6 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/work_queue/work_queue.h',
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -1317,6 +1311,12 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security.h',
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.h',
'src/core/util/spinlock.h',
'src/core/util/string.h',
'src/core/util/time_precise.h',
'src/core/util/tmpfile.h',
'src/core/util/useful.h',
'src/core/xds/grpc/certificate_provider_store.h',
'src/core/xds/grpc/file_watcher_certificate_provider_factory.h',
'src/core/xds/grpc/upb_utils.h',
@ -2235,12 +2235,6 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/work_queue/work_queue.h',
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -2588,6 +2582,12 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security.h',
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.h',
'src/core/util/spinlock.h',
'src/core/util/string.h',
'src/core/util/time_precise.h',
'src/core/util/tmpfile.h',
'src/core/util/useful.h',
'src/core/xds/grpc/certificate_provider_store.h',
'src/core/xds/grpc/file_watcher_certificate_provider_factory.h',
'src/core/xds/grpc/upb_utils.h',

78
gRPC-Core.podspec generated

@ -82,7 +82,7 @@ Pod::Spec.new do |s|
' "$(PODS_TARGET_SRCROOT)/third_party/utf8_range"'\
' "$(PODS_TARGET_SRCROOT)/third_party/xxhash"',
# If we don't set these two settings, `include/grpc/support/time.h` and
# `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
# `src/core/util/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
# build.
'USE_HEADERMAP' => 'NO',
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
@ -1374,38 +1374,6 @@ Pod::Spec.new do |s|
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.cc',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.cc',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/android/log.cc',
'src/core/lib/gpr/atm.cc',
'src/core/lib/gpr/iphone/cpu.cc',
'src/core/lib/gpr/linux/cpu.cc',
'src/core/lib/gpr/linux/log.cc',
'src/core/lib/gpr/log.cc',
'src/core/lib/gpr/msys/tmpfile.cc',
'src/core/lib/gpr/posix/cpu.cc',
'src/core/lib/gpr/posix/log.cc',
'src/core/lib/gpr/posix/string.cc',
'src/core/lib/gpr/posix/sync.cc',
'src/core/lib/gpr/posix/time.cc',
'src/core/lib/gpr/posix/tmpfile.cc',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.cc',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/sync.cc',
'src/core/lib/gpr/sync_abseil.cc',
'src/core/lib/gpr/time.cc',
'src/core/lib/gpr/time_precise.cc',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gpr/windows/cpu.cc',
'src/core/lib/gpr/windows/log.cc',
'src/core/lib/gpr/windows/string.cc',
'src/core/lib/gpr/windows/string_util.cc',
'src/core/lib/gpr/windows/sync.cc',
'src/core/lib/gpr/windows/time.cc',
'src/core/lib/gpr/windows/tmpfile.cc',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -2071,6 +2039,38 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security_grpc.cc',
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.cc',
'src/core/util/alloc.h',
'src/core/util/android/log.cc',
'src/core/util/atm.cc',
'src/core/util/iphone/cpu.cc',
'src/core/util/linux/cpu.cc',
'src/core/util/linux/log.cc',
'src/core/util/log.cc',
'src/core/util/msys/tmpfile.cc',
'src/core/util/posix/cpu.cc',
'src/core/util/posix/log.cc',
'src/core/util/posix/string.cc',
'src/core/util/posix/sync.cc',
'src/core/util/posix/time.cc',
'src/core/util/posix/tmpfile.cc',
'src/core/util/spinlock.h',
'src/core/util/string.cc',
'src/core/util/string.h',
'src/core/util/sync.cc',
'src/core/util/sync_abseil.cc',
'src/core/util/time.cc',
'src/core/util/time_precise.cc',
'src/core/util/time_precise.h',
'src/core/util/tmpfile.h',
'src/core/util/useful.h',
'src/core/util/windows/cpu.cc',
'src/core/util/windows/log.cc',
'src/core/util/windows/string.cc',
'src/core/util/windows/string_util.cc',
'src/core/util/windows/sync.cc',
'src/core/util/windows/time.cc',
'src/core/util/windows/tmpfile.cc',
'src/core/xds/grpc/certificate_provider_store.cc',
'src/core/xds/grpc/certificate_provider_store.h',
'src/core/xds/grpc/file_watcher_certificate_provider_factory.cc',
@ -3015,12 +3015,6 @@ Pod::Spec.new do |s|
'src/core/lib/event_engine/work_queue/work_queue.h',
'src/core/lib/experiments/config.h',
'src/core/lib/experiments/experiments.h',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/atomic_utils.h',
'src/core/lib/gprpp/bitset.h',
'src/core/lib/gprpp/chunked_vector.h',
@ -3368,6 +3362,12 @@ Pod::Spec.new do |s|
'src/core/tsi/transport_security.h',
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/transport_security_interface.h',
'src/core/util/alloc.h',
'src/core/util/spinlock.h',
'src/core/util/string.h',
'src/core/util/time_precise.h',
'src/core/util/tmpfile.h',
'src/core/util/useful.h',
'src/core/xds/grpc/certificate_provider_store.h',
'src/core/xds/grpc/file_watcher_certificate_provider_factory.h',
'src/core/xds/grpc/upb_utils.h',

64
grpc.gemspec generated

@ -1261,38 +1261,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/experiments/config.h )
s.files += %w( src/core/lib/experiments/experiments.cc )
s.files += %w( src/core/lib/experiments/experiments.h )
s.files += %w( src/core/lib/gpr/alloc.cc )
s.files += %w( src/core/lib/gpr/alloc.h )
s.files += %w( src/core/lib/gpr/android/log.cc )
s.files += %w( src/core/lib/gpr/atm.cc )
s.files += %w( src/core/lib/gpr/iphone/cpu.cc )
s.files += %w( src/core/lib/gpr/linux/cpu.cc )
s.files += %w( src/core/lib/gpr/linux/log.cc )
s.files += %w( src/core/lib/gpr/log.cc )
s.files += %w( src/core/lib/gpr/msys/tmpfile.cc )
s.files += %w( src/core/lib/gpr/posix/cpu.cc )
s.files += %w( src/core/lib/gpr/posix/log.cc )
s.files += %w( src/core/lib/gpr/posix/string.cc )
s.files += %w( src/core/lib/gpr/posix/sync.cc )
s.files += %w( src/core/lib/gpr/posix/time.cc )
s.files += %w( src/core/lib/gpr/posix/tmpfile.cc )
s.files += %w( src/core/lib/gpr/spinlock.h )
s.files += %w( src/core/lib/gpr/string.cc )
s.files += %w( src/core/lib/gpr/string.h )
s.files += %w( src/core/lib/gpr/sync.cc )
s.files += %w( src/core/lib/gpr/sync_abseil.cc )
s.files += %w( src/core/lib/gpr/time.cc )
s.files += %w( src/core/lib/gpr/time_precise.cc )
s.files += %w( src/core/lib/gpr/time_precise.h )
s.files += %w( src/core/lib/gpr/tmpfile.h )
s.files += %w( src/core/lib/gpr/useful.h )
s.files += %w( src/core/lib/gpr/windows/cpu.cc )
s.files += %w( src/core/lib/gpr/windows/log.cc )
s.files += %w( src/core/lib/gpr/windows/string.cc )
s.files += %w( src/core/lib/gpr/windows/string_util.cc )
s.files += %w( src/core/lib/gpr/windows/sync.cc )
s.files += %w( src/core/lib/gpr/windows/time.cc )
s.files += %w( src/core/lib/gpr/windows/tmpfile.cc )
s.files += %w( src/core/lib/gprpp/atomic_utils.h )
s.files += %w( src/core/lib/gprpp/bitset.h )
s.files += %w( src/core/lib/gprpp/chunked_vector.h )
@ -1958,6 +1926,38 @@ Gem::Specification.new do |s|
s.files += %w( src/core/tsi/transport_security_grpc.cc )
s.files += %w( src/core/tsi/transport_security_grpc.h )
s.files += %w( src/core/tsi/transport_security_interface.h )
s.files += %w( src/core/util/alloc.cc )
s.files += %w( src/core/util/alloc.h )
s.files += %w( src/core/util/android/log.cc )
s.files += %w( src/core/util/atm.cc )
s.files += %w( src/core/util/iphone/cpu.cc )
s.files += %w( src/core/util/linux/cpu.cc )
s.files += %w( src/core/util/linux/log.cc )
s.files += %w( src/core/util/log.cc )
s.files += %w( src/core/util/msys/tmpfile.cc )
s.files += %w( src/core/util/posix/cpu.cc )
s.files += %w( src/core/util/posix/log.cc )
s.files += %w( src/core/util/posix/string.cc )
s.files += %w( src/core/util/posix/sync.cc )
s.files += %w( src/core/util/posix/time.cc )
s.files += %w( src/core/util/posix/tmpfile.cc )
s.files += %w( src/core/util/spinlock.h )
s.files += %w( src/core/util/string.cc )
s.files += %w( src/core/util/string.h )
s.files += %w( src/core/util/sync.cc )
s.files += %w( src/core/util/sync_abseil.cc )
s.files += %w( src/core/util/time.cc )
s.files += %w( src/core/util/time_precise.cc )
s.files += %w( src/core/util/time_precise.h )
s.files += %w( src/core/util/tmpfile.h )
s.files += %w( src/core/util/useful.h )
s.files += %w( src/core/util/windows/cpu.cc )
s.files += %w( src/core/util/windows/log.cc )
s.files += %w( src/core/util/windows/string.cc )
s.files += %w( src/core/util/windows/string_util.cc )
s.files += %w( src/core/util/windows/sync.cc )
s.files += %w( src/core/util/windows/time.cc )
s.files += %w( src/core/util/windows/tmpfile.cc )
s.files += %w( src/core/xds/grpc/certificate_provider_store.cc )
s.files += %w( src/core/xds/grpc/certificate_provider_store.h )
s.files += %w( src/core/xds/grpc/file_watcher_certificate_provider_factory.cc )

@ -88,11 +88,25 @@ class OpenTelemetryPluginBuilder {
/// If `SetMeterProvider()` is not called, no metrics are collected.
OpenTelemetryPluginBuilder& SetMeterProvider(
std::shared_ptr<opentelemetry::metrics::MeterProvider> meter_provider);
/// If set, \a target_attribute_filter is called per channel to decide whether
/// to record the target attribute on client or to replace it with "other".
/// This helps reduce the cardinality on metrics in cases where many channels
/// are created with different targets in the same binary (which might happen
/// for example, if the channel target string uses IP addresses directly).
/// DEPRECATED: If set, \a target_attribute_filter is called per channel to
/// decide whether to record the target attribute on client or to replace it
/// with "other". This helps reduce the cardinality on metrics in cases where
/// many channels are created with different targets in the same binary (which
/// might happen for example, if the channel target string uses IP addresses
/// directly).
/// This filtration only works for the per-call metrics -
/// grpc.client.attempt.started
/// grpc.client.attempt.duration
/// grpc.client.attempt.sent_total_compressed_message_size
/// grpc.client.attempt.rcvd_total_compressed_message_size
/// For example, the grpc.target attribute on pick first lb policy metrics
/// defined in
/// https://github.com/grpc/proposal/blob/master/A78-grpc-metrics-wrr-pf-xds.md
/// will not be filtered. Please contact the grpc team if this filtration is
/// of interest to you.
GRPC_DEPRECATED(
"Does not work as expected. Please raise an issue on "
"https://github.com/grpc/grpc if this would be of use to you.")
OpenTelemetryPluginBuilder& SetTargetAttributeFilter(
absl::AnyInvocable<bool(absl::string_view /*target*/) const>
target_attribute_filter);

64
package.xml generated

@ -1243,38 +1243,6 @@
<file baseinstalldir="/" name="src/core/lib/experiments/config.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/experiments/experiments.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/experiments/experiments.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/alloc.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/alloc.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/android/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/atm.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/iphone/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/linux/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/linux/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/msys/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/posix/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/posix/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/posix/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/posix/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/posix/time.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/posix/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/spinlock.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/string.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/sync_abseil.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/time.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/time_precise.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/time_precise.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/tmpfile.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/useful.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/string_util.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/time.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gpr/windows/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/atomic_utils.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/bitset.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/chunked_vector.h" role="src" />
@ -1940,6 +1908,38 @@
<file baseinstalldir="/" name="src/core/tsi/transport_security_grpc.cc" role="src" />
<file baseinstalldir="/" name="src/core/tsi/transport_security_grpc.h" role="src" />
<file baseinstalldir="/" name="src/core/tsi/transport_security_interface.h" role="src" />
<file baseinstalldir="/" name="src/core/util/alloc.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/alloc.h" role="src" />
<file baseinstalldir="/" name="src/core/util/android/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/atm.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/iphone/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/linux/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/linux/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/msys/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/time.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/posix/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/spinlock.h" role="src" />
<file baseinstalldir="/" name="src/core/util/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/string.h" role="src" />
<file baseinstalldir="/" name="src/core/util/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/sync_abseil.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/time.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/time_precise.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/time_precise.h" role="src" />
<file baseinstalldir="/" name="src/core/util/tmpfile.h" role="src" />
<file baseinstalldir="/" name="src/core/util/useful.h" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/cpu.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/log.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/string.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/string_util.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/sync.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/time.cc" role="src" />
<file baseinstalldir="/" name="src/core/util/windows/tmpfile.cc" role="src" />
<file baseinstalldir="/" name="src/core/xds/grpc/certificate_provider_store.cc" role="src" />
<file baseinstalldir="/" name="src/core/xds/grpc/certificate_provider_store.h" role="src" />
<file baseinstalldir="/" name="src/core/xds/grpc/file_watcher_certificate_provider_factory.cc" role="src" />

@ -238,7 +238,7 @@ grpc_cc_library(
grpc_cc_library(
name = "useful",
hdrs = ["lib/gpr/useful.h"],
hdrs = ["util/useful.h"],
external_deps = [
"absl/strings",
"absl/types:variant",
@ -263,7 +263,7 @@ grpc_cc_library(
grpc_cc_library(
name = "gpr_atm",
srcs = [
"lib/gpr/atm.cc",
"util/atm.cc",
],
language = "c++",
public_hdrs = [
@ -299,7 +299,7 @@ grpc_cc_library(
name = "gpr_spinlock",
srcs = [],
hdrs = [
"lib/gpr/spinlock.h",
"util/spinlock.h",
],
language = "c++",
deps = [

@ -28,10 +28,10 @@
#include <grpc/support/port_platform.h>
#include "src/core/channelz/channelz.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/util/string.h"
namespace grpc_core {
namespace channelz {

@ -37,12 +37,12 @@
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/resolved_address.h"
#include "src/core/lib/json/json_writer.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/uri/uri_parser.h"
#include "src/core/util/string.h"
#include "src/core/util/useful.h"
namespace grpc_core {
namespace channelz {

@ -38,13 +38,13 @@
#include <grpc/support/port_platform.h>
#include "src/core/channelz/channel_trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/per_cpu.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/json/json.h"
#include "src/core/util/time_precise.h"
#include "src/core/util/useful.h"
// Channel arg key for channelz node.
#define GRPC_ARG_CHANNELZ_CHANNEL_NODE "grpc.internal.channelz_channel_node"
@ -72,7 +72,7 @@ class ListenSocketNode;
namespace testing {
class CallCountingHelperPeer;
class ChannelNodePeer;
class SubchannelNodePeer;
} // namespace testing
// base class for all channelz entities
@ -228,9 +228,6 @@ class ChannelNode final : public BaseNode {
void RemoveChildSubchannel(intptr_t child_uuid);
private:
// Allows the channel trace test to access trace_.
friend class testing::ChannelNodePeer;
void PopulateChildRefs(Json::Object* json);
std::string target_;
@ -277,6 +274,9 @@ class SubchannelNode final : public BaseNode {
void RecordCallSucceeded() { call_counter_.RecordCallSucceeded(); }
private:
// Allows the channel trace test to access trace_.
friend class testing::SubchannelNodePeer;
std::atomic<grpc_connectivity_state> connectivity_state_{GRPC_CHANNEL_IDLE};
Mutex socket_mu_;
RefCountedPtr<SocketNode> child_socket_ ABSL_GUARDED_BY(socket_mu_);

@ -25,6 +25,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/grpc.h>
#include <grpc/support/json.h>
@ -171,7 +172,7 @@ void ChannelzRegistry::InternalLogAllEntities() {
}
for (size_t i = 0; i < nodes.size(); ++i) {
std::string json = nodes[i]->RenderJsonString();
gpr_log(GPR_INFO, "%s", json.c_str());
LOG(INFO) << json;
}
}

@ -68,7 +68,6 @@
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/manual_constructor.h"
@ -104,6 +103,7 @@
#include "src/core/resolver/resolver_registry.h"
#include "src/core/service_config/service_config_call_data.h"
#include "src/core/service_config/service_config_impl.h"
#include "src/core/util/useful.h"
//
// Client channel filter

@ -48,7 +48,6 @@
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -71,6 +70,7 @@
#include "src/core/load_balancing/lb_policy.h"
#include "src/core/resolver/resolver.h"
#include "src/core/service_config/service_config.h"
#include "src/core/util/time_precise.h"
//
// Client channel filter

@ -19,7 +19,7 @@
#include "src/core/client_channel/config_selector.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -33,13 +33,13 @@
#include "src/core/client_channel/client_channel_internal.h"
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/service_config/service_config.h"
#include "src/core/util/useful.h"
// Channel arg key for ConfigSelector.
#define GRPC_ARG_CONFIG_SELECTOR "grpc.internal.config_selector"

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include <grpc/support/log.h>
@ -32,10 +33,10 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channel_stack_builder_impl.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/surface/lame_client.h"
#include "src/core/util/alloc.h"
// Conversion between call and call stack.
#define CALL_TO_CALL_STACK(call) \
@ -68,7 +69,7 @@ DynamicFilters::Call::Call(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(channel_stack_->channel_stack_.get(), 1,
Destroy, this, &call_args);
if (GPR_UNLIKELY(!error->ok())) {
gpr_log(GPR_ERROR, "error: %s", StatusToString(*error).c_str());
LOG(ERROR) << "error: " << StatusToString(*error);
return;
}
grpc_call_stack_set_pollset_or_pollset_set(call_stack, args.pollent);

@ -28,7 +28,6 @@
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -39,6 +38,7 @@
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/time_precise.h"
namespace grpc_core {

@ -40,10 +40,10 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/useful.h"
extern grpc_core::TraceFlag grpc_retry_trace;

@ -35,7 +35,6 @@
#include "src/core/lib/channel/context.h"
#include "src/core/lib/channel/status_util.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/construct_destruct.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
@ -54,6 +53,7 @@
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -27,6 +27,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/statusor.h"
#include "absl/strings/cord.h"
#include "absl/strings/str_cat.h"
@ -51,8 +52,6 @@
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/stats_data.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/status_helper.h"
@ -68,6 +67,8 @@
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/alloc.h"
#include "src/core/util/useful.h"
// Backoff parameters.
#define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 1
@ -196,7 +197,7 @@ SubchannelCall::SubchannelCall(Args args, grpc_error_handle* error)
*error = grpc_call_stack_init(connected_subchannel_->channel_stack(), 1,
SubchannelCall::Destroy, this, &call_args);
if (GPR_UNLIKELY(!error->ok())) {
gpr_log(GPR_ERROR, "error: %s", StatusToString(*error).c_str());
LOG(ERROR) << "error: " << StatusToString(*error);
return;
}
grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);

@ -37,7 +37,6 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/dual_ref_counted.h"
#include "src/core/lib/gprpp/orphanable.h"
@ -59,6 +58,7 @@
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/time_precise.h"
namespace grpc_core {

@ -27,10 +27,10 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/resolved_address.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -29,7 +29,6 @@
#include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/sync.h"
@ -37,6 +36,7 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/core/util/time_precise.h"
#define SUBCHANNEL_STREAM_INITIAL_CONNECT_BACKOFF_SECONDS 1
#define SUBCHANNEL_STREAM_RECONNECT_BACKOFF_MULTIPLIER 1.6

@ -52,6 +52,7 @@ TraceFlag grpc_backend_metric_filter_trace(false, "backend_metric_filter");
const NoInterceptor BackendMetricFilter::Call::OnClientInitialMetadata;
const NoInterceptor BackendMetricFilter::Call::OnServerInitialMetadata;
const NoInterceptor BackendMetricFilter::Call::OnClientToServerMessage;
const NoInterceptor BackendMetricFilter::Call::OnClientToServerHalfClose;
const NoInterceptor BackendMetricFilter::Call::OnServerToClientMessage;
const NoInterceptor BackendMetricFilter::Call::OnFinalize;

@ -44,6 +44,7 @@ class BackendMetricFilter : public ImplementChannelFilter<BackendMetricFilter> {
static const NoInterceptor OnServerInitialMetadata;
void OnServerTrailingMetadata(ServerMetadata& md);
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;
};

@ -58,6 +58,7 @@ TraceFlag grpc_fault_injection_filter_trace(false, "fault_injection_filter");
const NoInterceptor FaultInjectionFilter::Call::OnServerInitialMetadata;
const NoInterceptor FaultInjectionFilter::Call::OnServerTrailingMetadata;
const NoInterceptor FaultInjectionFilter::Call::OnClientToServerMessage;
const NoInterceptor FaultInjectionFilter::Call::OnClientToServerHalfClose;
const NoInterceptor FaultInjectionFilter::Call::OnServerToClientMessage;
const NoInterceptor FaultInjectionFilter::Call::OnFinalize;

@ -58,6 +58,7 @@ class FaultInjectionFilter
static const NoInterceptor OnServerInitialMetadata;
static const NoInterceptor OnServerTrailingMetadata;
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;
};

@ -54,6 +54,7 @@ namespace grpc_core {
const NoInterceptor HttpClientFilter::Call::OnServerToClientMessage;
const NoInterceptor HttpClientFilter::Call::OnClientToServerMessage;
const NoInterceptor HttpClientFilter::Call::OnClientToServerHalfClose;
const NoInterceptor HttpClientFilter::Call::OnFinalize;
const grpc_channel_filter HttpClientFilter::kFilter =

@ -47,6 +47,7 @@ class HttpClientFilter : public ImplementChannelFilter<HttpClientFilter> {
absl::Status OnServerInitialMetadata(ServerMetadata& md);
absl::Status OnServerTrailingMetadata(ServerMetadata& md);
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;
};

@ -40,6 +40,7 @@ namespace grpc_core {
const NoInterceptor ClientAuthorityFilter::Call::OnServerInitialMetadata;
const NoInterceptor ClientAuthorityFilter::Call::OnServerTrailingMetadata;
const NoInterceptor ClientAuthorityFilter::Call::OnClientToServerMessage;
const NoInterceptor ClientAuthorityFilter::Call::OnClientToServerHalfClose;
const NoInterceptor ClientAuthorityFilter::Call::OnServerToClientMessage;
const NoInterceptor ClientAuthorityFilter::Call::OnFinalize;

@ -52,6 +52,7 @@ class ClientAuthorityFilter final
static const NoInterceptor OnServerInitialMetadata;
static const NoInterceptor OnServerTrailingMetadata;
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;
};

@ -57,8 +57,10 @@
namespace grpc_core {
const NoInterceptor ServerCompressionFilter::Call::OnClientToServerHalfClose;
const NoInterceptor ServerCompressionFilter::Call::OnServerTrailingMetadata;
const NoInterceptor ServerCompressionFilter::Call::OnFinalize;
const NoInterceptor ClientCompressionFilter::Call::OnClientToServerHalfClose;
const NoInterceptor ClientCompressionFilter::Call::OnServerTrailingMetadata;
const NoInterceptor ClientCompressionFilter::Call::OnFinalize;

@ -129,6 +129,7 @@ class ClientCompressionFilter final
absl::StatusOr<MessageHandle> OnServerToClientMessage(
MessageHandle message, ClientCompressionFilter* filter);
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerTrailingMetadata;
static const NoInterceptor OnFinalize;
@ -165,6 +166,7 @@ class ServerCompressionFilter final
MessageHandle OnServerToClientMessage(MessageHandle message,
ServerCompressionFilter* filter);
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerTrailingMetadata;
static const NoInterceptor OnFinalize;

@ -50,6 +50,7 @@
namespace grpc_core {
const NoInterceptor HttpServerFilter::Call::OnClientToServerMessage;
const NoInterceptor HttpServerFilter::Call::OnClientToServerHalfClose;
const NoInterceptor HttpServerFilter::Call::OnServerToClientMessage;
const NoInterceptor HttpServerFilter::Call::OnFinalize;

@ -50,6 +50,7 @@ class HttpServerFilter : public ImplementChannelFilter<HttpServerFilter> {
void OnServerInitialMetadata(ServerMetadata& md);
void OnServerTrailingMetadata(ServerMetadata& md);
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;
};

@ -74,6 +74,7 @@ constexpr char kEmptyAddressLengthString[] = "00";
const NoInterceptor ServerLoadReportingFilter::Call::OnServerInitialMetadata;
const NoInterceptor ServerLoadReportingFilter::Call::OnClientToServerMessage;
const NoInterceptor ServerLoadReportingFilter::Call::OnClientToServerHalfClose;
const NoInterceptor ServerLoadReportingFilter::Call::OnServerToClientMessage;
absl::StatusOr<std::unique_ptr<ServerLoadReportingFilter>>

@ -54,6 +54,7 @@ class ServerLoadReportingFilter
void OnServerTrailingMetadata(ServerMetadata& md,
ServerLoadReportingFilter* filter);
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
void OnFinalize(const grpc_call_final_info* final_info,
ServerLoadReportingFilter* filter);

@ -31,6 +31,7 @@
#include <utility>
#include <vector>
#include "absl/log/log.h"
#include "absl/numeric/int128.h"
#include "absl/random/random.h"
#include "absl/random/uniform_int_distribution.h"
@ -73,6 +74,9 @@
namespace grpc_core {
const NoInterceptor ClientLoggingFilter::Call::OnFinalize;
const NoInterceptor ServerLoggingFilter::Call::OnFinalize;
namespace {
LoggingSink* g_logging_sink = nullptr;
@ -157,7 +161,7 @@ LoggingSink::Entry::Address PeerStringToAddress(const Slice& peer_string) {
LoggingSink::Entry::Address address;
absl::StatusOr<URI> uri = URI::Parse(peer_string.as_string_view());
if (!uri.ok()) {
gpr_log(GPR_DEBUG, "peer_string is in invalid format and cannot be logged");
VLOG(2) << "peer_string is in invalid format and cannot be logged";
return address;
}
@ -195,152 +199,148 @@ void EncodeMessageToPayload(const SliceBuffer* message, uint32_t log_len,
}
}
class CallData {
public:
CallData(bool is_client, const CallArgs& call_args,
const std::string& authority)
: call_id_(GetCallId()) {
absl::string_view path;
if (auto* value = call_args.client_initial_metadata->get_pointer(
HttpPathMetadata())) {
path = value->as_string_view();
}
std::vector<std::string> parts =
absl::StrSplit(path, '/', absl::SkipEmpty());
if (parts.size() == 2) {
service_name_ = std::move(parts[0]);
method_name_ = std::move(parts[1]);
} // namespace
namespace logging_filter_detail {
CallData::CallData(bool is_client,
const ClientMetadata& client_initial_metadata,
const std::string& authority)
: call_id_(GetCallId()) {
absl::string_view path;
if (auto* value = client_initial_metadata.get_pointer(HttpPathMetadata())) {
path = value->as_string_view();
}
std::vector<std::string> parts = absl::StrSplit(path, '/', absl::SkipEmpty());
if (parts.size() == 2) {
service_name_ = std::move(parts[0]);
method_name_ = std::move(parts[1]);
}
config_ = g_logging_sink->FindMatch(is_client, service_name_, method_name_);
if (config_.ShouldLog()) {
if (auto* value =
client_initial_metadata.get_pointer(HttpAuthorityMetadata())) {
authority_ = std::string(value->as_string_view());
} else {
authority_ = authority;
}
config_ = g_logging_sink->FindMatch(is_client, service_name_, method_name_);
if (config_.ShouldLog()) {
if (auto* value = call_args.client_initial_metadata->get_pointer(
HttpAuthorityMetadata())) {
authority_ = std::string(value->as_string_view());
} else {
authority_ = authority;
}
}
}
void CallData::LogClientHeader(bool is_client,
CallTracerAnnotationInterface* tracer,
const ClientMetadata& metadata) {
LoggingSink::Entry entry;
if (!is_client) {
if (auto* value = metadata.get_pointer(PeerString())) {
peer_ = PeerStringToAddress(*value);
}
}
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kClientHeader);
MetadataEncoder encoder(&entry.payload, nullptr,
config_.max_metadata_bytes());
metadata.Encode(&encoder);
entry.payload_truncated = encoder.truncated();
g_logging_sink->LogEntry(std::move(entry));
}
bool ShouldLog() { return config_.ShouldLog(); }
void CallData::LogClientHalfClose(bool is_client,
CallTracerAnnotationInterface* tracer) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kClientHalfClose);
g_logging_sink->LogEntry(std::move(entry));
}
void LogClientHeader(bool is_client, CallTracerAnnotationInterface* tracer,
const ClientMetadataHandle& metadata) {
LoggingSink::Entry entry;
if (!is_client) {
void CallData::LogServerHeader(bool is_client,
CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata) {
LoggingSink::Entry entry;
if (metadata != nullptr) {
entry.is_trailer_only = metadata->get(GrpcTrailersOnly()).value_or(false);
if (is_client) {
if (auto* value = metadata->get_pointer(PeerString())) {
peer_ = PeerStringToAddress(*value);
}
}
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kClientHeader);
}
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerHeader);
if (metadata != nullptr) {
MetadataEncoder encoder(&entry.payload, nullptr,
config_.max_metadata_bytes());
metadata->Encode(&encoder);
entry.payload_truncated = encoder.truncated();
g_logging_sink->LogEntry(std::move(entry));
}
void LogClientHalfClose(bool is_client,
CallTracerAnnotationInterface* tracer) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kClientHalfClose);
g_logging_sink->LogEntry(std::move(entry));
}
void LogServerHeader(bool is_client, CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata) {
LoggingSink::Entry entry;
if (metadata != nullptr) {
entry.is_trailer_only = metadata->get(GrpcTrailersOnly()).value_or(false);
if (is_client) {
if (auto* value = metadata->get_pointer(PeerString())) {
peer_ = PeerStringToAddress(*value);
}
}
}
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerHeader);
if (metadata != nullptr) {
MetadataEncoder encoder(&entry.payload, nullptr,
config_.max_metadata_bytes());
metadata->Encode(&encoder);
entry.payload_truncated = encoder.truncated();
}
g_logging_sink->LogEntry(std::move(entry));
}
g_logging_sink->LogEntry(std::move(entry));
}
void LogServerTrailer(bool is_client, CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerTrailer);
if (metadata != nullptr) {
entry.is_trailer_only = metadata->get(GrpcTrailersOnly()).value_or(false);
MetadataEncoder encoder(&entry.payload, &entry.payload.status_details,
config_.max_metadata_bytes());
metadata->Encode(&encoder);
entry.payload_truncated = encoder.truncated();
}
g_logging_sink->LogEntry(std::move(entry));
void CallData::LogServerTrailer(bool is_client,
CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerTrailer);
if (metadata != nullptr) {
entry.is_trailer_only = metadata->get(GrpcTrailersOnly()).value_or(false);
MetadataEncoder encoder(&entry.payload, &entry.payload.status_details,
config_.max_metadata_bytes());
metadata->Encode(&encoder);
entry.payload_truncated = encoder.truncated();
}
g_logging_sink->LogEntry(std::move(entry));
}
void LogClientMessage(bool is_client, CallTracerAnnotationInterface* tracer,
const SliceBuffer* message) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kClientMessage);
EncodeMessageToPayload(message, config_.max_message_bytes(), &entry);
g_logging_sink->LogEntry(std::move(entry));
}
void CallData::LogClientMessage(bool is_client,
CallTracerAnnotationInterface* tracer,
const SliceBuffer* message) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kClientMessage);
EncodeMessageToPayload(message, config_.max_message_bytes(), &entry);
g_logging_sink->LogEntry(std::move(entry));
}
void LogServerMessage(bool is_client, CallTracerAnnotationInterface* tracer,
const SliceBuffer* message) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerMessage);
EncodeMessageToPayload(message, config_.max_message_bytes(), &entry);
g_logging_sink->LogEntry(std::move(entry));
}
void CallData::LogServerMessage(bool is_client,
CallTracerAnnotationInterface* tracer,
const SliceBuffer* message) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kServerMessage);
EncodeMessageToPayload(message, config_.max_message_bytes(), &entry);
g_logging_sink->LogEntry(std::move(entry));
}
void LogCancel(bool is_client, CallTracerAnnotationInterface* tracer) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kCancel);
g_logging_sink->LogEntry(std::move(entry));
}
void CallData::LogCancel(bool is_client,
CallTracerAnnotationInterface* tracer) {
LoggingSink::Entry entry;
SetCommonEntryFields(&entry, is_client, tracer,
LoggingSink::Entry::EventType::kCancel);
g_logging_sink->LogEntry(std::move(entry));
}
private:
void SetCommonEntryFields(LoggingSink::Entry* entry, bool is_client,
CallTracerAnnotationInterface* tracer,
LoggingSink::Entry::EventType event_type) {
entry->call_id = call_id_;
entry->sequence_id = sequence_id_++;
entry->type = event_type;
entry->logger = is_client ? LoggingSink::Entry::Logger::kClient
: LoggingSink::Entry::Logger::kServer;
entry->authority = authority_;
entry->peer = peer_;
entry->service_name = service_name_;
entry->method_name = method_name_;
entry->timestamp = Timestamp::Now();
if (tracer != nullptr) {
entry->trace_id = tracer->TraceId();
entry->span_id = tracer->SpanId();
entry->is_sampled = tracer->IsSampled();
}
void CallData::SetCommonEntryFields(LoggingSink::Entry* entry, bool is_client,
CallTracerAnnotationInterface* tracer,
LoggingSink::Entry::EventType event_type) {
entry->call_id = call_id_;
entry->sequence_id = sequence_id_++;
entry->type = event_type;
entry->logger = is_client ? LoggingSink::Entry::Logger::kClient
: LoggingSink::Entry::Logger::kServer;
entry->authority = authority_;
entry->peer = peer_;
entry->service_name = service_name_;
entry->method_name = method_name_;
entry->timestamp = Timestamp::Now();
if (tracer != nullptr) {
entry->trace_id = tracer->TraceId();
entry->span_id = tracer->SpanId();
entry->is_sampled = tracer->IsSampled();
}
absl::uint128 call_id_;
uint32_t sequence_id_ = 0;
std::string service_name_;
std::string method_name_;
std::string authority_;
LoggingSink::Entry::Address peer_;
LoggingSink::Config config_;
};
}
} // namespace
} // namespace logging_filter_detail
absl::StatusOr<std::unique_ptr<ClientLoggingFilter>>
ClientLoggingFilter::Create(const ChannelArgs& args,
@ -361,84 +361,57 @@ ClientLoggingFilter::Create(const ChannelArgs& args,
return std::make_unique<ClientLoggingFilter>("");
}
// Construct a promise for one call.
ArenaPromise<ServerMetadataHandle> ClientLoggingFilter::MakeCallPromise(
CallArgs call_args, NextPromiseFactory next_promise_factory) {
CallData* calld = GetContext<Arena>()->ManagedNew<CallData>(
true, call_args, default_authority_);
if (!calld->ShouldLog()) {
return next_promise_factory(std::move(call_args));
void ClientLoggingFilter::Call::OnClientInitialMetadata(
ClientMetadata& md, ClientLoggingFilter* filter) {
call_data_.emplace(true, md, filter->default_authority_);
if (!call_data_->ShouldLog()) {
call_data_.reset();
return;
}
call_data_->LogClientHeader(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(), md);
}
void ClientLoggingFilter::Call::OnServerInitialMetadata(ServerMetadata& md) {
if (!call_data_.has_value()) return;
call_data_->LogServerHeader(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ClientLoggingFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
if (!call_data_.has_value()) return;
if (md.get(GrpcCallWasCancelled()).value_or(false) &&
md.get(GrpcStatusMetadata()) == GRPC_STATUS_CANCELLED) {
call_data_->LogCancel(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>());
return;
}
calld->LogClientHeader(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
call_args.client_initial_metadata);
call_args.server_initial_metadata->InterceptAndMap(
[calld](ServerMetadataHandle metadata) {
calld->LogServerHeader(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
metadata.get());
return metadata;
});
call_args.client_to_server_messages->InterceptAndMapWithHalfClose(
[calld](MessageHandle message) {
calld->LogClientMessage(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
message->payload());
return message;
},
[calld] {
calld->LogClientHalfClose(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value));
});
call_args.server_to_client_messages->InterceptAndMap(
[calld](MessageHandle message) {
calld->LogServerMessage(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
message->payload());
return message;
});
return OnCancel(
Map(next_promise_factory(std::move(call_args)),
[calld](ServerMetadataHandle md) {
calld->LogServerTrailer(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
md.get());
return md;
}),
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
// valid for the cancellation function requiring us to capture it here.
// This ought to be easy to fix once client side promises are completely
// rolled out.
[calld, ctx = GetContext<grpc_call_context_element>()]() {
calld->LogCancel(
/*is_client=*/true,
static_cast<CallTracerAnnotationInterface*>(
ctx[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE].value));
});
call_data_->LogServerTrailer(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ClientLoggingFilter::Call::OnClientToServerMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogClientMessage(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
void ClientLoggingFilter::Call::OnClientToServerHalfClose() {
if (!call_data_.has_value()) return;
call_data_->LogClientHalfClose(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>());
}
void ClientLoggingFilter::Call::OnServerToClientMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogServerMessage(
/*is_client=*/true, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
const grpc_channel_filter ClientLoggingFilter::kFilter =
@ -454,79 +427,57 @@ ServerLoggingFilter::Create(const ChannelArgs& /*args*/,
}
// Construct a promise for one call.
ArenaPromise<ServerMetadataHandle> ServerLoggingFilter::MakeCallPromise(
CallArgs call_args, NextPromiseFactory next_promise_factory) {
CallData* calld = GetContext<Arena>()->ManagedNew<CallData>(
false, call_args, /*default_authority=*/"");
if (!calld->ShouldLog()) {
return next_promise_factory(std::move(call_args));
void ServerLoggingFilter::Call::OnClientInitialMetadata(ClientMetadata& md) {
call_data_.emplace(false, md, "");
if (!call_data_->ShouldLog()) {
call_data_.reset();
return;
}
auto* call_tracer = static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value);
calld->LogClientHeader(
/*is_client=*/false, call_tracer, call_args.client_initial_metadata);
call_args.server_initial_metadata->InterceptAndMap(
[calld](ServerMetadataHandle metadata) {
calld->LogServerHeader(
/*is_client=*/false,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
metadata.get());
return metadata;
});
call_args.client_to_server_messages->InterceptAndMapWithHalfClose(
[calld](MessageHandle message) {
calld->LogClientMessage(
/*is_client=*/false,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
message->payload());
return message;
},
[calld] {
calld->LogClientHalfClose(
/*is_client=*/false,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value));
});
call_args.server_to_client_messages->InterceptAndMap(
[calld](MessageHandle message) {
calld->LogServerMessage(
/*is_client=*/false,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
message->payload());
return message;
});
return OnCancel(
Map(next_promise_factory(std::move(call_args)),
[calld](ServerMetadataHandle md) {
calld->LogServerTrailer(
/*is_client=*/false,
static_cast<CallTracerAnnotationInterface*>(
GetContext<grpc_call_context_element>()
[GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE]
.value),
md.get());
return md;
}),
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
// valid for the cancellation function requiring us to capture
// call_tracer.
[calld, call_tracer]() {
calld->LogCancel(
/*is_client=*/false, call_tracer);
});
call_data_->LogClientHeader(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
md);
}
void ServerLoggingFilter::Call::OnServerInitialMetadata(ServerMetadata& md) {
if (!call_data_.has_value()) return;
call_data_->LogServerHeader(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ServerLoggingFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) {
if (!call_data_.has_value()) return;
if (md.get(GrpcCallWasCancelled()).value_or(false) &&
md.get(GrpcStatusMetadata()) == GRPC_STATUS_CANCELLED) {
call_data_->LogCancel(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>());
return;
}
call_data_->LogServerTrailer(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
&md);
}
void ServerLoggingFilter::Call::OnClientToServerMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogClientMessage(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
void ServerLoggingFilter::Call::OnClientToServerHalfClose() {
if (!call_data_.has_value()) return;
call_data_->LogClientHalfClose(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>());
}
void ServerLoggingFilter::Call::OnServerToClientMessage(
const Message& message) {
if (!call_data_.has_value()) return;
call_data_->LogServerMessage(
/*is_client=*/false, MaybeGetContext<CallTracerAnnotationInterface>(),
message.payload());
}
const grpc_channel_filter ServerLoggingFilter::kFilter =

@ -35,7 +35,46 @@
namespace grpc_core {
class ClientLoggingFilter final : public ChannelFilter {
namespace logging_filter_detail {
class CallData {
public:
CallData(bool is_client, const ClientMetadata& client_initial_metadata,
const std::string& authority);
bool ShouldLog() { return config_.ShouldLog(); }
void LogClientHeader(bool is_client, CallTracerAnnotationInterface* tracer,
const ClientMetadata& metadata);
void LogClientHalfClose(bool is_client,
CallTracerAnnotationInterface* tracer);
void LogServerHeader(bool is_client, CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata);
void LogServerTrailer(bool is_client, CallTracerAnnotationInterface* tracer,
const ServerMetadata* metadata);
void LogClientMessage(bool is_client, CallTracerAnnotationInterface* tracer,
const SliceBuffer* message);
void LogServerMessage(bool is_client, CallTracerAnnotationInterface* tracer,
const SliceBuffer* message);
void LogCancel(bool is_client, CallTracerAnnotationInterface* tracer);
private:
void SetCommonEntryFields(LoggingSink::Entry* entry, bool is_client,
CallTracerAnnotationInterface* tracer,
LoggingSink::Entry::EventType event_type);
absl::uint128 call_id_;
uint32_t sequence_id_ = 0;
std::string service_name_;
std::string method_name_;
std::string authority_;
LoggingSink::Entry::Address peer_;
LoggingSink::Config config_;
};
} // namespace logging_filter_detail
class ClientLoggingFilter final
: public ImplementChannelFilter<ClientLoggingFilter> {
public:
static const grpc_channel_filter kFilter;
@ -45,24 +84,46 @@ class ClientLoggingFilter final : public ChannelFilter {
explicit ClientLoggingFilter(std::string default_authority)
: default_authority_(std::move(default_authority)) {}
// Construct a promise for one call.
ArenaPromise<ServerMetadataHandle> MakeCallPromise(
CallArgs call_args, NextPromiseFactory next_promise_factory) override;
class Call {
public:
void OnClientInitialMetadata(ClientMetadata& md,
ClientLoggingFilter* filter);
void OnServerInitialMetadata(ServerMetadata& md);
void OnServerTrailingMetadata(ServerMetadata& md);
void OnClientToServerMessage(const Message& message);
void OnClientToServerHalfClose();
void OnServerToClientMessage(const Message& message);
static const NoInterceptor OnFinalize;
private:
absl::optional<logging_filter_detail::CallData> call_data_;
};
private:
const std::string default_authority_;
};
class ServerLoggingFilter final : public ChannelFilter {
class ServerLoggingFilter final
: public ImplementChannelFilter<ServerLoggingFilter> {
public:
static const grpc_channel_filter kFilter;
static absl::StatusOr<std::unique_ptr<ServerLoggingFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args /*filter_args*/);
// Construct a promise for one call.
ArenaPromise<ServerMetadataHandle> MakeCallPromise(
CallArgs call_args, NextPromiseFactory next_promise_factory) override;
class Call {
public:
void OnClientInitialMetadata(ClientMetadata& md);
void OnServerInitialMetadata(ServerMetadata& md);
void OnServerTrailingMetadata(ServerMetadata& md);
void OnClientToServerMessage(const Message& message);
void OnClientToServerHalfClose();
void OnServerToClientMessage(const Message& message);
static const NoInterceptor OnFinalize;
private:
absl::optional<logging_filter_detail::CallData> call_data_;
};
};
void RegisterLoggingFilter(LoggingSink* sink);

@ -27,6 +27,7 @@
#include <string>
#include "absl/numeric/int128.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "src/core/lib/gprpp/time.h"
@ -73,8 +74,42 @@ class LoggingSink {
kCancel
};
static std::string EventTypeString(EventType type) {
switch (type) {
case EventType::kUnknown:
return "UNKNOWN";
case EventType::kClientHeader:
return "CLIENT_HEADER";
case EventType::kServerHeader:
return "SERVER_HEADER";
case EventType::kClientMessage:
return "CLIENT_MESSAGE";
case EventType::kServerMessage:
return "SERVER_MESSAGE";
case EventType::kClientHalfClose:
return "CLIENT_HALF_CLOSE";
case EventType::kServerTrailer:
return "SERVER_TRAILER";
case EventType::kCancel:
return "CANCEL";
}
return absl::StrCat("INVALID(", static_cast<int>(type), ")");
}
enum class Logger { kUnknown = 0, kClient, kServer };
static std::string LoggerString(Logger logger) {
switch (logger) {
case Logger::kUnknown:
return "UNKNOWN";
case Logger::kClient:
return "CLIENT";
case Logger::kServer:
return "SERVER";
}
return absl::StrCat("INVALID(", static_cast<int>(logger), ")");
}
struct Payload {
std::map<std::string, std::string> metadata;
Duration timeout;
@ -118,6 +153,16 @@ class LoggingSink {
virtual void LogEntry(Entry entry) = 0;
};
inline std::ostream& operator<<(std::ostream& out,
const LoggingSink::Entry::EventType& type) {
return out << LoggingSink::Entry::EventTypeString(type);
}
inline std::ostream& operator<<(std::ostream& out,
const LoggingSink::Entry::Logger& logger) {
return out << LoggingSink::Entry::LoggerString(logger);
}
} // namespace grpc_core
#endif // GRPC_SRC_CORE_EXT_FILTERS_LOGGING_LOGGING_SINK_H

@ -51,10 +51,12 @@ namespace grpc_core {
const NoInterceptor ClientMessageSizeFilter::Call::OnClientInitialMetadata;
const NoInterceptor ClientMessageSizeFilter::Call::OnServerInitialMetadata;
const NoInterceptor ClientMessageSizeFilter::Call::OnServerTrailingMetadata;
const NoInterceptor ClientMessageSizeFilter::Call::OnClientToServerHalfClose;
const NoInterceptor ClientMessageSizeFilter::Call::OnFinalize;
const NoInterceptor ServerMessageSizeFilter::Call::OnClientInitialMetadata;
const NoInterceptor ServerMessageSizeFilter::Call::OnServerInitialMetadata;
const NoInterceptor ServerMessageSizeFilter::Call::OnServerTrailingMetadata;
const NoInterceptor ServerMessageSizeFilter::Call::OnClientToServerHalfClose;
const NoInterceptor ServerMessageSizeFilter::Call::OnFinalize;
//

@ -105,6 +105,7 @@ class ServerMessageSizeFilter final
static const NoInterceptor OnFinalize;
ServerMetadataHandle OnClientToServerMessage(
const Message& message, ServerMessageSizeFilter* filter);
static const NoInterceptor OnClientToServerHalfClose;
ServerMetadataHandle OnServerToClientMessage(
const Message& message, ServerMessageSizeFilter* filter);
};
@ -133,6 +134,7 @@ class ClientMessageSizeFilter final
static const NoInterceptor OnServerTrailingMetadata;
static const NoInterceptor OnFinalize;
ServerMetadataHandle OnClientToServerMessage(const Message& message);
static const NoInterceptor OnClientToServerHalfClose;
ServerMetadataHandle OnServerToClientMessage(const Message& message);
private:

@ -46,6 +46,7 @@ namespace grpc_core {
const NoInterceptor RbacFilter::Call::OnServerInitialMetadata;
const NoInterceptor RbacFilter::Call::OnServerTrailingMetadata;
const NoInterceptor RbacFilter::Call::OnClientToServerMessage;
const NoInterceptor RbacFilter::Call::OnClientToServerHalfClose;
const NoInterceptor RbacFilter::Call::OnServerToClientMessage;
const NoInterceptor RbacFilter::Call::OnFinalize;

@ -55,6 +55,7 @@ class RbacFilter : public ImplementChannelFilter<RbacFilter> {
static const NoInterceptor OnServerInitialMetadata;
static const NoInterceptor OnServerTrailingMetadata;
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;
};

@ -60,6 +60,7 @@ namespace grpc_core {
TraceFlag grpc_stateful_session_filter_trace(false, "stateful_session_filter");
const NoInterceptor StatefulSessionFilter::Call::OnClientToServerMessage;
const NoInterceptor StatefulSessionFilter::Call::OnClientToServerHalfClose;
const NoInterceptor StatefulSessionFilter::Call::OnServerToClientMessage;
const NoInterceptor StatefulSessionFilter::Call::OnFinalize;

@ -86,6 +86,7 @@ class StatefulSessionFilter
void OnServerInitialMetadata(ServerMetadata& md);
void OnServerTrailingMetadata(ServerMetadata& md);
static const NoInterceptor OnClientToServerMessage;
static const NoInterceptor OnClientToServerHalfClose;
static const NoInterceptor OnServerToClientMessage;
static const NoInterceptor OnFinalize;

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -120,7 +121,7 @@ void MetadataQuery::OnDone(void* arg, grpc_error_handle error) {
absl::StrFormat("MetadataServer Could not parse zone: %s",
std::string(body).c_str()));
if (GRPC_TRACE_FLAG_ENABLED(grpc_metadata_query_trace)) {
gpr_log(GPR_INFO, "%s", result.status().ToString().c_str());
LOG(INFO) << result.status().ToString();
}
} else {
result = std::string(body.substr(pos + 1));

@ -35,6 +35,7 @@
#ifdef GPR_SUPPORT_BINDER_TRANSPORT
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/strings/substitute.h"
#include "absl/time/clock.h"
@ -111,7 +112,7 @@ std::shared_ptr<grpc::Channel> CreateCustomBinderChannel(
std::string connection_id =
grpc_binder::GetConnectionIdGenerator()->Generate(uri);
gpr_log(GPR_ERROR, "connection id is %s", connection_id.c_str());
LOG(ERROR) << "connection id is " << connection_id;
// After invoking this Java method, Java code will put endpoint binder into
// `EndpointBinderPool` after the connection succeeds

@ -15,6 +15,7 @@
#include "src/core/ext/transport/binder/client/endpoint_binder_pool.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/port_platform.h>
@ -36,11 +37,11 @@ Java_io_grpc_binder_cpp_GrpcBinderConnection_notifyConnected__Ljava_lang_String_
JNIEnv* jni_env, jobject, jstring conn_id_jstring, jobject ibinder) {
jboolean isCopy;
const char* conn_id = jni_env->GetStringUTFChars(conn_id_jstring, &isCopy);
gpr_log(GPR_INFO, "%s invoked with conn_id = %s", __func__, conn_id);
LOG(INFO) << __func__ << " invoked with conn_id = " << conn_id;
CHECK_NE(ibinder, nullptr);
grpc_binder::ndk_util::SpAIBinder aibinder =
grpc_binder::FromJavaBinder(jni_env, ibinder);
gpr_log(GPR_INFO, "%s got aibinder = %p", __func__, aibinder.get());
LOG(INFO) << __func__ << " got aibinder = " << aibinder.get();
auto b = std::make_unique<grpc_binder::BinderAndroid>(aibinder);
CHECK(b != nullptr);
grpc_binder::GetEndpointBinderPool()->AddEndpointBinder(conn_id,
@ -58,7 +59,7 @@ namespace grpc_binder {
void EndpointBinderPool::GetEndpointBinder(
std::string conn_id,
std::function<void(std::unique_ptr<grpc_binder::Binder>)> cb) {
gpr_log(GPR_INFO, "EndpointBinder requested. conn_id = %s", conn_id.c_str());
LOG(INFO) << "EndpointBinder requested. conn_id = " << conn_id;
std::unique_ptr<grpc_binder::Binder> b;
{
grpc_core::MutexLock l(&m_);
@ -68,9 +69,8 @@ void EndpointBinderPool::GetEndpointBinder(
CHECK(b != nullptr);
} else {
if (pending_requests_.count(conn_id) != 0) {
gpr_log(GPR_ERROR,
"Duplicate GetEndpointBinder requested. conn_id = %s",
conn_id.c_str());
LOG(ERROR) << "Duplicate GetEndpointBinder requested. conn_id = "
<< conn_id;
return;
}
pending_requests_[conn_id] = std::move(cb);
@ -83,15 +83,14 @@ void EndpointBinderPool::GetEndpointBinder(
void EndpointBinderPool::AddEndpointBinder(
std::string conn_id, std::unique_ptr<grpc_binder::Binder> b) {
gpr_log(GPR_INFO, "EndpointBinder added. conn_id = %s", conn_id.c_str());
LOG(INFO) << "EndpointBinder added. conn_id = " << conn_id;
CHECK(b != nullptr);
// cb will be set in the following block if there is a pending callback
std::function<void(std::unique_ptr<grpc_binder::Binder>)> cb = nullptr;
{
grpc_core::MutexLock l(&m_);
if (binder_map_.count(conn_id) != 0) {
gpr_log(GPR_ERROR, "EndpointBinder already in the pool. conn_id = %s",
conn_id.c_str());
LOG(ERROR) << "EndpointBinder already in the pool. conn_id = " << conn_id;
return;
}
if (pending_requests_.count(conn_id)) {

@ -15,6 +15,7 @@
#include "src/core/ext/transport/binder/client/jni_utils.h"
#include "absl/log/check.h"
#include "absl/log/log.h" // IWYU pragma: keep
#include <grpc/support/port_platform.h>
@ -83,7 +84,7 @@ void TryEstablishConnection(JNIEnv* env, jobject application,
jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
if (mid == nullptr) {
gpr_log(GPR_ERROR, "No method id %s", method.c_str());
LOG(ERROR) << "No method id " << method;
}
env->CallStaticVoidMethod(cl, mid, application,
@ -107,7 +108,7 @@ void TryEstablishConnectionWithUri(JNIEnv* env, jobject application,
jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
if (mid == nullptr) {
gpr_log(GPR_ERROR, "No method id %s", method.c_str());
LOG(ERROR) << "No method id " << method;
}
env->CallStaticVoidMethod(cl, mid, application,
@ -126,7 +127,7 @@ bool IsSignatureMatch(JNIEnv* env, jobject context, int uid1, int uid2) {
jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
if (mid == nullptr) {
gpr_log(GPR_ERROR, "No method id %s", method.c_str());
LOG(ERROR) << "No method id " << method;
}
jboolean result = env->CallStaticBooleanMethod(cl, mid, context, uid1, uid2);

@ -297,7 +297,7 @@ static void recv_trailing_metadata_locked(void* arg,
// Append status to metadata
// TODO(b/192208695): See if we can avoid to manually put status
// code into the header
gpr_log(GPR_INFO, "status = %d", args->status);
LOG(INFO) << "status = " << args->status;
stream->recv_trailing_metadata->Set(
grpc_core::GrpcStatusMetadata(),
static_cast<grpc_status_code>(args->status));
@ -350,7 +350,7 @@ class MetadataEncoder {
}
void Encode(grpc_core::GrpcStatusMetadata, grpc_status_code status) {
gpr_log(GPR_INFO, "send trailing metadata status = %d", status);
LOG(INFO) << "send trailing metadata status = " << status;
tx_->SetStatus(status);
}
@ -395,7 +395,7 @@ static void perform_stream_op_locked(void* stream_op,
CHECK(!op->send_initial_metadata && !op->send_message &&
!op->send_trailing_metadata && !op->recv_initial_metadata &&
!op->recv_message && !op->recv_trailing_metadata);
gpr_log(GPR_INFO, "cancel_stream is_client = %d", stream->is_client);
LOG(INFO) << "cancel_stream is_client = " << stream->is_client;
if (!stream->is_client) {
// Send trailing metadata to inform the other end about the cancellation,
// regardless if we'd already done that or not.

@ -23,6 +23,7 @@
#include <dlfcn.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
@ -60,10 +61,10 @@ void SetJvm(JNIEnv* env) {
JavaVM* jvm = nullptr;
jint error = env->GetJavaVM(&jvm);
if (error != JNI_OK) {
gpr_log(GPR_ERROR, "Failed to get JVM");
LOG(ERROR) << "Failed to get JVM";
}
g_jvm = jvm;
gpr_log(GPR_INFO, "JVM cached");
LOG(INFO) << "JVM cached";
}
// `SetJvm` need to be called in the process before `AttachJvm`. This is always
@ -77,14 +78,14 @@ bool AttachJvm() {
// Note: The following code would be run at most once per thread.
grpc_core::MutexLock lock(&g_jvm_mu);
if (g_jvm == nullptr) {
gpr_log(GPR_ERROR, "JVM not cached yet");
LOG(ERROR) << "JVM not cached yet";
return false;
}
JNIEnv* env_unused;
// Note that attach a thread that is already attached is a no-op, so it is
// fine to call this again if the thread has already been attached by other.
g_jvm->AttachCurrentThread(&env_unused, /* thr_args= */ nullptr);
gpr_log(GPR_INFO, "JVM attached successfully");
LOG(INFO) << "JVM attached successfully";
g_is_jvm_attached = true;
return true;
}
@ -151,7 +152,7 @@ binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code,
AParcel** in, AParcel** out,
binder_flags_t flags) {
if (!AttachJvm()) {
gpr_log(GPR_ERROR, "failed to attach JVM. AIBinder_transact might fail.");
LOG(ERROR) << "failed to attach JVM. AIBinder_transact might fail.";
}
FORWARD(AIBinder_transact)(binder, code, in, out, flags);
}

@ -23,8 +23,7 @@
#include <utility>
#include "absl/log/check.h"
#include <grpc/support/log.h>
#include "absl/log/log.h"
#include "src/core/lib/gprpp/crash.h"
@ -36,7 +35,7 @@ const absl::string_view
void TransportStreamReceiverImpl::RegisterRecvInitialMetadata(
StreamIdentifier id, InitialMetadataCallbackType cb) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
absl::StatusOr<Metadata> initial_metadata{};
{
grpc_core::MutexLock l(&m_);
@ -64,7 +63,7 @@ void TransportStreamReceiverImpl::RegisterRecvInitialMetadata(
void TransportStreamReceiverImpl::RegisterRecvMessage(
StreamIdentifier id, MessageDataCallbackType cb) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
absl::StatusOr<std::string> message{};
{
grpc_core::MutexLock l(&m_);
@ -98,7 +97,7 @@ void TransportStreamReceiverImpl::RegisterRecvMessage(
void TransportStreamReceiverImpl::RegisterRecvTrailingMetadata(
StreamIdentifier id, TrailingMetadataCallbackType cb) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
std::pair<absl::StatusOr<Metadata>, int> trailing_metadata{};
{
grpc_core::MutexLock l(&m_);
@ -122,7 +121,7 @@ void TransportStreamReceiverImpl::RegisterRecvTrailingMetadata(
void TransportStreamReceiverImpl::NotifyRecvInitialMetadata(
StreamIdentifier id, absl::StatusOr<Metadata> initial_metadata) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
if (!is_client_ && accept_stream_callback_ && initial_metadata.ok()) {
accept_stream_callback_();
}
@ -143,7 +142,7 @@ void TransportStreamReceiverImpl::NotifyRecvInitialMetadata(
void TransportStreamReceiverImpl::NotifyRecvMessage(
StreamIdentifier id, absl::StatusOr<std::string> message) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
MessageDataCallbackType cb;
{
grpc_core::MutexLock l(&m_);
@ -166,7 +165,7 @@ void TransportStreamReceiverImpl::NotifyRecvTrailingMetadata(
// assumes in-order commitments of transactions and that trailing metadata is
// parsed after message data, we can safely cancel all upcoming callbacks of
// recv_message.
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
OnRecvTrailingMetadata(id);
TrailingMetadataCallbackType cb;
{
@ -233,7 +232,7 @@ void TransportStreamReceiverImpl::CancelTrailingMetadataCallback(
}
void TransportStreamReceiverImpl::OnRecvTrailingMetadata(StreamIdentifier id) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
m_.Lock();
trailing_metadata_recvd_.insert(id);
m_.Unlock();
@ -245,7 +244,7 @@ void TransportStreamReceiverImpl::OnRecvTrailingMetadata(StreamIdentifier id) {
}
void TransportStreamReceiverImpl::CancelStream(StreamIdentifier id) {
gpr_log(GPR_INFO, "%s id = %d is_client = %d", __func__, id, is_client_);
LOG(INFO) << __func__ << " id = " << id << " is_client = " << is_client_;
CancelInitialMetadataCallback(id, absl::CancelledError("Stream cancelled"));
CancelMessageCallback(id, absl::CancelledError("Stream cancelled"));
CancelTrailingMetadataCallback(id, absl::CancelledError("Stream cancelled"));

@ -21,6 +21,7 @@
#include <map>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
@ -65,7 +66,7 @@ ndk_util::binder_status_t f_onTransact(ndk_util::AIBinder* binder,
const ndk_util::AParcel* in,
ndk_util::AParcel* /*out*/) {
gpr_log(GPR_INFO, __func__);
gpr_log(GPR_INFO, "tx code = %u", code);
LOG(INFO) << "tx code = " << code;
auto* user_data =
static_cast<BinderUserData*>(ndk_util::AIBinder_getUserData(binder));
@ -79,7 +80,7 @@ ndk_util::binder_status_t f_onTransact(ndk_util::AIBinder* binder,
if (status.ok()) {
return ndk_util::STATUS_OK;
} else {
gpr_log(GPR_ERROR, "Callback failed: %s", status.ToString().c_str());
LOG(ERROR) << "Callback failed: " << status.ToString();
return ndk_util::STATUS_UNKNOWN_ERROR;
}
}

@ -22,6 +22,7 @@
#include "absl/cleanup/cleanup.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/types/variant.h"
#include <grpc/support/log.h>
@ -78,7 +79,7 @@ absl::Status WriteTrailingMetadata(const Transaction& tx,
} else {
// client suffix currently is always empty according to the wireformat
if (!tx.GetSuffixMetadata().empty()) {
gpr_log(GPR_ERROR, "Got non-empty suffix metadata from client.");
LOG(ERROR) << "Got non-empty suffix metadata from client.";
}
}
return absl::OkStatus();
@ -218,8 +219,7 @@ void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
return absl::OkStatus();
});
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to make binder transaction " << result;
}
delete args;
return;
@ -242,8 +242,7 @@ void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
if (CanBeSentInOneTransaction(*stream_tx->tx.get())) { // NOLINT
absl::Status result = RpcCallFastPath(std::move(stream_tx->tx));
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to handle non-chunked RPC call %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to handle non-chunked RPC call " << result;
}
delete args;
return;
@ -256,8 +255,7 @@ void WireWriterImpl::RunScheduledTxInternal(RunScheduledTxArgs* args) {
return RunStreamTx(stream_tx, parcel, &is_last_chunk);
});
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to make binder transaction " << result;
}
if (!is_last_chunk) {
{
@ -290,7 +288,7 @@ absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
// Ensure combiner will be run if this is not called from top-level gRPC API
// entrypoint.
grpc_core::ExecCtx exec_ctx;
gpr_log(GPR_INFO, "Ack %" PRId64 " bytes received", num_bytes);
LOG(INFO) << "Ack " << num_bytes << " bytes received";
if (is_transacting_) {
// This can happen because NDK might call our registered callback function
// in the same thread while we are telling it to send a transaction
@ -298,10 +296,8 @@ absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
// the same thread or the other thread. We are currently in the call stack
// of other transaction, Liveness of ACK is still guaranteed even if this is
// a race with another thread.
gpr_log(
GPR_INFO,
"Scheduling ACK transaction instead of directly execute it to avoid "
"deadlock.");
LOG(INFO) << "Scheduling ACK transaction instead of directly execute it to "
"avoid deadlock.";
auto args = new RunScheduledTxArgs();
args->writer = this;
args->tx = RunScheduledTxArgs::AckTx();
@ -318,8 +314,7 @@ absl::Status WireWriterImpl::SendAck(int64_t num_bytes) {
return absl::OkStatus();
});
if (!result.ok()) {
gpr_log(GPR_ERROR, "Failed to make binder transaction %s",
result.ToString().c_str());
LOG(ERROR) << "Failed to make binder transaction " << result;
}
return result;
}
@ -328,7 +323,7 @@ void WireWriterImpl::OnAckReceived(int64_t num_bytes) {
// Ensure combiner will be run if this is not called from top-level gRPC API
// entrypoint.
grpc_core::ExecCtx exec_ctx;
gpr_log(GPR_INFO, "OnAckReceived %" PRId64, num_bytes);
LOG(INFO) << "OnAckReceived " << num_bytes;
// Do not try to obtain `write_mu_` in this function. NDKBinder might invoke
// the callback to notify us about new incoming binder transaction when we are
// sending transaction. i.e. `write_mu_` might have already been acquired by

@ -22,6 +22,7 @@
#include <vector>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
@ -99,8 +100,8 @@ absl::StatusOr<int> ChaoticGoodServerListener::Bind(
grpc_event_engine::experimental::EventEngine::ResolvedAddress addr) {
if (grpc_chaotic_good_trace.enabled()) {
auto str = grpc_event_engine::experimental::ResolvedAddressToString(addr);
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Listen on %s",
str.ok() ? str->c_str() : str.status().ToString().c_str());
LOG(INFO) << "CHAOTIC_GOOD: Listen on "
<< (str.ok() ? str->c_str() : str.status().ToString());
}
EventEngine::Listener::AcceptCallback accept_cb =
[self = RefAsSubclass<ChaoticGoodServerListener>()](
@ -123,8 +124,7 @@ absl::StatusOr<int> ChaoticGoodServerListener::Bind(
grpc_event_engine::experimental::ChannelArgsEndpointConfig(args_),
std::make_unique<MemoryQuota>("chaotic_good_server_listener"));
if (!ee_listener.ok()) {
gpr_log(GPR_ERROR, "Bind failed: %s",
ee_listener.status().ToString().c_str());
LOG(ERROR) << "Bind failed: " << ee_listener.status().ToString();
return ee_listener.status();
}
ee_listener_ = std::move(ee_listener.value());
@ -139,9 +139,9 @@ absl::Status ChaoticGoodServerListener::StartListening() {
CHECK(ee_listener_ != nullptr);
auto status = ee_listener_->Start();
if (!status.ok()) {
gpr_log(GPR_ERROR, "Start listening failed: %s", status.ToString().c_str());
LOG(ERROR) << "Start listening failed: " << status.ToString();
} else if (grpc_chaotic_good_trace.enabled()) {
gpr_log(GPR_INFO, "CHAOTIC_GOOD: Started listening");
LOG(INFO) << "CHAOTIC_GOOD: Started listening";
}
return status;
}
@ -161,7 +161,7 @@ ChaoticGoodServerListener::ActiveConnection::~ActiveConnection() {
void ChaoticGoodServerListener::ActiveConnection::Orphan() {
if (grpc_chaotic_good_trace.enabled()) {
gpr_log(GPR_INFO, "ActiveConnection::Orphan() %p", this);
LOG(INFO) << "ActiveConnection::Orphan() " << this;
}
if (handshaking_state_ != nullptr) {
handshaking_state_->Shutdown();
@ -193,8 +193,7 @@ void ChaoticGoodServerListener::ActiveConnection::NewConnectionID() {
void ChaoticGoodServerListener::ActiveConnection::Done(
absl::optional<absl::string_view> error) {
if (error.has_value()) {
gpr_log(GPR_ERROR, "ActiveConnection::Done:%p %s", this,
std::string(*error).c_str());
LOG(ERROR) << "ActiveConnection::Done:" << this << " " << *error;
}
// Can easily be holding various locks here: bounce through EE to ensure no
// deadlocks.
@ -459,7 +458,7 @@ Timestamp ChaoticGoodServerListener::ActiveConnection::HandshakingState::
void ChaoticGoodServerListener::Orphan() {
if (grpc_chaotic_good_trace.enabled()) {
gpr_log(GPR_INFO, "ChaoticGoodServerListener::Orphan()");
LOG(INFO) << "ChaoticGoodServerListener::Orphan()";
}
{
absl::flat_hash_set<OrphanablePtr<ActiveConnection>> connection_list;
@ -481,8 +480,8 @@ int grpc_server_add_chaotic_good_port(grpc_server* server, const char* addr) {
const auto resolved_or = grpc_core::GetDNSResolver()->LookupHostnameBlocking(
parsed_addr, absl::StrCat(0xd20));
if (!resolved_or.ok()) {
gpr_log(GPR_ERROR, "Failed to resolve %s: %s", addr,
resolved_or.status().ToString().c_str());
LOG(ERROR) << "Failed to resolve " << addr << ": "
<< resolved_or.status().ToString();
return 0;
}
int port_num = 0;
@ -497,8 +496,8 @@ int grpc_server_add_chaotic_good_port(grpc_server* server, const char* addr) {
->c_str());
auto bind_result = listener->Bind(ee_addr);
if (!bind_result.ok()) {
gpr_log(GPR_ERROR, "Failed to bind to %s: %s", addr,
bind_result.status().ToString().c_str());
LOG(ERROR) << "Failed to bind to " << addr << ": "
<< bind_result.status().ToString();
return 0;
}
if (port_num == 0) {

@ -23,7 +23,7 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/util/useful.h"
// in order of preference
static const char* const supported_versions[] = {"h2"};

@ -25,6 +25,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_format.h"
@ -311,7 +312,7 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
absl::StatusOr<OrphanablePtr<Channel>> CreateChannel(const char* target,
const ChannelArgs& args) {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
LOG(ERROR) << "cannot create channel with NULL target name";
return absl::InvalidArgumentError("channel target is NULL");
}
return ChannelCreate(target, args, GRPC_CLIENT_CHANNEL, nullptr);

@ -30,6 +30,7 @@
#include "absl/base/thread_annotations.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -45,7 +46,6 @@
#include <grpc/passive_listener.h>
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/channelz/channelz.h"
@ -326,8 +326,7 @@ void Chttp2ServerListener::ConfigFetcherWatcher::UpdateConnectionManager(
grpc_error_handle error = grpc_tcp_server_add_port(
listener_->tcp_server_, &listener_->resolved_address_, &port_temp);
if (!error.ok()) {
gpr_log(GPR_ERROR, "Error adding port to server: %s",
StatusToString(error).c_str());
LOG(ERROR) << "Error adding port to server: " << StatusToString(error);
// TODO(yashykt): We wouldn't need to assert here if we bound to the
// port earlier during AddPort.
CHECK(0);
@ -535,8 +534,8 @@ void Chttp2ServerListener::ActiveConnection::HandshakingState::OnHandshakeDone(
});
} else {
// Failed to create channel from transport. Clean up.
gpr_log(GPR_ERROR, "Failed to create channel: %s",
StatusToString(channel_init_err).c_str());
LOG(ERROR) << "Failed to create channel: "
<< StatusToString(channel_init_err);
transport->Orphan();
grpc_slice_buffer_destroy(args->read_buffer);
gpr_free(args->read_buffer);
@ -1038,7 +1037,7 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
resolved_or->size() - error_list.size(), resolved_or->size());
error = GRPC_ERROR_CREATE_REFERENCING(msg.c_str(), error_list.data(),
error_list.size());
gpr_log(GPR_INFO, "WARNING: %s", StatusToString(error).c_str());
LOG(INFO) << "WARNING: " << StatusToString(error);
// we managed to bind some addresses: continue without error
}
return absl::OkStatus();
@ -1158,7 +1157,7 @@ int grpc_server_add_http2_port(grpc_server* server, const char* addr,
done:
sc.reset(DEBUG_LOCATION, "server");
if (!err.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(err).c_str());
LOG(ERROR) << grpc_core::StatusToString(err);
}
return port_num;
}
@ -1169,7 +1168,7 @@ void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
// For now, we only support insecure server credentials
if (creds == nullptr ||
creds->type() != grpc_core::InsecureServerCredentials::Type()) {
gpr_log(GPR_ERROR, "Failed to create channel due to invalid creds");
LOG(ERROR) << "Failed to create channel due to invalid creds";
return;
}
grpc_core::ExecCtx exec_ctx;
@ -1194,8 +1193,8 @@ void grpc_server_add_channel_from_fd(grpc_server* server, int fd,
}
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr, nullptr);
} else {
gpr_log(GPR_ERROR, "Failed to create channel: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "Failed to create channel: "
<< grpc_core::StatusToString(error);
transport->Orphan();
}
}

@ -80,8 +80,6 @@
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/debug/stats_data.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/bitset.h"
#include "src/core/lib/gprpp/crash.h"
#include "src/core/lib/gprpp/debug_location.h"
@ -110,6 +108,8 @@
#include "src/core/lib/transport/metadata_info.h"
#include "src/core/lib/transport/status_conversion.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/string.h"
#include "src/core/util/useful.h"
#ifdef GRPC_POSIX_SOCKET_TCP
#include "src/core/lib/iomgr/ev_posix.h"
@ -803,8 +803,8 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
if (server_data) {
id = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(server_data));
if (grpc_http_trace.enabled()) {
gpr_log(GPR_DEBUG, "HTTP:%p/%p creating accept stream %d [from %p]", t,
this, id, server_data);
VLOG(2) << "HTTP:" << t << "/" << this << " creating accept stream " << id
<< " [from " << server_data << "]";
}
*t->accepting_stream = this;
t->stream_map.emplace(id, this);
@ -1037,8 +1037,8 @@ static void write_action(grpc_chttp2_transport* t) {
max_frame_size = INT_MAX;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
gpr_log(GPR_INFO, "%s[%p]: Write %" PRIdPTR " bytes",
t->is_client ? "CLIENT" : "SERVER", t, t->outbuf.Length());
LOG(INFO) << (t->is_client ? "CLIENT" : "SERVER") << "[" << t << "]: Write "
<< t->outbuf.Length() << " bytes";
}
t->write_size_policy.BeginWrite(t->outbuf.Length());
grpc_endpoint_write(t->ep, t->outbuf.c_slice_buffer(),
@ -1051,8 +1051,8 @@ static void write_action_end(grpc_core::RefCountedPtr<grpc_chttp2_transport> t,
grpc_error_handle error) {
auto* tp = t.get();
if (GRPC_TRACE_FLAG_ENABLED(grpc_ping_trace)) {
gpr_log(GPR_INFO, "%s[%p]: Finish write",
t->is_client ? "CLIENT" : "SERVER", t.get());
LOG(INFO) << (t->is_client ? "CLIENT" : "SERVER") << "[" << t.get()
<< "]: Finish write";
}
tp->combiner->Run(grpc_core::InitTransportClosure<write_action_end_locked>(
std::move(t), &tp->write_action_end_locked),
@ -1325,11 +1325,11 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) {
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
bool is_client, bool is_initial) {
LOG(INFO) << "--metadata--";
VLOG(2) << "--metadata--";
const std::string prefix = absl::StrCat(
"HTTP:", id, is_initial ? ":HDR" : ":TRL", is_client ? ":CLI:" : ":SVR:");
md_batch->Log([&prefix](absl::string_view key, absl::string_view value) {
gpr_log(GPR_INFO, "%s", absl::StrCat(prefix, key, ": ", value).c_str());
VLOG(2) << absl::StrCat(prefix, key, ": ", value);
});
}

@ -37,8 +37,8 @@
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/util/useful.h"
grpc_core::TraceFlag grpc_flowctl_trace(false, "flowctl");

@ -37,10 +37,10 @@
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include "src/core/ext/transport/chttp2/transport/legacy_frame.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/util/useful.h"
static uint8_t* fill_header(uint8_t* out, uint32_t length, uint8_t flags) {
*out++ = static_cast<uint8_t>(length >> 16);

@ -26,11 +26,11 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
@ -100,7 +100,7 @@ void HPackTable::SetMaxBytes(uint32_t max_bytes) {
return;
}
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "Update hpack parser max size to %d", max_bytes);
LOG(INFO) << "Update hpack parser max size to " << max_bytes;
}
while (mem_used_ > max_bytes) {
EvictOne();
@ -112,7 +112,7 @@ bool HPackTable::SetCurrentTableSize(uint32_t bytes) {
if (current_table_bytes_ == bytes) return true;
if (bytes > max_bytes_) return false;
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
gpr_log(GPR_INFO, "Update hpack parser table size to %d", bytes);
LOG(INFO) << "Update hpack parser table size to " << bytes;
}
while (mem_used_ > bytes) {
EvictOne();

@ -25,8 +25,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/transport/http2_errors.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -28,8 +28,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/transport/http2_errors.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -29,6 +29,7 @@
#include "absl/base/attributes.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/random/bit_gen_ref.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
@ -769,7 +770,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
frame_type = HPackParser::LogInfo::kTrailers;
break;
case 2:
gpr_log(GPR_ERROR, "too many header frames received");
LOG(ERROR) << "too many header frames received";
return init_header_skip_frame_parser(t, priority_type, is_eoh);
}
if (frame_type == HPackParser::LogInfo::kTrailers && !t->header_eof) {
@ -889,10 +890,9 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
int is_last) {
grpc_chttp2_stream* s = t->incoming_stream;
if (grpc_http_trace.enabled()) {
gpr_log(GPR_DEBUG,
"INCOMING[%p;%p]: Parse %" PRIdPTR "b %sframe fragment with %s", t,
s, GRPC_SLICE_LENGTH(slice), is_last ? "last " : "",
t->parser.name);
VLOG(2) << "INCOMING[" << t << ";" << s << "]: Parse "
<< GRPC_SLICE_LENGTH(slice) << "b " << (is_last ? "last " : "")
<< "frame fragment with " << t->parser.name;
}
grpc_error_handle err =
t->parser.parser(t->parser.user_data, t, s, slice, is_last);

@ -59,7 +59,6 @@
#include "src/core/lib/debug/stats_data.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/match.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -73,6 +72,7 @@
#include "src/core/lib/transport/http2_errors.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/useful.h"
// IWYU pragma: no_include "src/core/lib/gprpp/orphanable.h"

@ -28,6 +28,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
@ -318,7 +319,7 @@ void log_metadata(const grpc_metadata_batch* md_batch, bool is_client,
std::string prefix = absl::StrCat(
"INPROC:", is_initial ? "HDR:" : "TRL:", is_client ? "CLI:" : "SVR:");
md_batch->Log([&prefix](absl::string_view key, absl::string_view value) {
gpr_log(GPR_INFO, "%s", absl::StrCat(prefix, key, ": ", value).c_str());
LOG(INFO) << absl::StrCat(prefix, key, ": ", value);
});
}
@ -1265,8 +1266,8 @@ grpc_channel* grpc_legacy_inproc_channel_create(grpc_server* server,
"inproc", client_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport);
if (!new_channel.ok()) {
CHECK(!channel);
gpr_log(GPR_ERROR, "Failed to create client channel: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "Failed to create client channel: "
<< grpc_core::StatusToString(error);
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, grpc_core::StatusIntProperty::kRpcStatus,
@ -1283,8 +1284,8 @@ grpc_channel* grpc_legacy_inproc_channel_create(grpc_server* server,
}
} else {
CHECK(!channel);
gpr_log(GPR_ERROR, "Failed to create server channel: %s",
grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "Failed to create server channel: "
<< grpc_core::StatusToString(error);
intptr_t integer;
grpc_status_code status = GRPC_STATUS_INTERNAL;
if (grpc_error_get_int(error, grpc_core::StatusIntProperty::kRpcStatus,

@ -41,7 +41,6 @@
#include "src/core/handshaker/handshaker_registry.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
@ -53,6 +52,7 @@
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/iomgr_fwd.h"
#include "src/core/lib/iomgr/tcp_server.h"
#include "src/core/util/string.h"
namespace grpc_core {

@ -26,6 +26,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/ascii.h"
@ -47,12 +48,12 @@
#include "src/core/lib/address_utils/parse_address.h"
#include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/uri/uri_parser.h"
#include "src/core/util/string.h"
namespace grpc_core {
namespace {
@ -150,7 +151,7 @@ absl::optional<std::string> GetHttpProxyServer(
// User cred found
*user_cred = authority_strs[0];
proxy_name = authority_strs[1];
gpr_log(GPR_DEBUG, "userinfo found in proxy URI");
VLOG(2) << "userinfo found in proxy URI";
} else {
// Bad authority
proxy_name = absl::nullopt;

@ -42,7 +42,6 @@
#include "src/core/handshaker/security/tsi_error.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
@ -58,6 +57,7 @@
#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/tsi/transport_security_grpc.h"
#include "src/core/tsi/transport_security_interface.h"
#include "src/core/util/string.h"
#define STAGING_BUFFER_SIZE 8192

@ -19,6 +19,7 @@
#include "src/core/lib/address_utils/parse_address.h"
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/port_platform.h>
@ -49,12 +50,12 @@
#include <grpc/support/log.h>
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"
#include "src/core/util/string.h"
// IWYU pragma: no_include <arpa/inet.h>
@ -70,7 +71,7 @@ bool grpc_parse_unix(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "" << grpc_core::StatusToString(error);
return false;
}
return true;
@ -86,7 +87,7 @@ bool grpc_parse_unix_abstract(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::UnixAbstractSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "" << grpc_core::StatusToString(error);
return false;
}
return true;
@ -170,7 +171,7 @@ bool grpc_parse_vsock(const grpc_core::URI& uri,
grpc_error_handle error =
grpc_core::VSockaddrPopulate(uri.path(), resolved_addr);
if (!error.ok()) {
gpr_log(GPR_ERROR, "%s", grpc_core::StatusToString(error).c_str());
LOG(ERROR) << "" << grpc_core::StatusToString(error);
return false;
}
return true;
@ -238,7 +239,7 @@ bool grpc_parse_ipv4_hostport(absl::string_view hostport,
}
// Parse port.
if (port.empty()) {
if (log_errors) gpr_log(GPR_ERROR, "no port given for ipv4 scheme");
if (log_errors) LOG(ERROR) << "no port given for ipv4 scheme";
goto done;
}
int port_num;
@ -333,7 +334,7 @@ bool grpc_parse_ipv6_hostport(absl::string_view hostport,
}
// Parse port.
if (port.empty()) {
if (log_errors) gpr_log(GPR_ERROR, "no port given for ipv6 scheme");
if (log_errors) LOG(ERROR) << "no port given for ipv6 scheme";
goto done;
}
int port_num;

@ -23,9 +23,9 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -40,7 +40,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/util/useful.h"
namespace grpc_core {

@ -38,7 +38,6 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/avl/avl.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/dual_ref_counted.h"
#include "src/core/lib/gprpp/ref_counted.h"
@ -46,6 +45,7 @@
#include "src/core/lib/gprpp/ref_counted_string.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/util/useful.h"
// TODO(hork): When we're ready to allow setting via a channel arg from the
// application, replace this with a macro in

@ -24,6 +24,7 @@
#include <utility>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
@ -31,8 +32,8 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack_trace.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/util/alloc.h"
using grpc_event_engine::experimental::EventEngine;
@ -121,7 +122,7 @@ grpc_error_handle grpc_channel_stack_init(
const grpc_core::ChannelArgs& channel_args, const char* name,
grpc_channel_stack* stack) {
if (grpc_trace_channel_stack.enabled()) {
gpr_log(GPR_INFO, "CHANNEL_STACK: init %s", name);
LOG(INFO) << "CHANNEL_STACK: init " << name;
for (size_t i = 0; i < filter_count; i++) {
gpr_log(GPR_INFO, "CHANNEL_STACK: filter %s%s", filters[i]->name,
filters[i]->make_call_promise ? " [promise-capable]" : "");

@ -62,7 +62,6 @@
#include "src/core/lib/channel/context.h"
#include "src/core/lib/channel/metrics.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/time.h"
@ -74,6 +73,7 @@
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/call_final_info.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/time_precise.h"
struct grpc_channel_element_args {
grpc_channel_stack* channel_stack;

@ -44,7 +44,6 @@
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
@ -79,6 +78,7 @@
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"
#include "src/core/util/alloc.h"
typedef struct connected_channel_channel_data {
grpc_core::Transport* transport;

@ -72,6 +72,7 @@ struct grpc_call_context_element {
namespace grpc_core {
class Call;
class CallTracerAnnotationInterface;
// Bind the legacy context array into the new style structure
// TODO(ctiller): remove as we migrate these contexts to the new system.
@ -89,6 +90,12 @@ struct OldStyleContext<Call> {
static constexpr grpc_context_index kIndex = GRPC_CONTEXT_CALL;
};
template <>
struct OldStyleContext<CallTracerAnnotationInterface> {
static constexpr grpc_context_index kIndex =
GRPC_CONTEXT_CALL_TRACER_ANNOTATION_INTERFACE;
};
template <typename T>
class Context<T, absl::void_t<decltype(OldStyleContext<T>::kIndex)>> {
public:

@ -59,6 +59,7 @@
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/promise/activity.h"
#include "src/core/lib/promise/arena_promise.h"
#include "src/core/lib/promise/cancel_callback.h"
#include "src/core/lib/promise/context.h"
#include "src/core/lib/promise/pipe.h"
#include "src/core/lib/promise/poll.h"
@ -354,31 +355,72 @@ template <typename Promise, typename Derived>
auto MapResult(absl::Status (Derived::Call::*fn)(ServerMetadata&), Promise x,
FilterCallData<Derived>* call_data) {
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata);
return Map(std::move(x), [call_data](ServerMetadataHandle md) {
auto status = call_data->call.OnServerTrailingMetadata(*md);
if (!status.ok()) return ServerMetadataFromStatus(status);
return md;
});
return OnCancel(
Map(std::move(x),
[call_data](ServerMetadataHandle md) {
auto status = call_data->call.OnServerTrailingMetadata(*md);
if (!status.ok()) {
return ServerMetadataFromStatus(status);
}
return md;
}),
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
// valid for the cancellation function requiring us to capture it here.
// This ought to be easy to fix once client side promises are completely
// rolled out.
[call_data, ctx = GetContext<grpc_call_context_element>()]() {
grpc_metadata_batch b;
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
b.Set(GrpcCallWasCancelled(), true);
promise_detail::Context<grpc_call_context_element> context(ctx);
call_data->call.OnServerTrailingMetadata(b).IgnoreError();
});
}
template <typename Promise, typename Derived>
auto MapResult(void (Derived::Call::*fn)(ServerMetadata&), Promise x,
FilterCallData<Derived>* call_data) {
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata);
return Map(std::move(x), [call_data](ServerMetadataHandle md) {
call_data->call.OnServerTrailingMetadata(*md);
return md;
});
return OnCancel(
Map(std::move(x),
[call_data](ServerMetadataHandle md) {
call_data->call.OnServerTrailingMetadata(*md);
return md;
}),
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
// valid for the cancellation function requiring us to capture it here.
// This ought to be easy to fix once client side promises are completely
// rolled out.
[call_data, ctx = GetContext<grpc_call_context_element>()]() {
grpc_metadata_batch b;
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
b.Set(GrpcCallWasCancelled(), true);
promise_detail::Context<grpc_call_context_element> context(ctx);
call_data->call.OnServerTrailingMetadata(b);
});
}
template <typename Promise, typename Derived>
auto MapResult(void (Derived::Call::*fn)(ServerMetadata&, Derived*), Promise x,
FilterCallData<Derived>* call_data) {
DCHECK(fn == &Derived::Call::OnServerTrailingMetadata);
return Map(std::move(x), [call_data](ServerMetadataHandle md) {
call_data->call.OnServerTrailingMetadata(*md, call_data->channel);
return md;
});
return OnCancel(
Map(std::move(x),
[call_data](ServerMetadataHandle md) {
call_data->call.OnServerTrailingMetadata(*md, call_data->channel);
return md;
}),
// TODO(yashykt/ctiller): GetContext<grpc_call_context_element> is not
// valid for the cancellation function requiring us to capture it here.
// This ought to be easy to fix once client side promises are completely
// rolled out.
[call_data, ctx = GetContext<grpc_call_context_element>()]() {
grpc_metadata_batch b;
b.Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
b.Set(GrpcCallWasCancelled(), true);
promise_detail::Context<grpc_call_context_element> context(ctx);
call_data->call.OnServerTrailingMetadata(b, call_data->channel);
});
}
template <typename Interceptor, typename Derived, typename SfinaeVoid = void>
@ -492,130 +534,193 @@ auto RunCall(Interceptor interceptor, CallArgs call_args,
std::move(call_args), std::move(next_promise_factory), call_data);
}
inline void InterceptClientToServerMessage(const NoInterceptor*, void*,
const CallArgs&) {}
template <typename Derived>
inline auto InterceptClientToServerMessageHandler(
void (Derived::Call::*fn)(const Message&),
FilterCallData<Derived>* call_data, const CallArgs&) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
call_data->call.OnClientToServerMessage(*msg);
return std::move(msg);
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
ServerMetadataHandle (Derived::Call::*fn)(const Message&),
FilterCallData<Derived>* call_data, const CallArgs& call_args) {
FilterCallData<Derived>* call_data, const CallArgs&) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_args.client_to_server_messages->InterceptAndMap(
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md = call_data->call.OnClientToServerMessage(*msg);
if (return_md == nullptr) return std::move(msg);
if (call_data->error_latch.is_set()) return absl::nullopt;
call_data->error_latch.Set(std::move(return_md));
return absl::nullopt;
});
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md = call_data->call.OnClientToServerMessage(*msg);
if (return_md == nullptr) return std::move(msg);
if (call_data->error_latch.is_set()) return absl::nullopt;
call_data->error_latch.Set(std::move(return_md));
return absl::nullopt;
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
ServerMetadataHandle (Derived::Call::*fn)(const Message&, Derived*),
FilterCallData<Derived>* call_data, const CallArgs& call_args) {
FilterCallData<Derived>* call_data, const CallArgs&) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_args.client_to_server_messages->InterceptAndMap(
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md =
call_data->call.OnClientToServerMessage(*msg, call_data->channel);
if (return_md == nullptr) return std::move(msg);
if (call_data->error_latch.is_set()) return absl::nullopt;
call_data->error_latch.Set(std::move(return_md));
return absl::nullopt;
});
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md =
call_data->call.OnClientToServerMessage(*msg, call_data->channel);
if (return_md == nullptr) return std::move(msg);
if (call_data->error_latch.is_set()) return absl::nullopt;
call_data->error_latch.Set(std::move(return_md));
return absl::nullopt;
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
MessageHandle (Derived::Call::*fn)(MessageHandle, Derived*),
FilterCallData<Derived>* call_data, const CallArgs& call_args) {
FilterCallData<Derived>* call_data, const CallArgs&) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_args.client_to_server_messages->InterceptAndMap(
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
return call_data->call.OnClientToServerMessage(std::move(msg),
call_data->channel);
});
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
return call_data->call.OnClientToServerMessage(std::move(msg),
call_data->channel);
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*),
FilterCallData<Derived>* call_data, const CallArgs& call_args) {
FilterCallData<Derived>* call_data, const CallArgs&) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
return [call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
auto r = call_data->call.OnClientToServerMessage(std::move(msg),
call_data->channel);
if (r.ok()) return std::move(*r);
if (call_data->error_latch.is_set()) return absl::nullopt;
call_data->error_latch.Set(ServerMetadataFromStatus(r.status()));
return absl::nullopt;
};
}
template <typename Derived, typename HookFunction>
inline void InterceptClientToServerMessage(HookFunction hook,
const NoInterceptor*,
FilterCallData<Derived>* call_data,
const CallArgs& call_args) {
call_args.client_to_server_messages->InterceptAndMap(
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
auto r = call_data->call.OnClientToServerMessage(std::move(msg),
call_data->channel);
if (r.ok()) return std::move(*r);
if (call_data->error_latch.is_set()) return absl::nullopt;
call_data->error_latch.Set(ServerMetadataFromStatus(r.status()));
return absl::nullopt;
});
InterceptClientToServerMessageHandler(hook, call_data, call_args));
}
inline void InterceptClientToServerMessage(const NoInterceptor*, void*, void*,
CallSpineInterface*) {}
template <typename Derived, typename HookFunction>
inline void InterceptClientToServerMessage(HookFunction hook,
void (Derived::Call::*)(),
FilterCallData<Derived>* call_data,
const CallArgs& call_args) {
call_args.client_to_server_messages->InterceptAndMapWithHalfClose(
InterceptClientToServerMessageHandler(hook, call_data, call_args),
[call_data]() { call_data->call.OnClientToServerHalfClose(); });
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline void InterceptClientToServerMessage(const NoInterceptor*,
const NoInterceptor*,
FilterCallData<Derived>*,
const CallArgs&) {}
template <typename Derived>
inline auto InterceptClientToServerMessageHandler(
ServerMetadataHandle (Derived::Call::*fn)(const Message&),
typename Derived::Call* call, Derived*, PipeBasedCallSpine* call_spine) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_spine->client_to_server_messages().receiver.InterceptAndMap(
return
[call, call_spine](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md = call->OnClientToServerMessage(*msg);
if (return_md == nullptr) return std::move(msg);
call_spine->PushServerTrailingMetadata(std::move(return_md));
return absl::nullopt;
});
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
void (Derived::Call::*fn)(const Message&), typename Derived::Call* call,
Derived*, PipeBasedCallSpine*) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
return [call](MessageHandle msg) -> absl::optional<MessageHandle> {
call->OnClientToServerMessage(*msg);
return std::move(msg);
};
}
template <typename Derived>
inline auto InterceptClientToServerMessageHandler(
ServerMetadataHandle (Derived::Call::*fn)(const Message&, Derived*),
typename Derived::Call* call, Derived* channel,
PipeBasedCallSpine* call_spine) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_spine->client_to_server_messages().receiver.InterceptAndMap(
[call, call_spine,
channel](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md = call->OnClientToServerMessage(*msg, channel);
if (return_md == nullptr) return std::move(msg);
call_spine->PushServerTrailingMetadata(std::move(return_md));
return absl::nullopt;
});
return [call, call_spine,
channel](MessageHandle msg) -> absl::optional<MessageHandle> {
auto return_md = call->OnClientToServerMessage(*msg, channel);
if (return_md == nullptr) return std::move(msg);
call_spine->PushServerTrailingMetadata(std::move(return_md));
return absl::nullopt;
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
MessageHandle (Derived::Call::*fn)(MessageHandle, Derived*),
typename Derived::Call* call, Derived* channel,
PipeBasedCallSpine* call_spine) {
typename Derived::Call* call, Derived* channel, PipeBasedCallSpine*) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_spine->client_to_server_messages().receiver.InterceptAndMap(
[call, channel](MessageHandle msg) {
return call->OnClientToServerMessage(std::move(msg), channel);
});
return [call, channel](MessageHandle msg) {
return call->OnClientToServerMessage(std::move(msg), channel);
};
}
template <typename Derived>
inline void InterceptClientToServerMessage(
inline auto InterceptClientToServerMessageHandler(
absl::StatusOr<MessageHandle> (Derived::Call::*fn)(MessageHandle, Derived*),
typename Derived::Call* call, Derived* channel,
PipeBasedCallSpine* call_spine) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
return [call, call_spine,
channel](MessageHandle msg) -> absl::optional<MessageHandle> {
auto r = call->OnClientToServerMessage(std::move(msg), channel);
if (r.ok()) return std::move(*r);
call_spine->PushServerTrailingMetadata(
ServerMetadataFromStatus(r.status()));
return absl::nullopt;
};
}
template <typename Derived, typename HookFunction>
inline void InterceptClientToServerMessage(HookFunction fn,
const NoInterceptor*,
typename Derived::Call* call,
Derived* channel,
PipeBasedCallSpine* call_spine) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
call_spine->client_to_server_messages().receiver.InterceptAndMap(
[call, call_spine,
channel](MessageHandle msg) -> absl::optional<MessageHandle> {
auto r = call->OnClientToServerMessage(std::move(msg), channel);
if (r.ok()) return std::move(*r);
call_spine->PushServerTrailingMetadata(
ServerMetadataFromStatus(r.status()));
return absl::nullopt;
});
InterceptClientToServerMessageHandler(fn, call, channel, call_spine));
}
template <typename Derived, typename HookFunction>
inline void InterceptClientToServerMessage(HookFunction fn,
void (Derived::Call::*half_close)(),
typename Derived::Call* call,
Derived* channel,
PipeBasedCallSpine* call_spine) {
DCHECK(fn == &Derived::Call::OnClientToServerMessage);
DCHECK(half_close == &Derived::Call::OnClientToServerHalfClose);
call_spine->client_to_server_messages().receiver.InterceptAndMapWithHalfClose(
InterceptClientToServerMessageHandler(fn, call, channel, call_spine),
[call]() { call->OnClientToServerHalfClose(); });
}
template <typename Derived>
inline void InterceptClientToServerMessage(const NoInterceptor*,
const NoInterceptor*,
typename Derived::Call*, Derived*,
PipeBasedCallSpine*) {}
inline void InterceptClientInitialMetadata(const NoInterceptor*, void*, void*,
PipeBasedCallSpine*) {}
@ -861,6 +966,18 @@ inline void InterceptServerInitialMetadata(
inline void InterceptServerToClientMessage(const NoInterceptor*, void*,
const CallArgs&) {}
template <typename Derived>
inline void InterceptServerToClientMessage(
void (Derived::Call::*fn)(const Message&),
FilterCallData<Derived>* call_data, const CallArgs& call_args) {
DCHECK(fn == &Derived::Call::OnServerToClientMessage);
call_args.server_to_client_messages->InterceptAndMap(
[call_data](MessageHandle msg) -> absl::optional<MessageHandle> {
call_data->call.OnServerToClientMessage(*msg);
return std::move(msg);
});
}
template <typename Derived>
inline void InterceptServerToClientMessage(
ServerMetadataHandle (Derived::Call::*fn)(const Message&),
@ -923,6 +1040,18 @@ inline void InterceptServerToClientMessage(
inline void InterceptServerToClientMessage(const NoInterceptor*, void*, void*,
CallSpineInterface*) {}
template <typename Derived>
inline void InterceptServerToClientMessage(
void (Derived::Call::*fn)(const Message&), typename Derived::Call* call,
Derived*, PipeBasedCallSpine* call_spine) {
DCHECK(fn == &Derived::Call::OnServerToClientMessage);
call_spine->server_to_client_messages().sender.InterceptAndMap(
[call](MessageHandle msg) -> absl::optional<MessageHandle> {
call->OnServerToClientMessage(*msg);
return std::move(msg);
});
}
template <typename Derived>
inline void InterceptServerToClientMessage(
ServerMetadataHandle (Derived::Call::*fn)(const Message&),
@ -1120,7 +1249,8 @@ class ImplementChannelFilter : public ChannelFilter,
promise_filter_detail::InterceptClientInitialMetadata(
&Derived::Call::OnClientInitialMetadata, call, d, c);
promise_filter_detail::InterceptClientToServerMessage(
&Derived::Call::OnClientToServerMessage, call, d, c);
&Derived::Call::OnClientToServerMessage,
&Derived::Call::OnClientToServerHalfClose, call, d, c);
promise_filter_detail::InterceptServerInitialMetadata(
&Derived::Call::OnServerInitialMetadata, call, d, c);
promise_filter_detail::InterceptServerToClientMessage(
@ -1139,7 +1269,8 @@ class ImplementChannelFilter : public ChannelFilter,
auto* call = promise_filter_detail::MakeFilterCall<Derived>(
static_cast<Derived*>(this));
promise_filter_detail::InterceptClientToServerMessage(
&Derived::Call::OnClientToServerMessage, call, call_args);
&Derived::Call::OnClientToServerMessage,
&Derived::Call::OnClientToServerHalfClose, call, call_args);
promise_filter_detail::InterceptServerInitialMetadata(
&Derived::Call::OnServerInitialMetadata, call, call_args);
promise_filter_detail::InterceptServerToClientMessage(

@ -27,7 +27,7 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/util/useful.h"
struct status_string_entry {
const char* str;

@ -28,9 +28,9 @@
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/util/useful.h"
int grpc_compression_algorithm_is_message(grpc_compression_algorithm) {
return 1;

@ -24,6 +24,7 @@
#include <zlib.h>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
@ -67,12 +68,12 @@ static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
}
} while (zs->avail_out == 0);
if (zs->avail_in) {
gpr_log(GPR_INFO, "zlib: not all input consumed");
LOG(INFO) << "zlib: not all input consumed";
goto error;
}
}
if (r != Z_STREAM_END) {
gpr_log(GPR_INFO, "zlib: Data error");
LOG(INFO) << "zlib: Data error";
goto error;
}
@ -165,7 +166,7 @@ static int compress_inner(grpc_compression_algorithm algorithm,
case GRPC_COMPRESS_ALGORITHMS_COUNT:
break;
}
gpr_log(GPR_ERROR, "invalid compression algorithm %d", algorithm);
LOG(ERROR) << "invalid compression algorithm " << algorithm;
return 0;
}
@ -190,6 +191,6 @@ int grpc_msg_decompress(grpc_compression_algorithm algorithm,
case GRPC_COMPRESS_ALGORITHMS_COUNT:
break;
}
gpr_log(GPR_ERROR, "invalid compression algorithm %d", algorithm);
LOG(ERROR) << "invalid compression algorithm " << algorithm;
return 0;
}

@ -27,9 +27,9 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/per_cpu.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/util/time_precise.h"
namespace grpc_core {

@ -22,6 +22,7 @@
#include <type_traits>
#include <utility>
#include "absl/log/log.h"
#include "absl/strings/match.h"
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
@ -75,9 +76,9 @@ void TraceFlagList::Add(TraceFlag* flag) {
}
void TraceFlagList::LogAllTracers() {
gpr_log(GPR_DEBUG, "available tracers:");
VLOG(2) << "available tracers:";
for (TraceFlag* t = root_tracer_; t != nullptr; t = t->next_tracer_) {
gpr_log(GPR_DEBUG, "\t%s", t->name_);
VLOG(2) << "\t" << t->name_;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save