From dc14f9cadb19a22546be2f9f2e20aeb5ec843c4f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 12:58:23 -0700 Subject: [PATCH 01/20] Bump the github-actions group with 4 updates (#36495) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the github-actions group with 4 updates: [actions/cache](https://github.com/actions/cache), [actions/setup-python](https://github.com/actions/setup-python), [actions/checkout](https://github.com/actions/checkout) and [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request). Updates `actions/cache` from 4.0.0 to 4.0.2
Release notes

Sourced from actions/cache's releases.

v4.0.2

What's Changed

Full Changelog: https://github.com/actions/cache/compare/v4.0.1...v4.0.2

v4.0.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/cache/compare/v4...v4.0.1

Changelog

Sourced from actions/cache's changelog.

Releases

4.0.2

4.0.1

4.0.0

3.3.3

3.3.2

3.3.1

3.3.0

3.2.6

3.2.5

3.2.4

3.2.3

3.2.2

... (truncated)

Commits

Updates `actions/setup-python` from 5.0.0 to 5.1.0
Release notes

Sourced from actions/setup-python's releases.

v5.1.0

What's Changed

New Contributors

Full Changelog: https://github.com/actions/setup-python/compare/v5.0.0...v5.1.0

Commits

Updates `actions/checkout` from 4.1.1 to 4.1.4
Release notes

Sourced from actions/checkout's releases.

v4.1.4

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.3...v4.1.4

v4.1.3

What's Changed

Full Changelog: https://github.com/actions/checkout/compare/v4.1.2...v4.1.3

v4.1.2

We are investigating the following issue with this release and have rolled-back the v4 tag to point to v4.1.1

What's Changed

New Contributors

Full Changelog: https://github.com/actions/checkout/compare/v4.1.1...v4.1.2

Changelog

Sourced from actions/checkout's changelog.

Changelog

v4.1.4

v4.1.3

v4.1.2

v4.1.1

v4.1.0

v4.0.0

v3.6.0

v3.5.3

v3.5.2

v3.5.1

v3.5.0

v3.4.0

... (truncated)

Commits

Updates `peter-evans/create-pull-request` from 6.0.0 to 6.0.5
Release notes

Sourced from peter-evans/create-pull-request's releases.

Create Pull Request v6.0.5

⚙️ Fixes an issue with proxy support for users that run self-hosted behind a proxy.

What's Changed

Full Changelog: https://github.com/peter-evans/create-pull-request/compare/v6.0.4...v6.0.5

Create Pull Request v6.0.4

⚡ Improves performance in some cases for very large git repositories.

What's Changed

Full Changelog: https://github.com/peter-evans/create-pull-request/compare/v6.0.3...v6.0.4

Create Pull Request v6.0.3

⚡ Improves performance of the push-to-fork feature.

What's Changed

Full Changelog: https://github.com/peter-evans/create-pull-request/compare/v6.0.2...v6.0.3

Create Pull Request v6.0.2

⚡ Improves performance in some cases where the action rebases changes on to the specified base.

What's Changed

New Contributors

Full Changelog: https://github.com/peter-evans/create-pull-request/compare/v6.0.1...v6.0.2

Create Pull Request v6.0.1

⚙️ Fixes an issue where updating a pull request leads to the error Cannot read properties of undefined (reading 'number'). This was likely caused by GitHub fixing a long standing bug with an API endpoint, resulting in a breaking change.

What's Changed

... (truncated)

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pr-auto-fix.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-auto-fix.yaml b/.github/workflows/pr-auto-fix.yaml index 7566c2776aa..3ec76c74662 100644 --- a/.github/workflows/pr-auto-fix.yaml +++ b/.github/workflows/pr-auto-fix.yaml @@ -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 From f4ac0a3093f28cf78fab47312e2a5674e6387cbd Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 21 May 2024 13:36:57 -0700 Subject: [PATCH 02/20] [Clean-up] Fix deprecated protobuf function usages (#36640) Resolved the use of deprecated protobuf functions that would have caused clang-tidy issues with the upcoming protobuf release. The error encountered was: ``` 2024-05-15 16:47:15,874 9074 warnings generated. test/cpp/end2end/message_allocator_end2end_test.cc:330:38: error: 'CreateMessage' is deprecated: Use Create [clang-diagnostic-deprecated-declarations,-warnings-as-errors] 330 | google::protobuf::Arena::CreateMessage(&arena_)); | ^ bazel-out/k8-fastbuild/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/arena.h:179:3: note: 'CreateMessage' has been explicitly marked deprecated here 179 | ABSL_DEPRECATED("Use Create") | ^ external/com_google_absl/absl/base/attributes.h:683:49: note: expanded from macro 'ABSL_DEPRECATED' 683 | #define ABSL_DEPRECATED(message) __attribute__((deprecated(message))) | ^ test/cpp/end2end/message_allocator_end2end_test.cc:332:38: error: 'CreateMessage' is deprecated: Use Create [clang-diagnostic-deprecated-declarations,-warnings-as-errors] 332 | google::protobuf::Arena::CreateMessage(&arena_)); | ^ bazel-out/k8-fastbuild/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/protobuf_lite/google/protobuf/arena.h:179:3: note: 'CreateMessage' has been explicitly marked deprecated here 179 | ABSL_DEPRECATED("Use Create") | ^ external/com_google_absl/absl/base/attributes.h:683:49: note: expanded from macro 'ABSL_DEPRECATED' 683 | #define ABSL_DEPRECATED(message) __attribute__((deprecated(message))) | ``` Closes #36640 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36640 from veblush:protobuf-arena-create 522591a6ee21f8d873becfd9ec0019951b4bd5db PiperOrigin-RevId: 635912826 --- test/cpp/end2end/message_allocator_end2end_test.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/cpp/end2end/message_allocator_end2end_test.cc b/test/cpp/end2end/message_allocator_end2end_test.cc index 1ef6e8d4481..02ec6cd3fe5 100644 --- a/test/cpp/end2end/message_allocator_end2end_test.cc +++ b/test/cpp/end2end/message_allocator_end2end_test.cc @@ -326,10 +326,8 @@ class ArenaAllocatorTest : public MessageAllocatorEnd2endTestBase { class MessageHolderImpl : public MessageHolder { public: MessageHolderImpl() { - set_request( - google::protobuf::Arena::CreateMessage(&arena_)); - set_response( - google::protobuf::Arena::CreateMessage(&arena_)); + set_request(google::protobuf::Arena::Create(&arena_)); + set_response(google::protobuf::Arena::Create(&arena_)); } void Release() override { delete this; } void FreeRequest() override { CHECK(0); } From 3d1275ec17a38431e90507bb4cd6fc00882af61e Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Tue, 21 May 2024 14:28:43 -0700 Subject: [PATCH 03/20] C++20 compat: use invoke_result_t for C++17 and up (#36016) C++20 removes std::result_of in favor of std::invoke_result[_t], which was added in C++17. Android builds gRPC with C++20, but gRPC still supports source languages before C++17, so use `#if __cplusplus` to select between std::result_of or std::invoke_result[_t]. Closes #36016 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36016 from rprichard:cxx20-compat 00b89a2ff45228e35cdc0f286d253ccbcc21763e PiperOrigin-RevId: 635929424 --- src/core/lib/promise/detail/promise_like.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/lib/promise/detail/promise_like.h b/src/core/lib/promise/detail/promise_like.h index 8e73577675a..8be6165754e 100644 --- a/src/core/lib/promise/detail/promise_like.h +++ b/src/core/lib/promise/detail/promise_like.h @@ -76,7 +76,13 @@ class PromiseLike; template class PromiseLike::type>::value>> { +#if (defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703L) || \ + (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + std::invoke_result_t +#else + typename std::result_of::type +#endif + >::value>> { private: GPR_NO_UNIQUE_ADDRESS RemoveCVRef f_; From b0c7b8a8cea776f7204ba7d6b5504b03816c9d5d Mon Sep 17 00:00:00 2001 From: Eryu Xia Date: Tue, 21 May 2024 14:57:41 -0700 Subject: [PATCH 04/20] [ObjC] Split Basic Tests C/C++ MacOS jobs for faster execution Following attempt in https://github.com/grpc/grpc/pull/36190 PiperOrigin-RevId: 635937726 --- ..._cpp.cfg => grpc_basictests_c_cpp_dbg.cfg} | 2 +- .../macos/grpc_basictests_c_cpp_opt.cfg | 31 +++++++++++++++++++ ..._cpp.cfg => grpc_basictests_c_cpp_dbg.cfg} | 0 3 files changed, 32 insertions(+), 1 deletion(-) rename tools/internal_ci/macos/{grpc_basictests_c_cpp.cfg => grpc_basictests_c_cpp_dbg.cfg} (89%) create mode 100644 tools/internal_ci/macos/grpc_basictests_c_cpp_opt.cfg rename tools/internal_ci/macos/pull_request/{grpc_basictests_c_cpp.cfg => grpc_basictests_c_cpp_dbg.cfg} (100%) diff --git a/tools/internal_ci/macos/grpc_basictests_c_cpp.cfg b/tools/internal_ci/macos/grpc_basictests_c_cpp_dbg.cfg similarity index 89% rename from tools/internal_ci/macos/grpc_basictests_c_cpp.cfg rename to tools/internal_ci/macos/grpc_basictests_c_cpp_dbg.cfg index 53645ccf4b6..935bef11974 100644 --- a/tools/internal_ci/macos/grpc_basictests_c_cpp.cfg +++ b/tools/internal_ci/macos/grpc_basictests_c_cpp_dbg.cfg @@ -27,5 +27,5 @@ action { env_vars { key: "RUN_TESTS_FLAGS" - value: "-f basictests macos corelang --internal_ci -j 4 --inner_jobs 8 --bq_result_table aggregate_results" + value: "-f basictests macos corelang dbg --internal_ci -j 4 --inner_jobs 8 --bq_result_table aggregate_results" } diff --git a/tools/internal_ci/macos/grpc_basictests_c_cpp_opt.cfg b/tools/internal_ci/macos/grpc_basictests_c_cpp_opt.cfg new file mode 100644 index 00000000000..64048508589 --- /dev/null +++ b/tools/internal_ci/macos/grpc_basictests_c_cpp_opt.cfg @@ -0,0 +1,31 @@ +# Copyright 2019 The gRPC Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" +gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" +timeout_mins: 240 +action { + define_artifacts { + regex: "**/*sponge_log.*" + regex: "github/grpc/reports/**" + } +} + +env_vars { + key: "RUN_TESTS_FLAGS" + value: "-f basictests macos corelang opt --internal_ci -j 4 --inner_jobs 8 --bq_result_table aggregate_results" +} diff --git a/tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg b/tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp_dbg.cfg similarity index 100% rename from tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg rename to tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp_dbg.cfg From 40e578d330cc7a106c7fdaa2d51d14cd5a173212 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 21 May 2024 16:43:25 -0700 Subject: [PATCH 05/20] [OTel] Add find_package call for OTel dependency in installed gRPC configuration (#36674) Fix https://github.com/grpc/grpc/issues/36624 Closes #36674 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36674 from yashykt:OTelCMakeConfig 80366ae4d2b4df45d3a18ef3b49a46ba6db1c510 PiperOrigin-RevId: 635968262 --- cmake/gRPCConfig.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/gRPCConfig.cmake.in b/cmake/gRPCConfig.cmake.in index 98d8c6d8b9f..d552e0bb4e5 100644 --- a/cmake/gRPCConfig.cmake.in +++ b/cmake/gRPCConfig.cmake.in @@ -8,6 +8,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/modules) @_gRPC_FIND_CARES@ @_gRPC_FIND_ABSL@ @_gRPC_FIND_RE2@ +@_gRPC_FIND_OPENTELEMETRY@ # Targets include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake) From b3e061e086afa41d18579205c71daaf3b0202e39 Mon Sep 17 00:00:00 2001 From: AJ Heller Date: Tue, 21 May 2024 16:56:57 -0700 Subject: [PATCH 06/20] Pre-work for centralized trace flags PiperOrigin-RevId: 635971487 --- BUILD | 6 ++ bazel/grpc_build_system.bzl | 7 +++ src/core/lib/debug/trace_flags.cc | 13 +++++ src/core/lib/debug/trace_flags.h | 18 ++++++ src/core/lib/debug/trace_flags.yaml | 0 .../core/templates/trace_flags.cc.mako | 56 +++++++++++++++++++ .../codegen/core/templates/trace_flags.h.mako | 40 +++++++++++++ .../core/templates/trace_flags.md.mako | 48 ++++++++++++++++ 8 files changed, 188 insertions(+) create mode 100644 src/core/lib/debug/trace_flags.cc create mode 100644 src/core/lib/debug/trace_flags.h create mode 100644 src/core/lib/debug/trace_flags.yaml create mode 100644 tools/codegen/core/templates/trace_flags.cc.mako create mode 100644 tools/codegen/core/templates/trace_flags.h.mako create mode 100644 tools/codegen/core/templates/trace_flags.md.mako diff --git a/BUILD b/BUILD index 0c611f2db1e..6cfbe881c50 100644 --- a/BUILD +++ b/BUILD @@ -19,6 +19,7 @@ load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load( "//bazel:grpc_build_system.bzl", "grpc_cc_library", + "grpc_filegroup", "grpc_generate_one_off_targets", "grpc_upb_proto_library", "grpc_upb_proto_reflection_library", @@ -3037,6 +3038,11 @@ grpc_cc_library( ], ) +grpc_filegroup( + name = "trace_flag_files", + srcs = ["//src/core:lib/debug/trace_flags.yaml"], +) + grpc_cc_library( name = "load_config", srcs = [ diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 77756c28287..e26b1b34873 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -735,6 +735,13 @@ def grpc_package(name, visibility = "private", features = []): features = features, ) +def grpc_filegroup(name, srcs, **kwargs): + native.filegroup( + name = name, + srcs = srcs, + **kwargs + ) + def grpc_objc_library( name, srcs = [], diff --git a/src/core/lib/debug/trace_flags.cc b/src/core/lib/debug/trace_flags.cc new file mode 100644 index 00000000000..cdba9785c0b --- /dev/null +++ b/src/core/lib/debug/trace_flags.cc @@ -0,0 +1,13 @@ +// 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. diff --git a/src/core/lib/debug/trace_flags.h b/src/core/lib/debug/trace_flags.h new file mode 100644 index 00000000000..0f8228e58f1 --- /dev/null +++ b/src/core/lib/debug/trace_flags.h @@ -0,0 +1,18 @@ +// 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 GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H +#define GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H + +#endif // GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H diff --git a/src/core/lib/debug/trace_flags.yaml b/src/core/lib/debug/trace_flags.yaml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/codegen/core/templates/trace_flags.cc.mako b/tools/codegen/core/templates/trace_flags.cc.mako new file mode 100644 index 00000000000..401f5feed0c --- /dev/null +++ b/tools/codegen/core/templates/trace_flags.cc.mako @@ -0,0 +1,56 @@ +// 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. + +// +// Automatically generated by tools/codegen/core/gen_trace_flags.py +// + +#include "${absl_prefix}absl/container/flat_hash_map.h" + +#include "src/core/lib/debug/trace.h" +#include "src/core/lib/gprpp/no_destruct.h" + +namespace grpc_core { + +% for flag, settings in trace_flags.items(): +% if "debug_only" in settings and settings["debug_only"]: +DebugOnlyTraceFlag ${flag}_trace(${str(settings["default"]).lower()}, "${flag}"); +% endif +% endfor +% for flag, settings in trace_flags.items(): +% if "debug_only" not in settings or not settings["debug_only"]: +TraceFlag ${flag}_trace(${str(settings["default"]).lower()}, "${flag}"); +% endif +% endfor + +const absl::flat_hash_map& GetAllTraceFlags() { + static const NoDestruct> + all(absl::flat_hash_map({ +% for flag, settings in trace_flags.items(): +% if "debug_only" not in settings or not settings["debug_only"]: + {"${flag}", &${flag}_trace}, +% endif +% endfor +#ifndef NDEBUG +% for flag, settings in trace_flags.items(): +% if "debug_only" in settings and settings["debug_only"]: + {"${flag}", &${flag}_trace}, +% endif +% endfor +#endif + })); + return *all; +} + +} // namespace grpc_core diff --git a/tools/codegen/core/templates/trace_flags.h.mako b/tools/codegen/core/templates/trace_flags.h.mako new file mode 100644 index 00000000000..37cef8c9452 --- /dev/null +++ b/tools/codegen/core/templates/trace_flags.h.mako @@ -0,0 +1,40 @@ +// Copyright 2015 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. + +// +// Automatically generated by tools/codegen/core/gen_trace_flags.py +// + +#ifndef GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H +#define GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H + +#include "src/core/lib/debug/trace_impl.h" + + +namespace grpc_core { + +% for flag, settings in trace_flags.items(): +% if "debug_only" in settings and settings["debug_only"]: +extern DebugOnlyTraceFlag ${flag}_trace; +% endif +% endfor +% for flag, settings in trace_flags.items(): +% if not "debug_only" in settings or not settings["debug_only"]: +extern TraceFlag ${flag}_trace; +% endif +% endfor + +} // namespace grpc_core + +#endif // GRPC_SRC_CORE_LIB_DEBUG_TRACE_FLAGS_H diff --git a/tools/codegen/core/templates/trace_flags.md.mako b/tools/codegen/core/templates/trace_flags.md.mako new file mode 100644 index 00000000000..170c294d041 --- /dev/null +++ b/tools/codegen/core/templates/trace_flags.md.mako @@ -0,0 +1,48 @@ + + +gRPC Trace Flags +---------------- + +The `GRPC_TRACE` environment variable supports a comma-separated list of tracer +names or glob patterns that provide additional insight into how gRPC C core is +processing requests via debug logs. Available tracers include: + +% for flag, settings in trace_flags.items(): +% if "internal" in settings and settings["internal"]: +<% continue %> +% endif +% if "debug_only" not in settings or not settings["debug_only"]: +% if settings["description"]: + - ${flag} - ${settings["description"]} +% else: + - ${flag} +% endif +% endif +% endfor + +The following tracers will only run in binaries built in DEBUG mode. This is +accomplished by invoking `bazel build --config=dbg ` +% for flag, settings in trace_flags.items(): +% if "internal" in settings and settings["internal"]: +<% continue %> +% endif +% if "debug_only" in settings and settings["debug_only"]: +% if settings["description"]: + - ${flag} - ${settings["description"]} +% else: + - ${flag} +% endif +% endif +% endfor + +Glob patterns and special cases: + - `*` can be used to turn all traces on. + - Individual traces can be disabled by prefixing them with `-`. + - `*refcount*` will turn on all of the tracers for refcount debugging. + - if `list_tracers` is present, then all of the available tracers will be + printed when the program starts up. + +Example: +export GRPC_TRACE=*,-pending_tags From 7ab3cebdfceffe47203f36e86ebfb0a5b3825ccc Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Wed, 22 May 2024 01:14:08 -0700 Subject: [PATCH 07/20] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36694) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future. We have the following mapping 1. gpr_log(GPR_INFO,...) -> LOG(INFO) 2. gpr_log(GPR_ERROR,...) -> LOG(ERROR) 3. gpr_log(GPR_DEBUG,...) -> VLOG(2) Reviewers need to check : 1. If the above mapping is correct. 2. The content of the log is as before. gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected. Closes #36694 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36694 from tanvi-jagtap:python_codegen_gpr_log 54ee362e3d306c9b3685dfe02220d1f89bede098 PiperOrigin-RevId: 636071998 --- tools/codegen/core/gen_join.py | 10 +++++----- tools/codegen/core/gen_seq.py | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/tools/codegen/core/gen_join.py b/tools/codegen/core/gen_join.py index 83337653205..fe6c3a108c9 100755 --- a/tools/codegen/core/gen_join.py +++ b/tools/codegen/core/gen_join.py @@ -70,13 +70,13 @@ struct JoinState { % for i in range(0,n): if (!ready.is_set(${i})) { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(GPR_DEBUG, "join[%p]: begin poll joint ${i+1}/${n}", this); + VLOG(2) << "join[" << this << "]: begin poll joint ${i+1}/${n}"; } auto poll = promise${i}(); if (grpc_trace_promise_primitives.enabled()) { auto* p = poll.value_if_ready(); - gpr_log(GPR_DEBUG, "join[%p]: joint ${i+1}/${n} %s", this, - p != nullptr? (Traits::IsOk(*p)? "ready" : "early-error") : "pending"); + VLOG(2) << "join[" << this << "]: joint ${i+1}/${n} " + << (p != nullptr ? (Traits::IsOk(*p)? "ready" : "early-error") : "pending"); } if (auto* p = poll.value_if_ready()) { if (Traits::IsOk(*p)) { @@ -88,7 +88,7 @@ struct JoinState { } } } else if (grpc_trace_promise_primitives.enabled()) { - gpr_log(GPR_DEBUG, "join[%p]: joint ${i+1}/${n} already ready", this); + VLOG(2) << "join[" << this << "]: joint ${i+1}/${n} already ready"; } % endfor if (ready.all()) { @@ -109,12 +109,12 @@ front_matter = """ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "src/core/lib/gprpp/construct_destruct.h" #include "src/core/lib/promise/detail/promise_like.h" #include "src/core/lib/promise/poll.h" #include "src/core/lib/gprpp/bitset.h" -#include #include #include #include diff --git a/tools/codegen/core/gen_seq.py b/tools/codegen/core/gen_seq.py index c5d284c1a2f..dc2566d2fe5 100755 --- a/tools/codegen/core/gen_seq.py +++ b/tools/codegen/core/gen_seq.py @@ -143,16 +143,18 @@ tail${i}: % for i in range(0,n-1): case State::kState${i}: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, "seq[%p]: begin poll step ${i+1}/${n}", this); + VLOG(2).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step ${i+1}/${n}"; } auto result = ${"prior."*(n-1-i)}current_promise(); PromiseResult${i}* p = result.value_if_ready(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, "seq[%p]: poll step ${i+1}/${n} gets %s", this, - p != nullptr + VLOG(2).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step ${i+1}/${n} gets " + << (p != nullptr ? (PromiseResultTraits${i}::IsOk(*p) - ? "ready" - : absl::StrCat("early-error:", PromiseResultTraits${i}::ErrorString(*p)).c_str()) + ? "ready" + : absl::StrCat("early-error:", PromiseResultTraits${i}::ErrorString(*p)).c_str()) : "pending"); } if (p == nullptr) return Pending{}; @@ -170,11 +172,14 @@ tail${i}: default: case State::kState${n-1}: { if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, "seq[%p]: begin poll step ${n}/${n}", this); + VLOG(2).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: begin poll step ${n}/${n}"; } auto result = current_promise(); if (grpc_trace_promise_primitives.enabled()) { - gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG, "seq[%p]: poll step ${n}/${n} gets %s", this, result.ready()? "ready" : "pending"); + VLOG(2).AtLocation(whence.file(), whence.line()) + << "seq[" << this << "]: poll step ${n}/${n} gets " + << (result.ready()? "ready" : "pending"); } auto* p = result.value_if_ready(); if (p == nullptr) return Pending{}; @@ -198,11 +203,10 @@ front_matter = """ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/base/attributes.h" #include "absl/strings/str_cat.h" -#include - #include "src/core/lib/gprpp/construct_destruct.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/promise/detail/promise_factory.h" @@ -216,8 +220,8 @@ front_matter = """ // previous step and yield a promise. Note that most of the machinery in // PromiseFactory exists to make it possible for those promise-factory-like // objects to be anything that's convenient. -// Traits defines how we move from one step to the next. Traits sets up the -// wrapping and escape handling for the sequence. +// Traits defines how we move from one step to the next. Traits sets up the +// wrapping and escape handling for the sequence. // Promises return wrapped values that the trait can inspect and unwrap before // passing them to the next element of the sequence. The trait can // also interpret a wrapped value as an escape value, which terminates From 6b11ea0c3c2f365e2608b3292c3e38b39a9a8132 Mon Sep 17 00:00:00 2001 From: Matthew Stevenson Date: Wed, 22 May 2024 07:38:56 -0700 Subject: [PATCH 08/20] Create helper APIs for parsing PEM-encoded credentials. (#36357) In a follow-up PR, we will use these helper APIs to add validation checks when creating TLS credentials objects. Closes #36357 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36357 from matthewstevenson88:pem-util dca4f2e6c53017d1d3cd42854447b291e0a6d51f PiperOrigin-RevId: 636162540 --- src/core/tsi/ssl_transport_security_utils.cc | 57 ++++ src/core/tsi/ssl_transport_security_utils.h | 11 + .../tsi/ssl_transport_security_utils_test.cc | 243 +++++++++++++++--- 3 files changed, 271 insertions(+), 40 deletions(-) diff --git a/src/core/tsi/ssl_transport_security_utils.cc b/src/core/tsi/ssl_transport_security_utils.cc index 1a6747a60a2..18404627691 100644 --- a/src/core/tsi/ssl_transport_security_utils.cc +++ b/src/core/tsi/ssl_transport_security_utils.cc @@ -18,9 +18,15 @@ #include "src/core/tsi/ssl_transport_security_utils.h" +#include #include +#include #include +#include +#include +#include #include +#include #include #include "absl/log/check.h" @@ -374,4 +380,55 @@ absl::StatusOr AkidFromCrl(X509_CRL* crl) { return ret; } +absl::StatusOr> ParsePemCertificateChain( + absl::string_view cert_chain_pem) { + if (cert_chain_pem.empty()) { + return absl::InvalidArgumentError("Cert chain PEM is empty."); + } + BIO* in = BIO_new_mem_buf(cert_chain_pem.data(), cert_chain_pem.size()); + if (in == nullptr) { + return absl::InternalError("BIO_new_mem_buf failed."); + } + std::vector certs; + while (X509* cert = PEM_read_bio_X509(in, /*x=*/nullptr, /*cb=*/nullptr, + /*u=*/nullptr)) { + certs.push_back(cert); + } + + // We always have errors at this point because in the above loop we read until + // we reach the end of |cert_chain_pem|, which generates a "no start line" + // error. Therefore, this error is OK if we have successfully parsed some + // certificate data previously. + const int last_error = ERR_peek_last_error(); + if (ERR_GET_LIB(last_error) != ERR_LIB_PEM || + ERR_GET_REASON(last_error) != PEM_R_NO_START_LINE) { + for (X509* cert : certs) { + X509_free(cert); + } + BIO_free(in); + return absl::FailedPreconditionError("Invalid PEM."); + } + ERR_clear_error(); + BIO_free(in); + if (certs.empty()) { + return absl::NotFoundError("No certificates found."); + } + return certs; +} + +absl::StatusOr ParsePemPrivateKey( + absl::string_view private_key_pem) { + BIO* in = BIO_new_mem_buf(private_key_pem.data(), private_key_pem.size()); + if (in == nullptr) { + return absl::InvalidArgumentError("Private key PEM is empty."); + } + EVP_PKEY* pkey = + PEM_read_bio_PrivateKey(in, /*x=*/nullptr, /*cb=*/nullptr, /*u=*/nullptr); + BIO_free(in); + if (pkey == nullptr) { + return absl::NotFoundError("No private key found."); + } + return pkey; +} + } // namespace grpc_core diff --git a/src/core/tsi/ssl_transport_security_utils.h b/src/core/tsi/ssl_transport_security_utils.h index 6485c542de4..5676d8ff3a9 100644 --- a/src/core/tsi/ssl_transport_security_utils.h +++ b/src/core/tsi/ssl_transport_security_utils.h @@ -19,6 +19,7 @@ #ifndef GRPC_SRC_CORE_TSI_SSL_TRANSPORT_SECURITY_UTILS_H #define GRPC_SRC_CORE_TSI_SSL_TRANSPORT_SECURITY_UTILS_H +#include #include #include "absl/status/status.h" @@ -168,6 +169,16 @@ absl::StatusOr AkidFromCertificate(X509* cert); // crl. // return: a std::string of the DER encoding of the AKID or a status on failure. absl::StatusOr AkidFromCrl(X509_CRL* crl); + +// Returns a vector of X509 instances parsed from the given PEM-encoded +// certificate chain. Caller takes ownership of the X509 pointers in the output +// vector. +absl::StatusOr> ParsePemCertificateChain( + absl::string_view cert_chain_pem); + +// Returns an EVP_PKEY instance parsed from the non-empty PEM private key block +// in private_key_pem. Caller takes ownership of the EVP_PKEY pointer. +absl::StatusOr ParsePemPrivateKey(absl::string_view private_key_pem); } // namespace grpc_core #endif // GRPC_SRC_CORE_TSI_SSL_TRANSPORT_SECURITY_UTILS_H diff --git a/test/core/tsi/ssl_transport_security_utils_test.cc b/test/core/tsi/ssl_transport_security_utils_test.cc index 70edc02af13..5b64dc212df 100644 --- a/test/core/tsi/ssl_transport_security_utils_test.cc +++ b/test/core/tsi/ssl_transport_security_utils_test.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -43,6 +44,11 @@ namespace grpc_core { namespace testing { +using ::testing::ContainerEq; +using ::testing::NotNull; +using ::testing::TestWithParam; +using ::testing::ValuesIn; + const char* kValidCrl = "test/core/tsi/test_creds/crl_data/crls/current.crl"; const char* kCrlIssuer = "test/core/tsi/test_creds/crl_data/ca.pem"; const char* kModifiedSignature = @@ -60,10 +66,73 @@ const char* kCaWithAkid = "test/core/tsi/test_creds/crl_data/ca_with_akid.pem"; const char* kCrlWithAkid = "test/core/tsi/test_creds/crl_data/crl_with_akid.crl"; -using ::testing::ContainerEq; -using ::testing::NotNull; -using ::testing::TestWithParam; -using ::testing::ValuesIn; +constexpr absl::string_view kLeafCertPem = + "-----BEGIN CERTIFICATE-----\n" + "MIICZzCCAdCgAwIBAgIIN18/ctj3wpAwDQYJKoZIhvcNAQELBQAwKjEXMBUGA1UE\n" + "ChMOR29vZ2xlIFRFU1RJTkcxDzANBgNVBAMTBnRlc3RDQTAeFw0xNTAxMDEwMDAw\n" + "MDBaFw0yNTAxMDEwMDAwMDBaMC8xFzAVBgNVBAoTDkdvb2dsZSBURVNUSU5HMRQw\n" + "EgYDVQQDDAt0ZXN0X2NlcnRfMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA\n" + "20oOyI+fNCCeHJ3DNjGooPPP43Q6emhVvuWD8ppta582Rgxq/4j1bl9cPHdoCdyy\n" + "HsWFVUZzscj2qhClmlBAMEA595OU2NX2d81nSih5dwZWLMRQkEIzyxUR7Vee3eyo\n" + "nQD4HSamaevMSv79WTUBCozEGITqWnjYA152KUbA/IsCAwEAAaOBkDCBjTAOBgNV\n" + "HQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1Ud\n" + "EwEB/wQCMAAwGQYDVR0OBBIEECnFWP/UkDrV+SoXra58k64wGwYDVR0jBBQwEoAQ\n" + "p7JSbajiTZaIRUDSV1C81jAWBgNVHREEDzANggt0ZXN0X2NlcnRfMTANBgkqhkiG\n" + "9w0BAQsFAAOBgQCpJJssfN62T3G5z+5SBB+9KCzXnGxcTHtaTJkb04KLe+19EwhV\n" + "yRY4lZadKHjcNS6GCBogd069wNFUVYOU9VI7uUiEPdcTO+VRV5MYW0wjSi1zlkBZ\n" + "e8OAfYVeGUMfvThFpJ41f8vZ6GHgg95Lwv+Zh89SL8g1J3RWll9YVG8HWw==\n" + "-----END CERTIFICATE-----"; +constexpr absl::string_view kPrivateKeyPem = + "-----BEGIN RSA PRIVATE KEY-----\n" + "MIICXQIBAAKBgQDbSg7Ij580IJ4cncM2Maig88/jdDp6aFW+5YPymm1rnzZGDGr/\n" + "iPVuX1w8d2gJ3LIexYVVRnOxyPaqEKWaUEAwQDn3k5TY1fZ3zWdKKHl3BlYsxFCQ\n" + "QjPLFRHtV57d7KidAPgdJqZp68xK/v1ZNQEKjMQYhOpaeNgDXnYpRsD8iwIDAQAB\n" + "AoGAbq4kZApJeo/z/dGK0/GggQxOIylo0puSm7VQMcTL8YP8asKdxrgj2D99WG+U\n" + "LVYc+PcM4wuaHWOnTBL24roaitCNhrpIsJfWDkexzHXMj622SYlUcCuwsfjYOEyw\n" + "ntoNAnh0o4S+beYAfzT5VHCh4is9G9u+mwKYiGpJXROrYUECQQD4eq4nuGq3mfYJ\n" + "B0+md30paDVVCyBsuZTAtnu3MbRjMXy5LLE+vhno5nocvVSTOv3QC7Wk6yAa8/bG\n" + "iPT/MWixAkEA4e0zqPGo8tSimVv/1ei8Chyb+YqdSx+Oj5eZpa6X/KB/C1uS1tm6\n" + "DTgHW2GUhV4ypqdGH+t8quprJUtFuzqH+wJBAMRiicSg789eouMt4RjrdYPFdela\n" + "Gu1zm4rYb10xrqV7Vl0wYoH5U5cMmdSfGvomdLX6mzzWDJDg4ti1JBWRonECQQCD\n" + "Umtq0j1QGQUCe5Vz8zoJ7qNDI61WU1t8X7Rxt9CkiW4PXgU2WYxpzp2IImpAM4bh\n" + "k+2Q9EKc3nG1VdGMiPMtAkARkQF+pL8SBrUoh8G8glCam0brh3tW/cdW8L4UGTNF\n" + "2ZKC/LFH6DQBjYs3UXjvMGJxz4k9LysyY6o2Nf1JG6/L\n" + "-----END RSA PRIVATE KEY-----"; +constexpr absl::string_view kEcPrivateKeyPem = + "-----BEGIN PRIVATE KEY-----\n" + "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgOM7iHjJw/N6n8HtM\n" + "bVVVRhEYXoHFF+MSaTYQxOWM1p+hRANCAASMeWC+pIJAm/1fn0Wz3yyWGQzVPm9v\n" + "LCQo5JvK0a2t+Aa6d3AtLRwo6vh1VbJ8zFZxxIwyJNis3n1jRMWal7Vo\n" + "-----END PRIVATE KEY-----"; +constexpr absl::string_view kRsaPrivateKeyPem = + "-----BEGIN PRIVATE KEY-----\n" + "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCqyrzsrS8mWQwz\n" + "VFudLgte2kJX/pZ3KqJQBtMrkLxpgyJJU8mVBB+quDwnfH6PnQk+sF9omTlGAAxR\n" + "JzSEe8BS1Wnxld6rr6o/381VVW/2b+2kSifCtx/gVwCQQLnf4dbjfGW7ZClu1URG\n" + "ks2lK9T9BIh9SMSnYLEKEC8sWW1LibzJxHapFjIP88GrqgpPNGdEK7ABMsqHASuU\n" + "MvQ+0w7sdX2Pdu+Gm8ChxawvLiQVSh9ehtJiPl/jWbcZ6K3caTUxMf9tn8ky0DMK\n" + "xmHHmmxu19ehegzi7KSzjHmJ4QAtrtDaB/+ud0ZJ5l+pwfk7DL1TRjFYOyPVpExb\n" + "nLcQQxzfAgMBAAECggEATc+kFygnzQ7Q0iniu0+Y+pPxmelxX8VawZ76YmTEkkWe\n" + "P04fDvcb/kmFjm/XsVJYPelY7mywfUXUVrzH3nwK+TIl3FztX8beh89M203bfqkr\n" + "2ae3Sazopuq8ZPw4MtnPb0DjkGZnwgkD3CtR6ah4lvWTwZB/l8ojnnQVKd1sP/c4\n" + "LQSlVm2aiD6+D/NxbyJ4AOMWgUFrWBKqnV30mTZ5Lwv8fjznopgWMfsUl+Nx/HzV\n" + "J1ZRtLE+Z9euFJOUeMSEG1+YFxXAA3XuRdY/4PpzvK8Rlxb2rtJvt+dHojQCz66U\n" + "6PcspPt6MOcUFnpamJ513oKDwmdR8puRg7/bk2VKYQKBgQDVHz/NQaS8czTCkx8p\n" + "jXmZcGv1DH+T3SWeNI871BXQbSSKuqrOXDfzfrIFK7uXAWtIAOKLVaZOcSEDk+Rj\n" + "kbifkqRZuMy+iLdBLj/Gw3xVfkOb3m4g7OqWc7RBlfTCTCCUTVPiQkKZLGJ/eIJx\n" + "sGvdyJP6f12MODqUobgQC2UniQKBgQDNJ0vDHdqRQYI4zz1gAYDaCruRjtwWvRSL\n" + "tcBFlcVnMXjfZpxOKnGU1xEO4wDhEXra9yLwi/6IwGFtk0Zi2C9rYptniiURReuX\n" + "TkNNf1JmyZhYuSXD9Pg1Ssa/t3ZtauFzK1rHL1R1UB/pnD8xxuB4aAl+kZKi1Ie+\n" + "E6IXHuyfJwKBgQDOac+viq503tfww/Fgm2d0lw/YbNx7Z6rxiVJYzda64ZqMyrJ3\n" + "35VJPiJJI8wyOuue90xzSuch/ivNfUWssgwwcSTAyV10BJIIjTSz283mN75fjpT3\n" + "Sr8CLNoe05AVRwoe2K4v66D5HaXgc+VTG129lnDMIuOF1UfXgLH2yDKWkQKBgQC4\n" + "ajqQiqWPLXQB3UkupCtP1ZYGooT1a8KsVBUieB+bQ72EFJktKrovMaUD3MtNhokJ\n" + "jF68HRwRkd4CwgDjmbIGtf08ddIcVN4ShSe64lkQTOfF2ak5HVyBi1ZdwG2Urh87\n" + "iB1yL/mb+wq01N95v2zIz7y5KeLGvIXJN5zda88IwQKBgFLk68ZMEDMVCLpdvywb\n" + "bRC3rOl2CTHfXFD6RY0SIv4De+w7iQkYOn+4NIyG+hMfGfj5ooOO5gbsDyGagZqV\n" + "OLc6cW5HnwN+PERByn+hSoyGq8IOk8Vn5DeV7PoqIlbbdfUmTUx69EtzvViZoa+O\n" + "O2XDljPcjgc+pobqzebPIR6R\n" + "-----END PRIVATE KEY-----"; constexpr std::size_t kMaxPlaintextBytesPerTlsRecord = 16384; constexpr std::size_t kTlsRecordOverhead = 100; @@ -117,38 +186,6 @@ class FlowTest : public TestWithParam { return absl::InvalidArgumentError( "Client and server SSL object must not be null."); } - std::string cert_pem = - "-----BEGIN CERTIFICATE-----\n" - "MIICZzCCAdCgAwIBAgIIN18/ctj3wpAwDQYJKoZIhvcNAQELBQAwKjEXMBUGA1UE\n" - "ChMOR29vZ2xlIFRFU1RJTkcxDzANBgNVBAMTBnRlc3RDQTAeFw0xNTAxMDEwMDAw\n" - "MDBaFw0yNTAxMDEwMDAwMDBaMC8xFzAVBgNVBAoTDkdvb2dsZSBURVNUSU5HMRQw\n" - "EgYDVQQDDAt0ZXN0X2NlcnRfMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA\n" - "20oOyI+fNCCeHJ3DNjGooPPP43Q6emhVvuWD8ppta582Rgxq/4j1bl9cPHdoCdyy\n" - "HsWFVUZzscj2qhClmlBAMEA595OU2NX2d81nSih5dwZWLMRQkEIzyxUR7Vee3eyo\n" - "nQD4HSamaevMSv79WTUBCozEGITqWnjYA152KUbA/IsCAwEAAaOBkDCBjTAOBgNV\n" - "HQ8BAf8EBAMCBaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1Ud\n" - "EwEB/wQCMAAwGQYDVR0OBBIEECnFWP/UkDrV+SoXra58k64wGwYDVR0jBBQwEoAQ\n" - "p7JSbajiTZaIRUDSV1C81jAWBgNVHREEDzANggt0ZXN0X2NlcnRfMTANBgkqhkiG\n" - "9w0BAQsFAAOBgQCpJJssfN62T3G5z+5SBB+9KCzXnGxcTHtaTJkb04KLe+19EwhV\n" - "yRY4lZadKHjcNS6GCBogd069wNFUVYOU9VI7uUiEPdcTO+VRV5MYW0wjSi1zlkBZ\n" - "e8OAfYVeGUMfvThFpJ41f8vZ6GHgg95Lwv+Zh89SL8g1J3RWll9YVG8HWw==\n" - "-----END CERTIFICATE-----\n"; - std::string key_pem = - "-----BEGIN RSA PRIVATE KEY-----\n" - "MIICXQIBAAKBgQDbSg7Ij580IJ4cncM2Maig88/jdDp6aFW+5YPymm1rnzZGDGr/\n" - "iPVuX1w8d2gJ3LIexYVVRnOxyPaqEKWaUEAwQDn3k5TY1fZ3zWdKKHl3BlYsxFCQ\n" - "QjPLFRHtV57d7KidAPgdJqZp68xK/v1ZNQEKjMQYhOpaeNgDXnYpRsD8iwIDAQAB\n" - "AoGAbq4kZApJeo/z/dGK0/GggQxOIylo0puSm7VQMcTL8YP8asKdxrgj2D99WG+U\n" - "LVYc+PcM4wuaHWOnTBL24roaitCNhrpIsJfWDkexzHXMj622SYlUcCuwsfjYOEyw\n" - "ntoNAnh0o4S+beYAfzT5VHCh4is9G9u+mwKYiGpJXROrYUECQQD4eq4nuGq3mfYJ\n" - "B0+md30paDVVCyBsuZTAtnu3MbRjMXy5LLE+vhno5nocvVSTOv3QC7Wk6yAa8/bG\n" - "iPT/MWixAkEA4e0zqPGo8tSimVv/1ei8Chyb+YqdSx+Oj5eZpa6X/KB/C1uS1tm6\n" - "DTgHW2GUhV4ypqdGH+t8quprJUtFuzqH+wJBAMRiicSg789eouMt4RjrdYPFdela\n" - "Gu1zm4rYb10xrqV7Vl0wYoH5U5cMmdSfGvomdLX6mzzWDJDg4ti1JBWRonECQQCD\n" - "Umtq0j1QGQUCe5Vz8zoJ7qNDI61WU1t8X7Rxt9CkiW4PXgU2WYxpzp2IImpAM4bh\n" - "k+2Q9EKc3nG1VdGMiPMtAkARkQF+pL8SBrUoh8G8glCam0brh3tW/cdW8L4UGTNF\n" - "2ZKC/LFH6DQBjYs3UXjvMGJxz4k9LysyY6o2Nf1JG6/L\n" - "-----END RSA PRIVATE KEY-----\n"; // Create the context objects. SSL_CTX* client_ctx = nullptr; @@ -161,18 +198,22 @@ class FlowTest : public TestWithParam { server_ctx = SSL_CTX_new(TLSv1_2_method()); #endif - BIO* client_cert_bio(BIO_new_mem_buf(cert_pem.c_str(), cert_pem.size())); + BIO* client_cert_bio( + BIO_new_mem_buf(kLeafCertPem.data(), kLeafCertPem.size())); X509* client_cert = PEM_read_bio_X509(client_cert_bio, /*x=*/nullptr, /*cb=*/nullptr, /*u=*/nullptr); - BIO* client_key_bio(BIO_new_mem_buf(key_pem.c_str(), key_pem.size())); + BIO* client_key_bio( + BIO_new_mem_buf(kPrivateKeyPem.data(), kPrivateKeyPem.size())); EVP_PKEY* client_key = PEM_read_bio_PrivateKey(client_key_bio, /*x=*/nullptr, /*cb=*/nullptr, /*u=*/nullptr); - BIO* server_cert_bio(BIO_new_mem_buf(cert_pem.c_str(), cert_pem.size())); + BIO* server_cert_bio( + BIO_new_mem_buf(kLeafCertPem.data(), kLeafCertPem.size())); X509* server_cert = PEM_read_bio_X509(server_cert_bio, /*x=*/nullptr, /*cb=*/nullptr, /*u=*/nullptr); - BIO* server_key_bio(BIO_new_mem_buf(key_pem.c_str(), key_pem.size())); + BIO* server_key_bio( + BIO_new_mem_buf(kPrivateKeyPem.data(), kPrivateKeyPem.size())); EVP_PKEY* server_key = PEM_read_bio_PrivateKey(server_key_bio, /*x=*/nullptr, /*cb=*/nullptr, /*u=*/nullptr); @@ -673,6 +714,128 @@ TEST_F(CrlUtils, CrlAkidNullptr) { auto akid = AkidFromCrl(nullptr); EXPECT_EQ(akid.status().code(), absl::StatusCode::kInvalidArgument); } + +TEST(ParsePemCertificateChainTest, EmptyPem) { + EXPECT_EQ(ParsePemCertificateChain(/*cert_chain_pem=*/"").status(), + absl::InvalidArgumentError("Cert chain PEM is empty.")); +} + +TEST(ParsePemCertificateChainTest, InvalidPem) { + EXPECT_EQ(ParsePemCertificateChain("invalid-pem").status(), + absl::NotFoundError("No certificates found.")); +} + +TEST(ParsePemCertificateChainTest, PartialPem) { + std::string pem(kLeafCertPem); + EXPECT_EQ(ParsePemCertificateChain(pem.substr(0, pem.length() / 2)).status(), + absl::FailedPreconditionError("Invalid PEM.")); +} + +TEST(ParsePemCertificateChainTest, SingleCertSuccess) { + absl::StatusOr> certs = + ParsePemCertificateChain(kLeafCertPem); + EXPECT_EQ(certs.status(), absl::OkStatus()); + EXPECT_EQ(certs->size(), 1); + EXPECT_NE(certs->at(0), nullptr); + X509_free(certs->at(0)); +} + +TEST(ParsePemCertificateChainTest, MultipleCertFailure) { + EXPECT_EQ(ParsePemCertificateChain(absl::StrCat(kLeafCertPem, kLeafCertPem)) + .status(), + absl::FailedPreconditionError("Invalid PEM.")); +} + +TEST(ParsePemCertificateChainTest, MultipleCertSuccess) { + absl::StatusOr> certs = + ParsePemCertificateChain(absl::StrCat(kLeafCertPem, "\n", kLeafCertPem)); + EXPECT_EQ(certs.status(), absl::OkStatus()); + EXPECT_EQ(certs->size(), 2); + EXPECT_NE(certs->at(0), nullptr); + EXPECT_NE(certs->at(1), nullptr); + X509_free(certs->at(0)); + X509_free(certs->at(1)); +} + +TEST(ParsePemCertificateChainTest, MultipleCertWithExtraMiddleLinesSuccess) { + absl::StatusOr> certs = ParsePemCertificateChain( + absl::StrCat(kLeafCertPem, "\nGarbage\n", kLeafCertPem)); + EXPECT_EQ(certs.status(), absl::OkStatus()); + EXPECT_EQ(certs->size(), 2); + EXPECT_NE(certs->at(0), nullptr); + EXPECT_NE(certs->at(1), nullptr); + X509_free(certs->at(0)); + X509_free(certs->at(1)); +} + +TEST(ParsePemCertificateChainTest, MultipleCertWitManyMiddleLinesSuccess) { + absl::StatusOr> certs = ParsePemCertificateChain( + absl::StrCat(kLeafCertPem, "\n\n\n\n\n\n\n", kLeafCertPem)); + EXPECT_EQ(certs.status(), absl::OkStatus()); + EXPECT_EQ(certs->size(), 2); + EXPECT_NE(certs->at(0), nullptr); + EXPECT_NE(certs->at(1), nullptr); + X509_free(certs->at(0)); + X509_free(certs->at(1)); +} + +TEST(ParsePemCertificateChainTest, ValidCertWithInvalidSuffix) { + EXPECT_EQ(ParsePemCertificateChain(absl::StrCat(kLeafCertPem, "invalid-pem")) + .status(), + absl::FailedPreconditionError("Invalid PEM.")); +} + +TEST(ParsePemCertificateChainTest, ValidCertWithInvalidPrefix) { + EXPECT_EQ(ParsePemCertificateChain(absl::StrCat("invalid-pem", kLeafCertPem)) + .status(), + absl::NotFoundError("No certificates found.")); +} + +TEST(ParsePemCertificateChainTest, ValidCertWithInvalidLeadingLine) { + absl::StatusOr> certs = + ParsePemCertificateChain(absl::StrCat("invalid-pem\n", kLeafCertPem)); + EXPECT_EQ(certs.status(), absl::OkStatus()); + EXPECT_EQ(certs->size(), 1); + EXPECT_NE(certs->at(0), nullptr); + X509_free(certs->at(0)); +} + +TEST(ParsePemPrivateKeyTest, EmptyPem) { + EXPECT_EQ(ParsePemPrivateKey(/*private_key_pem=*/"").status(), + absl::NotFoundError("No private key found.")); +} + +TEST(ParsePemPrivateKeyTest, InvalidPem) { + EXPECT_EQ(ParsePemPrivateKey("invalid-pem").status(), + absl::NotFoundError("No private key found.")); +} + +TEST(ParsePemPrivateKeyTest, PartialPem) { + std::string pem(kPrivateKeyPem); + EXPECT_EQ(ParsePemPrivateKey(pem.substr(0, pem.length() / 2)).status(), + absl::NotFoundError("No private key found.")); +} + +TEST(ParsePemPrivateKeyTest, RsaSuccess1) { + absl::StatusOr pkey = ParsePemPrivateKey(kPrivateKeyPem); + EXPECT_EQ(pkey.status(), absl::OkStatus()); + EXPECT_NE(*pkey, nullptr); + EVP_PKEY_free(*pkey); +} + +TEST(ParsePemPrivateKeyTest, RsaSuccess2) { + absl::StatusOr pkey = ParsePemPrivateKey(kRsaPrivateKeyPem); + EXPECT_EQ(pkey.status(), absl::OkStatus()); + EXPECT_NE(*pkey, nullptr); + EVP_PKEY_free(*pkey); +} + +TEST(ParsePemPrivateKeyTest, EcSuccess) { + absl::StatusOr pkey = ParsePemPrivateKey(kEcPrivateKeyPem); + EXPECT_EQ(pkey.status(), absl::OkStatus()); + EXPECT_NE(*pkey, nullptr); + EVP_PKEY_free(*pkey); +} } // namespace testing } // namespace grpc_core From 990a422b1b14503fcddb614796b7f05d7d48f387 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Wed, 22 May 2024 09:05:14 -0700 Subject: [PATCH 09/20] [Python Server] Remove abstractmethod notation for add_registered_method_handlers (#36684) Remove `@abc.abstractmethod` so we don't break backward compatibility. Fix: https://github.com/grpc/grpc/issues/36683 Closes #36684 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36684 from XuanWang-Amos:remove_abstractmethod_for_registered_method f748fa6e7a5cddc7cdad8499a61f5dfd8e4b828c PiperOrigin-RevId: 636186951 --- src/python/grpcio/grpc/__init__.py | 2 -- src/python/grpcio/grpc/aio/_base_server.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index 406f5651516..8e1fb2631ad 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1454,7 +1454,6 @@ class Server(abc.ABC): """ raise NotImplementedError() - @abc.abstractmethod def add_registered_method_handlers(self, service_name, method_handlers): """Registers GenericRpcHandlers with this Server. @@ -1468,7 +1467,6 @@ class Server(abc.ABC): method_handlers: A dictionary that maps method names to corresponding RpcMethodHandler. """ - raise NotImplementedError() @abc.abstractmethod def add_insecure_port(self, address): diff --git a/src/python/grpcio/grpc/aio/_base_server.py b/src/python/grpcio/grpc/aio/_base_server.py index 9563a7875bc..6be8527b901 100644 --- a/src/python/grpcio/grpc/aio/_base_server.py +++ b/src/python/grpcio/grpc/aio/_base_server.py @@ -136,7 +136,6 @@ class Server(abc.ABC): A bool indicates if the operation times out. """ - @abc.abstractmethod def add_registered_method_handlers(self, service_name, method_handlers): """Registers GenericRpcHandlers with this Server. @@ -147,7 +146,6 @@ class Server(abc.ABC): method_handlers: A dictionary that maps method names to corresponding RpcMethodHandler. """ - raise NotImplementedError() # pylint: disable=too-many-public-methods From 44b7631d658e13f4fa3863328d41d31884649e03 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 22 May 2024 14:29:29 -0700 Subject: [PATCH 10/20] Temporary workaround to race condition Right now there's no ordering between the set context from the SetCall callback chain in server.cc, and the read context a few lines down from the new if statement inserted here -- that is if a call is cancelled whilst the server is initializing the context we see a tsan race. Until https://github.com/grpc/grpc/pull/36598 this was a non-issue however because we were entirely discarding the cancellation edge. Now that we've gotten that back again, this race is appearing. I'd like us to fix this properly, but to do so probably needs some deeper work on what contexts are and how they're initialized -- and that's not for this week (but maybe this month). PiperOrigin-RevId: 636295078 --- src/core/ext/filters/backend_metrics/backend_metric_filter.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/filters/backend_metrics/backend_metric_filter.cc b/src/core/ext/filters/backend_metrics/backend_metric_filter.cc index d9f02b41bf7..cdc78e0523a 100644 --- a/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +++ b/src/core/ext/filters/backend_metrics/backend_metric_filter.cc @@ -129,6 +129,7 @@ BackendMetricFilter::Create(const ChannelArgs&, ChannelFilter::Args) { } void BackendMetricFilter::Call::OnServerTrailingMetadata(ServerMetadata& md) { + if (md.get(GrpcCallWasCancelled()).value_or(false)) return; auto* ctx = &GetContext< grpc_call_context_element>()[GRPC_CONTEXT_BACKEND_METRIC_PROVIDER]; if (ctx == nullptr) { From 46d864aaac52a67cf565247737ce1437ee5c7e60 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Wed, 22 May 2024 14:58:31 -0700 Subject: [PATCH 11/20] [Python Otel] Deprecate target_attribute_filter (#36697) We decided to deprecate `target_attribute_filter` in https://github.com/grpc/proposal/pull/431. This PR marks the attribute as deprecated. Closes #36697 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36697 from XuanWang-Amos:deprecate_target_filter 9954bb403773d377e45aa6b37df7b17c65b0154f PiperOrigin-RevId: 636304089 --- .../grpc_observability/_open_telemetry_plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio_observability/grpc_observability/_open_telemetry_plugin.py b/src/python/grpcio_observability/grpc_observability/_open_telemetry_plugin.py index c2da412b95e..16c89d9594e 100644 --- a/src/python/grpcio_observability/grpc_observability/_open_telemetry_plugin.py +++ b/src/python/grpcio_observability/grpc_observability/_open_telemetry_plugin.py @@ -102,8 +102,10 @@ class OpenTelemetryPlugin: enabled for this OpenTelemetryPlugin. meter_provider: A MeterProvider which will be used to collect telemetry data, or None which means no metrics will be collected. - target_attribute_filter: Once provided, this will be called per channel to decide - whether to record the target attribute on client or to replace it with "other". + target_attribute_filter: [DEPRECATED] This attribute is deprecated and should + not be used. + Once provided, this will be 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). From 154081a92a89758241147031e0a73853c6878fbd Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Wed, 22 May 2024 21:56:10 -0700 Subject: [PATCH 12/20] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36678) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future. We have the following mapping 1. gpr_log(GPR_INFO,...) -> LOG(INFO) 2. gpr_log(GPR_ERROR,...) -> LOG(ERROR) 3. gpr_log(GPR_DEBUG,...) -> VLOG(2) Reviewers need to check : 1. If the above mapping is correct. 2. The content of the log is as before. gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected. Closes #36678 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36678 from tanvi-jagtap:test_cpp_gpr_log 81b8f4179f6111b902cbed9eb65ef6f41eb1e32d PiperOrigin-RevId: 636410944 --- .../CFStreamTests/CFStreamClientTests.mm | 4 +- .../CFStreamTests/CFStreamEndpointTests.mm | 2 +- .../ios/CFStreamTests/CFStreamClientTests.mm | 4 +- .../CFStreamTests/CFStreamEndpointTests.mm | 2 +- test/cpp/common/time_jump_test.cc | 10 ++-- test/cpp/common/timer_test.cc | 8 +-- test/cpp/end2end/async_end2end_test.cc | 4 +- .../end2end/client_callback_end2end_test.cc | 11 ++-- test/cpp/end2end/client_crash_test_server.cc | 4 +- .../end2end/context_allocator_end2end_test.cc | 4 +- test/cpp/end2end/crl_provider_test.cc | 6 +-- test/cpp/end2end/hybrid_end2end_test.cc | 19 +++---- .../end2end/message_allocator_end2end_test.cc | 4 +- test/cpp/end2end/mock_test.cc | 6 +-- test/cpp/end2end/port_sharing_end2end_test.cc | 16 +++--- test/cpp/end2end/rls_end2end_test.cc | 9 ++-- test/cpp/end2end/server_crash_test.cc | 4 +- test/cpp/end2end/server_crash_test_client.cc | 5 +- test/cpp/end2end/shutdown_test.cc | 4 +- test/cpp/end2end/ssl_credentials_test.cc | 4 +- test/cpp/end2end/streaming_throughput_test.cc | 5 +- test/cpp/end2end/thread_stress_test.cc | 10 ++-- test/cpp/end2end/tls_credentials_test.cc | 6 +-- .../end2end/xds/xds_cluster_end2end_test.cc | 10 ++-- test/cpp/end2end/xds/xds_core_end2end_test.cc | 11 ++-- test/cpp/end2end/xds/xds_csds_end2end_test.cc | 3 +- test/cpp/end2end/xds/xds_end2end_test.cc | 35 +++++++------ test/cpp/end2end/xds/xds_end2end_test_lib.cc | 26 +++++----- test/cpp/end2end/xds/xds_end2end_test_lib.h | 7 ++- .../xds/xds_override_host_end2end_test.cc | 5 +- .../end2end/xds/xds_routing_end2end_test.cc | 32 +++++++----- test/cpp/end2end/xds/xds_wrr_end2end_test.cc | 9 ++-- test/cpp/ext/filters/logging/library.h | 9 ++-- test/cpp/interop/backend_metrics_lb_policy.cc | 3 +- test/cpp/interop/client.cc | 17 +++---- test/cpp/interop/client_helper.cc | 12 ++--- test/cpp/interop/istio_echo_server.cc | 14 +++-- test/cpp/interop/istio_echo_server_lib.cc | 19 ++++--- .../observability_interop_server_bootstrap.cc | 3 +- test/cpp/interop/reconnect_interop_server.cc | 4 +- test/cpp/interop/stress_interop_client.cc | 8 +-- test/cpp/interop/xds_interop_server_lib.cc | 17 +++---- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 4 +- test/cpp/naming/address_sorting_test.cc | 5 +- test/cpp/naming/resolver_component_test.cc | 51 +++++++++---------- ...resolver_component_tests_runner_invoker.cc | 7 ++- test/cpp/performance/writes_per_rpc_test.cc | 9 ++-- test/cpp/qps/client_async.cc | 4 +- test/cpp/qps/client_sync.cc | 6 +-- test/cpp/qps/json_run_localhost.cc | 13 +++-- test/cpp/qps/parse_json.cc | 7 ++- test/cpp/qps/scenario_runner.cc | 9 ++-- test/cpp/qps/server.h | 7 +-- test/cpp/qps/server_async.cc | 15 +++--- test/cpp/qps/server_callback.cc | 7 ++- test/cpp/qps/server_sync.cc | 6 ++- .../cpp/thread_manager/thread_manager_test.cc | 5 +- 57 files changed, 276 insertions(+), 274 deletions(-) diff --git a/src/objective-c/tests/CFStreamTests/CFStreamClientTests.mm b/src/objective-c/tests/CFStreamTests/CFStreamClientTests.mm index 140d8609314..c78c090cb0a 100644 --- a/src/objective-c/tests/CFStreamTests/CFStreamClientTests.mm +++ b/src/objective-c/tests/CFStreamTests/CFStreamClientTests.mm @@ -85,7 +85,7 @@ static void must_fail(void* arg, grpc_error_handle error) { grpc_closure done; grpc_core::ExecCtx exec_ctx; - gpr_log(GPR_DEBUG, "test_succeeds"); + VLOG(2) << "test_succeeds"; auto resolved_addr = grpc_core::StringToSockaddr("127.0.0.1:0"); CHECK(resolved_addr.ok()); @@ -142,7 +142,7 @@ static void must_fail(void* arg, grpc_error_handle error) { grpc_closure done; int svr_fd; - gpr_log(GPR_DEBUG, "test_fails"); + VLOG(2) << "test_fails"; auto resolved_addr = grpc_core::StringToSockaddr("127.0.0.1:0"); CHECK(resolved_addr.ok()); diff --git a/src/objective-c/tests/CFStreamTests/CFStreamEndpointTests.mm b/src/objective-c/tests/CFStreamTests/CFStreamEndpointTests.mm index 97508b83cb8..b516040cdeb 100644 --- a/src/objective-c/tests/CFStreamTests/CFStreamEndpointTests.mm +++ b/src/objective-c/tests/CFStreamTests/CFStreamEndpointTests.mm @@ -112,7 +112,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch std::promise connected_promise; grpc_closure done; - gpr_log(GPR_DEBUG, "test_succeeds"); + VLOG(2) << "test_succeeds"; auto resolved_addr = grpc_core::StringToSockaddr("127.0.0.1:0"); struct sockaddr_in *addr = reinterpret_cast(resolved_addr->addr); diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm b/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm index 77adb057d24..0cbd7e997b8 100644 --- a/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamClientTests.mm @@ -84,7 +84,7 @@ static void must_fail(void* arg, grpc_error_handle error) { grpc_closure done; grpc_core::ExecCtx exec_ctx; - gpr_log(GPR_DEBUG, "test_succeeds"); + VLOG(2) << "test_succeeds"; auto resolved_addr = grpc_core::StringToSockaddr("127.0.0.1:0"); CHECK(resolved_addr.ok()); @@ -141,7 +141,7 @@ static void must_fail(void* arg, grpc_error_handle error) { grpc_closure done; int svr_fd; - gpr_log(GPR_DEBUG, "test_fails"); + VLOG(2) << "test_fails"; auto resolved_addr = grpc_core::StringToSockaddr("127.0.0.1:0"); CHECK(resolved_addr.ok()); diff --git a/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm b/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm index c5fe36482c7..5ba1c11ed3b 100644 --- a/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm +++ b/test/core/iomgr/ios/CFStreamTests/CFStreamEndpointTests.mm @@ -111,7 +111,7 @@ static bool compare_slice_buffer_with_buffer(grpc_slice_buffer *slices, const ch std::promise connected_promise; grpc_closure done; - gpr_log(GPR_DEBUG, "test_succeeds"); + VLOG(2) << "test_succeeds"; auto resolved_addr = grpc_core::StringToSockaddr("127.0.0.1:0"); struct sockaddr_in *addr = reinterpret_cast(resolved_addr->addr); diff --git a/test/cpp/common/time_jump_test.cc b/test/cpp/common/time_jump_test.cc index 8e7f4f7649c..ef7adb4ad02 100644 --- a/test/cpp/common/time_jump_test.cc +++ b/test/cpp/common/time_jump_test.cc @@ -26,10 +26,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/time/time.h" #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/sync.h" @@ -106,7 +106,7 @@ TEST_P(TimeJumpTest, TimerRunning) { gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(kWaitTimeMs)); // We expect 1 wakeup/sec when there are not timer expiries int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); - gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + VLOG(2) << "wakeups: " << wakeups; CHECK_LE(wakeups, 3); grpc_timer_cancel(&timer); } @@ -126,8 +126,8 @@ TEST_P(TimeJumpTest, TimedWait) { bool timedout = cond.WaitWithTimeout(&mu, absl::Milliseconds(kWaitTimeMs)); gpr_timespec after = gpr_now(GPR_CLOCK_MONOTONIC); int32_t elapsed_ms = gpr_time_to_millis(gpr_time_sub(after, before)); - gpr_log(GPR_DEBUG, "After wait, timedout = %d elapsed_ms = %d", timedout, - elapsed_ms); + VLOG(2) << "After wait, timedout = " << timedout + << " elapsed_ms = " << elapsed_ms; CHECK_EQ(timedout, 1); CHECK(1 == gpr_time_similar(gpr_time_sub(after, before), gpr_time_from_millis(kWaitTimeMs, GPR_TIMESPAN), @@ -137,7 +137,7 @@ TEST_P(TimeJumpTest, TimedWait) { } // We expect 1 wakeup/sec when there are not timer expiries int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); - gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + VLOG(2) << "wakeups: " << wakeups; CHECK_LE(wakeups, 3); } diff --git a/test/cpp/common/timer_test.cc b/test/cpp/common/timer_test.cc index edf5b64055e..3cc129cefb2 100644 --- a/test/cpp/common/timer_test.cc +++ b/test/cpp/common/timer_test.cc @@ -21,9 +21,9 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/time.h" @@ -105,7 +105,7 @@ TEST_F(TimerTest, OneTimerExpires) { // Actual number of wakeups is more due to bug // https://github.com/grpc/grpc/issues/19947 int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); - gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + VLOG(2) << "wakeups: " << wakeups; } TEST_F(TimerTest, MultipleTimersExpire) { @@ -135,7 +135,7 @@ TEST_F(TimerTest, MultipleTimersExpire) { // wakeups. Actual number of wakeups is more due to bug // https://github.com/grpc/grpc/issues/19947 int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); - gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + VLOG(2) << "wakeups: " << wakeups; } TEST_F(TimerTest, CancelSomeTimers) { @@ -177,7 +177,7 @@ TEST_F(TimerTest, CancelSomeTimers) { // Actual number of wakeups is more due to bug // https://github.com/grpc/grpc/issues/19947 int64_t wakeups = grpc_timer_manager_get_wakeups_testonly(); - gpr_log(GPR_DEBUG, "wakeups: %" PRId64 "", wakeups); + VLOG(2) << "wakeups: " << wakeups; } // Enable the following test after diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index e2ae51aefb8..b4f7657ecfc 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -21,13 +21,13 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include #include -#include #include #include #include @@ -276,7 +276,7 @@ std::ostream& operator<<(std::ostream& out, const TestScenario& scenario) { void TestScenario::Log() const { std::ostringstream out; out << *this; - gpr_log(GPR_DEBUG, "%s", out.str().c_str()); + VLOG(2) << out.str(); } class HealthCheck : public health::v1::Health::Service {}; diff --git a/test/cpp/end2end/client_callback_end2end_test.cc b/test/cpp/end2end/client_callback_end2end_test.cc index b811bfde48f..88ce497a590 100644 --- a/test/cpp/end2end/client_callback_end2end_test.cc +++ b/test/cpp/end2end/client_callback_end2end_test.cc @@ -26,6 +26,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include @@ -81,7 +82,7 @@ std::ostream& operator<<(std::ostream& out, const TestScenario& scenario) { void TestScenario::Log() const { std::ostringstream out; out << *this; - gpr_log(GPR_DEBUG, "%s", out.str().c_str()); + VLOG(2) << out.str(); } class ClientCallbackEnd2endTest @@ -669,7 +670,7 @@ class WriteClient : public grpc::ClientWriteReactor { } } void OnDone(const Status& s) override { - gpr_log(GPR_INFO, "Sent %d messages", num_msgs_sent_); + LOG(INFO) << "Sent " << num_msgs_sent_ << " messages"; int num_to_send = (client_cancel_.cancel) ? std::min(num_msgs_to_send_, client_cancel_.ops_before_cancel) @@ -958,7 +959,7 @@ class ReadClient : public grpc::ClientReadReactor { } } void OnDone(const Status& s) override { - gpr_log(GPR_INFO, "Read %d messages", reads_complete_); + LOG(INFO) << "Read " << reads_complete_ << " messages"; switch (server_try_cancel_) { case DO_NOT_CANCEL: if (!client_cancel_.cancel || client_cancel_.ops_before_cancel > @@ -1119,8 +1120,8 @@ class BidiClient : public grpc::ClientBidiReactor { MaybeWrite(); } void OnDone(const Status& s) override { - gpr_log(GPR_INFO, "Sent %d messages", writes_complete_); - gpr_log(GPR_INFO, "Read %d messages", reads_complete_); + LOG(INFO) << "Sent " << writes_complete_ << " messages"; + LOG(INFO) << "Read " << reads_complete_ << " messages"; switch (server_try_cancel_) { case DO_NOT_CANCEL: if (!client_cancel_.cancel || diff --git a/test/cpp/end2end/client_crash_test_server.cc b/test/cpp/end2end/client_crash_test_server.cc index 1d518a43ff4..441e8e3dbcb 100644 --- a/test/cpp/end2end/client_crash_test_server.cc +++ b/test/cpp/end2end/client_crash_test_server.cc @@ -21,8 +21,8 @@ #include #include "absl/flags/flag.h" +#include "absl/log/log.h" -#include #include #include #include @@ -46,7 +46,7 @@ class ServiceImpl final : public grpc::testing::EchoTestService::Service { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { - gpr_log(GPR_INFO, "recv msg %s", request.message().c_str()); + LOG(INFO) << "recv msg " << request.message(); response.set_message(request.message()); stream->Write(response); } diff --git a/test/cpp/end2end/context_allocator_end2end_test.cc b/test/cpp/end2end/context_allocator_end2end_test.cc index 78f984b6339..6b9b7a355e7 100644 --- a/test/cpp/end2end/context_allocator_end2end_test.cc +++ b/test/cpp/end2end/context_allocator_end2end_test.cc @@ -28,8 +28,8 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include #include @@ -70,7 +70,7 @@ std::ostream& operator<<(std::ostream& out, const TestScenario& scenario) { void TestScenario::Log() const { std::ostringstream out; out << *this; - gpr_log(GPR_INFO, "%s", out.str().c_str()); + LOG(INFO) << out.str(); } class ContextAllocatorEnd2endTestBase diff --git a/test/cpp/end2end/crl_provider_test.cc b/test/cpp/end2end/crl_provider_test.cc index b88d696d032..c8e332b0a12 100644 --- a/test/cpp/end2end/crl_provider_test.cc +++ b/test/cpp/end2end/crl_provider_test.cc @@ -22,6 +22,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" @@ -29,7 +30,6 @@ #include #include -#include #include #include #include @@ -147,8 +147,8 @@ void DoRpc(const std::string& server_addr, if (expect_success) { EXPECT_TRUE(result.ok()); if (!result.ok()) { - gpr_log(GPR_ERROR, "%s, %s", result.error_message().c_str(), - result.error_details().c_str()); + LOG(ERROR) << result.error_message().c_str() << ", " + << result.error_details().c_str(); } EXPECT_EQ(response.message(), kMessage); } else { diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index bb8b07da8ef..20b920f6276 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -22,6 +22,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -213,7 +214,7 @@ void HandleGenericCall(AsyncGenericService* service, "/grpc.testing.EchoTestService/RequestStream") { HandleGenericRequestStream(&stream, cq); } else { // other methods not handled yet. - gpr_log(GPR_ERROR, "method: %s", srv_ctx.method().c_str()); + LOG(ERROR) << "method: " << srv_ctx.method(); CHECK(0); } } @@ -572,7 +573,7 @@ class StreamedUnaryDupPkg EchoResponse resp; uint32_t next_msg_sz; stream->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "Streamed Unary Next Message Size is %u", next_msg_sz); + LOG(INFO) << "Streamed Unary Next Message Size is " << next_msg_sz; CHECK(stream->Read(&req)); resp.set_message(req.message() + "_dup"); CHECK(stream->Write(resp)); @@ -610,7 +611,7 @@ class FullyStreamedUnaryDupPkg EchoResponse resp; uint32_t next_msg_sz; stream->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "Streamed Unary Next Message Size is %u", next_msg_sz); + LOG(INFO) << "Streamed Unary Next Message Size is " << next_msg_sz; CHECK(stream->Read(&req)); resp.set_message(req.message() + "_dup"); CHECK(stream->Write(resp)); @@ -649,7 +650,7 @@ class SplitResponseStreamDupPkg EchoResponse resp; uint32_t next_msg_sz; stream->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "Split Streamed Next Message Size is %u", next_msg_sz); + LOG(INFO) << "Split Streamed Next Message Size is " << next_msg_sz; CHECK(stream->Read(&req)); for (int i = 0; i < kServerDefaultResponseStreamsToSend; i++) { resp.set_message(req.message() + std::to_string(i) + "_dup"); @@ -689,7 +690,7 @@ class FullySplitStreamedDupPkg EchoResponse resp; uint32_t next_msg_sz; stream->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "Split Streamed Next Message Size is %u", next_msg_sz); + LOG(INFO) << "Split Streamed Next Message Size is " << next_msg_sz; CHECK(stream->Read(&req)); for (int i = 0; i < kServerDefaultResponseStreamsToSend; i++) { resp.set_message(req.message() + std::to_string(i) + "_dup"); @@ -728,7 +729,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService { EchoResponse resp; uint32_t next_msg_sz; stream->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "Streamed Unary Next Message Size is %u", next_msg_sz); + LOG(INFO) << "Streamed Unary Next Message Size is " << next_msg_sz; CHECK(stream->Read(&req)); resp.set_message(req.message() + "_dup"); CHECK(stream->Write(resp)); @@ -741,7 +742,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService { EchoResponse resp; uint32_t next_msg_sz; stream->NextMessageSize(&next_msg_sz); - gpr_log(GPR_INFO, "Split Streamed Next Message Size is %u", next_msg_sz); + LOG(INFO) << "Split Streamed Next Message Size is " << next_msg_sz; CHECK(stream->Read(&req)); for (int i = 0; i < kServerDefaultResponseStreamsToSend; i++) { resp.set_message(req.message() + std::to_string(i) + "_dup"); @@ -812,8 +813,8 @@ TEST_P(HybridEnd2endTest, CallbackGenericEcho) { ServerGenericBidiReactor* CreateReactor( GenericCallbackServerContext* context) override { EXPECT_EQ(context->method(), "/grpc.testing.EchoTestService/Echo"); - gpr_log(GPR_DEBUG, "Constructor of generic service %d", - static_cast(context->deadline().time_since_epoch().count())); + VLOG(2) << "Constructor of generic service " + << context->deadline().time_since_epoch().count(); class Reactor : public ServerGenericBidiReactor { public: diff --git a/test/cpp/end2end/message_allocator_end2end_test.cc b/test/cpp/end2end/message_allocator_end2end_test.cc index 02ec6cd3fe5..5546f5685f5 100644 --- a/test/cpp/end2end/message_allocator_end2end_test.cc +++ b/test/cpp/end2end/message_allocator_end2end_test.cc @@ -29,8 +29,8 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include #include @@ -99,7 +99,7 @@ std::ostream& operator<<(std::ostream& out, const TestScenario& scenario) { void TestScenario::Log() const { std::ostringstream out; out << *this; - gpr_log(GPR_INFO, "%s", out.str().c_str()); + LOG(INFO) << out.str(); } class MessageAllocatorEnd2endTestBase diff --git a/test/cpp/end2end/mock_test.cc b/test/cpp/end2end/mock_test.cc index 512fe8dcbf1..f561ec70a20 100644 --- a/test/cpp/end2end/mock_test.cc +++ b/test/cpp/end2end/mock_test.cc @@ -22,10 +22,10 @@ #include #include +#include "absl/log/log.h" #include "absl/types/optional.h" #include -#include #include #include #include @@ -253,7 +253,7 @@ class TestServiceImpl : public EchoTestService::Service { EchoRequest request; std::string resp; while (reader->Read(&request)) { - gpr_log(GPR_INFO, "recv msg %s", request.message().c_str()); + LOG(INFO) << "recv msg " << request.message(); resp.append(request.message()); } response->set_message(resp); @@ -277,7 +277,7 @@ class TestServiceImpl : public EchoTestService::Service { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { - gpr_log(GPR_INFO, "recv msg %s", request.message().c_str()); + LOG(INFO) << "recv msg " << request.message(); response.set_message(request.message()); stream->Write(response); } diff --git a/test/cpp/end2end/port_sharing_end2end_test.cc b/test/cpp/end2end/port_sharing_end2end_test.cc index cf6f6f9fdef..05c03c79a93 100644 --- a/test/cpp/end2end/port_sharing_end2end_test.cc +++ b/test/cpp/end2end/port_sharing_end2end_test.cc @@ -22,10 +22,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include -#include #include #include #include @@ -85,7 +85,7 @@ std::ostream& operator<<(std::ostream& out, const TestScenario& scenario) { void TestScenario::Log() const { std::ostringstream out; out << *this; - gpr_log(GPR_ERROR, "%s", out.str().c_str()); + LOG(ERROR) << out.str(); } // Set up a test tcp server which is in charge of accepting connections and @@ -115,7 +115,7 @@ class TestTcpServer { void Start() { test_tcp_server_start(&tcp_server_, port_); - gpr_log(GPR_INFO, "Test TCP server started at %s", address_.c_str()); + LOG(INFO) << "Test TCP server started at " << address_; } const std::string& address() { return address_; } @@ -160,7 +160,7 @@ class TestTcpServer { void OnConnect(grpc_endpoint* tcp, grpc_pollset* /*accepting_pollset*/, grpc_tcp_server_acceptor* acceptor) { std::string peer(grpc_endpoint_get_peer(tcp)); - gpr_log(GPR_INFO, "Got incoming connection! from %s", peer.c_str()); + LOG(INFO) << "Got incoming connection! from " << peer; EXPECT_FALSE(acceptor->external_connection); listener_fd_ = grpc_tcp_server_port_fd( acceptor->from_server, acceptor->port_index, acceptor->fd_index); @@ -182,8 +182,9 @@ class TestTcpServer { Slice data(buf, read_bytes); p.read_buffer = ByteBuffer(&data, 1); } - gpr_log(GPR_INFO, "Handing off fd %d with data size %d from listener fd %d", - fd_, static_cast(p.read_buffer.Length()), listener_fd_); + LOG(INFO) << "Handing off fd " << fd_ << " with data size " + << static_cast(p.read_buffer.Length()) + << " from listener fd " << listener_fd_; connection_acceptor_->HandleNewConnection(&p); } @@ -224,8 +225,7 @@ class PortSharingEnd2endTest : public ::testing::TestWithParam { auto creds = GetCredentialsProvider()->GetServerCredentials( GetParam().credentials_type); builder.AddListeningPort(server_address_.str(), creds); - gpr_log(GPR_INFO, "gRPC server listening on %s", - server_address_.str().c_str()); + LOG(INFO) << "gRPC server listening on " << server_address_.str(); } auto server_creds = GetCredentialsProvider()->GetServerCredentials( GetParam().credentials_type); diff --git a/test/cpp/end2end/rls_end2end_test.cc b/test/cpp/end2end/rls_end2end_test.cc index ca6616fe6b7..618b9213c01 100644 --- a/test/cpp/end2end/rls_end2end_test.cc +++ b/test/cpp/end2end/rls_end2end_test.cc @@ -29,6 +29,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "absl/types/optional.h" @@ -417,7 +418,7 @@ class RlsEnd2endTest : public ::testing::Test { service_(std::forward(args)...) {} void Start() { - gpr_log(GPR_INFO, "starting %s server on port %d", type_.c_str(), port_); + LOG(INFO) << "starting " << type_ << " server on port " << port_; CHECK(!running_); running_ = true; service_.Start(); @@ -429,7 +430,7 @@ class RlsEnd2endTest : public ::testing::Test { thread_ = std::make_unique( std::bind(&ServerThread::Serve, this, &mu, &cond)); cond.Wait(&mu); - gpr_log(GPR_INFO, "%s server startup complete", type_.c_str()); + LOG(INFO) << type_ << " server startup complete"; } void Serve(grpc::internal::Mutex* mu, grpc::internal::CondVar* cond) { @@ -448,11 +449,11 @@ class RlsEnd2endTest : public ::testing::Test { void Shutdown() { if (!running_) return; - gpr_log(GPR_INFO, "%s about to shutdown", type_.c_str()); + LOG(INFO) << type_ << " about to shutdown"; service_.Shutdown(); server_->Shutdown(grpc_timeout_milliseconds_to_deadline(0)); thread_->join(); - gpr_log(GPR_INFO, "%s shutdown completed", type_.c_str()); + LOG(INFO) << type_ << " shutdown completed"; running_ = false; } diff --git a/test/cpp/end2end/server_crash_test.cc b/test/cpp/end2end/server_crash_test.cc index a2cbe5b836a..6973f054dcb 100644 --- a/test/cpp/end2end/server_crash_test.cc +++ b/test/cpp/end2end/server_crash_test.cc @@ -19,10 +19,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include -#include #include #include #include @@ -59,7 +59,7 @@ class ServiceImpl final : public grpc::testing::EchoTestService::Service { EchoRequest request; EchoResponse response; while (stream->Read(&request)) { - gpr_log(GPR_INFO, "recv msg %s", request.message().c_str()); + LOG(INFO) << "recv msg " << request.message(); response.set_message(request.message()); stream->Write(response); gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc index 29f4f1bddb0..4d2e266f025 100644 --- a/test/cpp/end2end/server_crash_test_client.cc +++ b/test/cpp/end2end/server_crash_test_client.cc @@ -23,8 +23,8 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include #include @@ -67,8 +67,7 @@ int main(int argc, char** argv) { CHECK(stream->Read(&response)); } } else { - gpr_log(GPR_ERROR, "invalid test mode '%s'", - absl::GetFlag(FLAGS_mode).c_str()); + LOG(ERROR) << "invalid test mode '" << absl::GetFlag(FLAGS_mode) << "'"; return 1; } } diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index 56cc55e72da..baae51856b5 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -21,9 +21,9 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include -#include #include #include #include @@ -132,7 +132,7 @@ std::vector GetAllCredentialsTypeList() { for (const string& type : credentials_types) { credentials_type_list.append(" " + type); } - gpr_log(GPR_INFO, "%s", credentials_type_list.c_str()); + LOG(INFO) << credentials_type_list; return credentials_types; } diff --git a/test/cpp/end2end/ssl_credentials_test.cc b/test/cpp/end2end/ssl_credentials_test.cc index de505e4b67e..325dc79068d 100644 --- a/test/cpp/end2end/ssl_credentials_test.cc +++ b/test/cpp/end2end/ssl_credentials_test.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/log/log.h" #include "absl/synchronization/notification.h" #include @@ -103,8 +104,7 @@ void DoRpc(const std::string& server_addr, grpc::Status result = stub->Echo(&context, request, &response); EXPECT_TRUE(result.ok()); if (!result.ok()) { - gpr_log(GPR_ERROR, "%s, %s", result.error_message().c_str(), - result.error_details().c_str()); + LOG(ERROR) << result.error_message() << ", " << result.error_details(); } EXPECT_EQ(response.message(), kMessage); std::shared_ptr auth_context = context.auth_context(); diff --git a/test/cpp/end2end/streaming_throughput_test.cc b/test/cpp/end2end/streaming_throughput_test.cc index 33fd20ae0a3..a7a3511d157 100644 --- a/test/cpp/end2end/streaming_throughput_test.cc +++ b/test/cpp/end2end/streaming_throughput_test.cc @@ -23,9 +23,10 @@ #include +#include "absl/log/log.h" + #include #include -#include #include #include #include @@ -177,7 +178,7 @@ TEST_F(End2endTest, StreamingThroughput) { request.set_message(kLargeString); ASSERT_TRUE(stream->Write(request)); if (i % 1000 == 0) { - gpr_log(GPR_INFO, "Send count = %d", i); + LOG(INFO) << "Send count = " << i; } } stream->WritesDone(); diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index 0c4b51610f4..45460855a10 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -22,6 +22,8 @@ #include +#include "absl/log/log.h" + #include #include #include @@ -285,8 +287,8 @@ static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs, if (!s.ok()) { if (!(allow_exhaustion && s.error_code() == StatusCode::RESOURCE_EXHAUSTED)) { - gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), - s.error_message().c_str()); + LOG(ERROR) << "RPC error: " << s.error_code() << ": " + << s.error_message(); } gpr_atm_no_barrier_fetch_add(errors, gpr_atm{1}); } else { @@ -316,7 +318,7 @@ TYPED_TEST(End2endTest, ThreadStress) { } uint64_t error_cnt = static_cast(gpr_atm_no_barrier_load(&errors)); if (error_cnt != 0) { - gpr_log(GPR_INFO, "RPC error count: %" PRIu64, error_cnt); + LOG(INFO) << "RPC error count: " << error_cnt; } // If this test allows resource exhaustion, expect that it actually sees some if (this->common_.AllowExhaustion()) { @@ -375,7 +377,7 @@ class AsyncClientEnd2endTest : public ::testing::Test { if (!cq_.Next(&got_tag, &ok)) break; AsyncClientCall* call = static_cast(got_tag); if (!ok) { - gpr_log(GPR_DEBUG, "Error: %d", call->status.error_code()); + VLOG(2) << "Error: " << call->status.error_code(); } delete call; diff --git a/test/cpp/end2end/tls_credentials_test.cc b/test/cpp/end2end/tls_credentials_test.cc index 75a3981b8b1..9e9c69b257c 100644 --- a/test/cpp/end2end/tls_credentials_test.cc +++ b/test/cpp/end2end/tls_credentials_test.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/log/log.h" #include "absl/synchronization/notification.h" #include @@ -114,9 +115,8 @@ void DoRpc(const std::string& server_addr, grpc::Status result = stub->Echo(&context, request, &response); EXPECT_TRUE(result.ok()); if (!result.ok()) { - gpr_log(GPR_ERROR, "Echo failed: %d, %s, %s", - static_cast(result.error_code()), - result.error_message().c_str(), result.error_details().c_str()); + LOG(ERROR) << "Echo failed: " << result.error_code() << ", " + << result.error_message() << ", " << result.error_details(); } EXPECT_EQ(response.message(), kMessage); } diff --git a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc index a162086b69e..e8f37fc35e8 100644 --- a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc @@ -913,8 +913,7 @@ TEST_P(EdsTest, LocalityMapUpdateChurn) { } const double kErrorTolerance = 0.2; for (size_t i = 0; i < 3; ++i) { - gpr_log(GPR_INFO, "Locality %" PRIuPTR " rate %f", i, - locality_picked_rates[i]); + LOG(INFO) << "Locality " << i << " rate " << locality_picked_rates[i]; EXPECT_THAT( locality_picked_rates[i], ::testing::AllOf( @@ -947,8 +946,7 @@ TEST_P(EdsTest, LocalityMapUpdateChurn) { kNumRpcs); } for (size_t i = 1; i < 4; ++i) { - gpr_log(GPR_INFO, "Locality %" PRIuPTR " rate %f", i, - locality_picked_rates[i]); + LOG(INFO) << "Locality " << i << " rate " << locality_picked_rates[i]; EXPECT_THAT( locality_picked_rates[i], ::testing::AllOf( @@ -1099,7 +1097,7 @@ TEST_P(EdsTest, DropConfigUpdate) { LOG(INFO) << "========= DONE WITH FIRST BATCH =========="; // The drop rate should be roughly equal to the expectation. double seen_drop_rate = static_cast(num_drops) / kNumRpcsLbOnly; - gpr_log(GPR_INFO, "First batch drop rate %f", seen_drop_rate); + LOG(INFO) << "First batch drop rate " << seen_drop_rate; EXPECT_THAT(seen_drop_rate, ::testing::DoubleNear(kDropRateForLb, kErrorTolerance)); // The second ADS response contains two drop categories, send an update EDS @@ -1136,7 +1134,7 @@ TEST_P(EdsTest, DropConfigUpdate) { LOG(INFO) << "========= DONE WITH SECOND BATCH =========="; // The new drop rate should be roughly equal to the expectation. seen_drop_rate = static_cast(num_drops) / kNumRpcsBoth; - gpr_log(GPR_INFO, "Second batch drop rate %f", seen_drop_rate); + LOG(INFO) << "Second batch drop rate " << seen_drop_rate; EXPECT_THAT(seen_drop_rate, ::testing::DoubleNear(kDropRateForLbAndThrottle, kErrorTolerance)); } diff --git a/test/cpp/end2end/xds/xds_core_end2end_test.cc b/test/cpp/end2end/xds/xds_core_end2end_test.cc index ebc97f4a8e8..abc1d20cf06 100644 --- a/test/cpp/end2end/xds/xds_core_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_core_end2end_test.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "src/core/client_channel/backup_poller.h" @@ -150,9 +151,9 @@ TEST_P(XdsClientTest, XdsStreamErrorPropagation) { balancer_->ads_service()->ForceADSFailure( Status(StatusCode::RESOURCE_EXHAUSTED, kErrorMessage)); auto status = SendRpc(); - gpr_log(GPR_INFO, - "XdsStreamErrorPropagation test: RPC got error: code=%d message=%s", - status.error_code(), status.error_message().c_str()); + LOG(INFO) << "XdsStreamErrorPropagation test: RPC got error: code=" + << status.error_code() + << " message=" << status.error_message().c_str(); EXPECT_THAT(status.error_code(), StatusCode::UNAVAILABLE); EXPECT_THAT(status.error_message(), ::testing::HasSubstr(kErrorMessage)); EXPECT_THAT(status.error_message(), @@ -288,8 +289,8 @@ TEST_P(GlobalXdsClientTest, MultipleBadLdsResources) { response->error_message == expected_message2) { return response; } - gpr_log(GPR_INFO, "non-matching NACK message: %s", - response->error_message.c_str()); + LOG(INFO) << "non-matching NACK message: " + << response->error_message.c_str(); } return absl::nullopt; }); diff --git a/test/cpp/end2end/xds/xds_csds_end2end_test.cc b/test/cpp/end2end/xds/xds_csds_end2end_test.cc index 897fd298148..cf498e060f8 100644 --- a/test/cpp/end2end/xds/xds_csds_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_csds_end2end_test.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/strip.h" @@ -343,7 +344,7 @@ TEST_P(ClientStatusDiscoveryServiceTest, XdsConfigDumpVanilla) { CheckRpcSendOk(DEBUG_LOCATION, kNumRpcs); // Fetches the client config auto csds_response = FetchCsdsResponse(); - gpr_log(GPR_INFO, "xDS config dump: %s", csds_response.DebugString().c_str()); + LOG(INFO) << "xDS config dump: " << csds_response.DebugString(); ASSERT_EQ(1, csds_response.config_size()); const auto& client_config = csds_response.config(0); // Validate the Node information diff --git a/test/cpp/end2end/xds/xds_end2end_test.cc b/test/cpp/end2end/xds/xds_end2end_test.cc index 9a8c8a9c52d..10f6e5febf1 100644 --- a/test/cpp/end2end/xds/xds_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_end2end_test.cc @@ -1077,15 +1077,16 @@ class XdsServerSecurityTest : public XdsEnd2endTest { } if (expected_status.has_value() && *expected_status != status.error_code()) { - gpr_log(GPR_ERROR, - "Expected status does not match Actual(%d) vs Expected(%d)", - status.error_code(), *expected_status); + LOG(ERROR) << "Expected status does not match Actual(" + << status.error_code() << ") vs Expected(" + << *expected_status << ")"; continue; } } else { if (!status.ok()) { - gpr_log(GPR_ERROR, "RPC failed. code=%d message=%s Trying again.", - status.error_code(), status.error_message().c_str()); + LOG(ERROR) << "RPC failed. code=" << status.error_code() + << " message=" << status.error_message() + << " Trying again."; continue; } EXPECT_EQ(response.message(), kRequestMessage); @@ -1095,23 +1096,21 @@ class XdsServerSecurityTest : public XdsEnd2endTest { std::string(entry.data(), entry.size()).c_str()); } if (peer_identity != expected_server_identity) { - gpr_log(GPR_ERROR, - "Expected server identity does not match. (actual) %s vs " - "(expected) %s Trying again.", - absl::StrJoin(peer_identity, ",").c_str(), - absl::StrJoin(expected_server_identity, ",").c_str()); + LOG(ERROR) << "Expected server identity does not match. (actual) " + << absl::StrJoin(peer_identity, ",") << " vs (expected) " + << absl::StrJoin(expected_server_identity, ",") + << " Trying again."; continue; } if (backends_[0]->backend_service()->last_peer_identity() != expected_client_identity) { - gpr_log( - GPR_ERROR, - "Expected client identity does not match. (actual) %s vs " - "(expected) %s Trying again.", - absl::StrJoin( - backends_[0]->backend_service()->last_peer_identity(), ",") - .c_str(), - absl::StrJoin(expected_client_identity, ",").c_str()); + LOG(ERROR) + << "Expected client identity does not match. (actual) " + << absl::StrJoin( + backends_[0]->backend_service()->last_peer_identity(), ",") + << " vs (expected) " + << absl::StrJoin(expected_client_identity, ",") + << " Trying again."; continue; } } diff --git a/test/cpp/end2end/xds/xds_end2end_test_lib.cc b/test/cpp/end2end/xds/xds_end2end_test_lib.cc index efccd9e0fb6..08d305c2a8a 100644 --- a/test/cpp/end2end/xds/xds_end2end_test_lib.cc +++ b/test/cpp/end2end/xds/xds_end2end_test_lib.cc @@ -27,6 +27,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -135,7 +136,7 @@ class XdsEnd2endTest::ServerThread::XdsChannelArgsServerBuilderOption // void XdsEnd2endTest::ServerThread::Start() { - gpr_log(GPR_INFO, "starting %s server on port %d", Type(), port_); + LOG(INFO) << "starting " << Type() << " server on port " << port_; CHECK(!running_); running_ = true; StartAllServices(); @@ -147,38 +148,38 @@ void XdsEnd2endTest::ServerThread::Start() { thread_ = std::make_unique( std::bind(&ServerThread::Serve, this, &mu, &cond)); cond.Wait(&mu); - gpr_log(GPR_INFO, "%s server startup complete", Type()); + LOG(INFO) << Type() << " server startup complete"; } void XdsEnd2endTest::ServerThread::Shutdown() { if (!running_) return; - gpr_log(GPR_INFO, "%s about to shutdown", Type()); + LOG(INFO) << Type() << " about to shutdown"; ShutdownAllServices(); server_->Shutdown(grpc_timeout_milliseconds_to_deadline(0)); thread_->join(); - gpr_log(GPR_INFO, "%s shutdown completed", Type()); + LOG(INFO) << Type() << " shutdown completed"; running_ = false; } void XdsEnd2endTest::ServerThread::StopListeningAndSendGoaways() { - gpr_log(GPR_INFO, "%s sending GOAWAYs", Type()); + LOG(INFO) << Type() << " sending GOAWAYs"; { grpc_core::ExecCtx exec_ctx; auto* server = grpc_core::Server::FromC(server_->c_server()); server->StopListening(); server->SendGoaways(); } - gpr_log(GPR_INFO, "%s done sending GOAWAYs", Type()); + LOG(INFO) << Type() << " done sending GOAWAYs"; } void XdsEnd2endTest::ServerThread::StopListening() { - gpr_log(GPR_INFO, "%s about to stop listening", Type()); + LOG(INFO) << Type() << " about to stop listening"; { grpc_core::ExecCtx exec_ctx; auto* server = grpc_core::Server::FromC(server_->c_server()); server->StopListening(); } - gpr_log(GPR_INFO, "%s stopped listening", Type()); + LOG(INFO) << Type() << " stopped listening"; } void XdsEnd2endTest::ServerThread::Serve(grpc_core::Mutex* mu, @@ -758,10 +759,8 @@ size_t XdsEnd2endTest::WaitForAllBackends( << debug_location.file() << ":" << debug_location.line(); }; } - gpr_log(GPR_INFO, - "========= WAITING FOR BACKENDS [%" PRIuPTR ", %" PRIuPTR - ") ==========", - start_index, stop_index); + LOG(INFO) << "========= WAITING FOR BACKENDS [" << start_index << ", " + << stop_index << ") =========="; size_t num_rpcs = 0; SendRpcsUntil( debug_location, @@ -772,8 +771,7 @@ size_t XdsEnd2endTest::WaitForAllBackends( }, wait_options.timeout_ms, rpc_options); if (wait_options.reset_counters) ResetBackendCounters(); - gpr_log(GPR_INFO, "Backends up; sent %" PRIuPTR " warm up requests", - num_rpcs); + LOG(INFO) << "Backends up; sent " << num_rpcs << " warm up requests"; return num_rpcs; } diff --git a/test/cpp/end2end/xds/xds_end2end_test_lib.h b/test/cpp/end2end/xds/xds_end2end_test_lib.h index af68e2b1c60..7ac0474a9f4 100644 --- a/test/cpp/end2end/xds/xds_end2end_test_lib.h +++ b/test/cpp/end2end/xds/xds_end2end_test_lib.h @@ -26,6 +26,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" @@ -946,10 +947,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam, size_t num_rpcs = ceil(p * (1 - p) * 5.00 * 5.00 / error_tolerance / error_tolerance); num_rpcs += 1000; // Add 1K as a buffer to avoid flakiness. - gpr_log(GPR_INFO, - "Sending %" PRIuPTR - " RPCs for percentage=%.3f error_tolerance=%.3f", - num_rpcs, p, error_tolerance); + LOG(INFO) << "Sending " << num_rpcs << " RPCs for percentage=" << p + << " error_tolerance=" << error_tolerance; return num_rpcs; } diff --git a/test/cpp/end2end/xds/xds_override_host_end2end_test.cc b/test/cpp/end2end/xds/xds_override_host_end2end_test.cc index 4e8bce1cdc5..b02ab1ae2ef 100644 --- a/test/cpp/end2end/xds/xds_override_host_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_override_host_end2end_test.cc @@ -18,6 +18,7 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "absl/strings/str_split.h" @@ -89,8 +90,8 @@ class OverrideHostTest : public XdsEnd2endTest { absl::StrSplit(key_value.second, ';'); std::string decoded; EXPECT_TRUE(absl::Base64Unescape(key_value2.first, &decoded)); - gpr_log(GPR_INFO, "set-cookie header: %s (decoded: %s)", - std::string(it->second).c_str(), decoded.c_str()); + LOG(INFO) << "set-cookie header: " << it->second + << " (decoded: " << decoded << ")"; values.emplace_back(ParseCookie(it->second)); EXPECT_FALSE(values.back().value.empty()); EXPECT_THAT(values.back().attributes, ::testing::Contains("HttpOnly")); diff --git a/test/cpp/end2end/xds/xds_routing_end2end_test.cc b/test/cpp/end2end/xds/xds_routing_end2end_test.cc index e9f3fbd0ad7..e24e78f3273 100644 --- a/test/cpp/end2end/xds/xds_routing_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_routing_end2end_test.cc @@ -20,6 +20,8 @@ #include #include +#include "absl/log/log.h" + #include "src/core/client_channel/backup_poller.h" #include "src/core/lib/config/config_vars.h" #include "src/proto/grpc/testing/xds/v3/fault.grpc.pb.h" @@ -979,8 +981,9 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedCluster) { EXPECT_EQ(0, backends_[2]->backend_service()->request_count()); const int weight_25_request_count = backends_[2]->backend_service1()->request_count(); - gpr_log(GPR_INFO, "target_75 received %d rpcs and target_25 received %d rpcs", - weight_75_request_count, weight_25_request_count); + LOG(INFO) << "target_75 received " << weight_75_request_count + << " rpcs and target_25 received " << weight_25_request_count + << " rpcs"; EXPECT_THAT(static_cast(weight_75_request_count) / kNumEcho1Rpcs, ::testing::DoubleNear(kWeight75Percent, kErrorTolerance)); EXPECT_THAT(static_cast(weight_25_request_count) / kNumEcho1Rpcs, @@ -1061,8 +1064,9 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedClusterNoIntegerOverflow) { EXPECT_EQ(0, backends_[2]->backend_service()->request_count()); const int weight2_request_count = backends_[2]->backend_service1()->request_count(); - gpr_log(GPR_INFO, "target1 received %d rpcs and target2 received %d rpcs", - weight1_request_count, weight2_request_count); + LOG(INFO) << "target1 received " << weight1_request_count + << " rpcs and target2 received " << weight2_request_count + << " rpcs"; EXPECT_THAT(static_cast(weight1_request_count) / kNumEcho1Rpcs, ::testing::DoubleNear(kWeight1Percent, kErrorTolerance)); EXPECT_THAT(static_cast(weight2_request_count) / kNumEcho1Rpcs, @@ -1129,8 +1133,9 @@ TEST_P(LdsRdsTest, RouteActionWeightedTargetDefaultRoute) { backends_[1]->backend_service()->request_count(); const int weight_25_request_count = backends_[2]->backend_service()->request_count(); - gpr_log(GPR_INFO, "target_75 received %d rpcs and target_25 received %d rpcs", - weight_75_request_count, weight_25_request_count); + LOG(INFO) << "target_75 received " << weight_75_request_count + << " rpcs and target_25 received " << weight_25_request_count + << " rpcs"; EXPECT_THAT(static_cast(weight_75_request_count) / kNumEchoRpcs, ::testing::DoubleNear(kWeight75Percent, kErrorTolerance)); EXPECT_THAT(static_cast(weight_25_request_count) / kNumEchoRpcs, @@ -1232,8 +1237,9 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateWeights) { backends_[2]->backend_service1()->request_count(); EXPECT_EQ(0, backends_[3]->backend_service()->request_count()); EXPECT_EQ(0, backends_[3]->backend_service1()->request_count()); - gpr_log(GPR_INFO, "target_75 received %d rpcs and target_25 received %d rpcs", - weight_75_request_count, weight_25_request_count); + LOG(INFO) << "target_75 received " << weight_75_request_count + << " rpcs and target_25 received " << weight_25_request_count + << " rpcs"; EXPECT_THAT(static_cast(weight_75_request_count) / kNumEcho1Rpcs7525, ::testing::DoubleNear(kWeight75Percent, kErrorTolerance)); EXPECT_THAT(static_cast(weight_25_request_count) / kNumEcho1Rpcs7525, @@ -1363,8 +1369,9 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateClusters) { EXPECT_EQ(0, backends_[2]->backend_service1()->request_count()); EXPECT_EQ(0, backends_[3]->backend_service()->request_count()); EXPECT_EQ(0, backends_[3]->backend_service1()->request_count()); - gpr_log(GPR_INFO, "target_75 received %d rpcs and target_25 received %d rpcs", - weight_75_request_count, weight_25_request_count); + LOG(INFO) << "target_75 received " << weight_75_request_count + << " rpcs and target_25 received " << weight_25_request_count + << " rpcs"; EXPECT_THAT(static_cast(weight_75_request_count) / kNumEcho1Rpcs7525, ::testing::DoubleNear(kWeight75Percent, kErrorTolerance)); EXPECT_THAT(static_cast(weight_25_request_count) / kNumEcho1Rpcs7525, @@ -1419,8 +1426,9 @@ TEST_P(LdsRdsTest, XdsRoutingWeightedClusterUpdateClusters) { EXPECT_EQ(0, backends_[2]->backend_service1()->request_count()); EXPECT_EQ(0, backends_[3]->backend_service()->request_count()); weight_25_request_count = backends_[3]->backend_service1()->request_count(); - gpr_log(GPR_INFO, "target_75 received %d rpcs and target_25 received %d rpcs", - weight_75_request_count, weight_25_request_count); + LOG(INFO) << "target_75 received " << weight_75_request_count + << " rpcs and target_25 received " << weight_25_request_count + << " rpcs"; EXPECT_THAT(static_cast(weight_75_request_count) / kNumEcho1Rpcs7525, ::testing::DoubleNear(kWeight75Percent, kErrorTolerance)); EXPECT_THAT(static_cast(weight_25_request_count) / kNumEcho1Rpcs7525, diff --git a/test/cpp/end2end/xds/xds_wrr_end2end_test.cc b/test/cpp/end2end/xds/xds_wrr_end2end_test.cc index 9a58443efa0..da8cea70f54 100644 --- a/test/cpp/end2end/xds/xds_wrr_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_wrr_end2end_test.cc @@ -19,6 +19,7 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -84,10 +85,10 @@ TEST_P(WrrTest, Basic) { size_t num_picks = 0; SendRpcsUntil(DEBUG_LOCATION, [&](const RpcResult&) { if (++num_picks == 13) { - gpr_log(GPR_INFO, "request counts: %" PRIuPTR " %" PRIuPTR " %" PRIuPTR, - backends_[0]->backend_service()->request_count(), - backends_[1]->backend_service()->request_count(), - backends_[2]->backend_service()->request_count()); + LOG(INFO) << "request counts: " + << backends_[0]->backend_service()->request_count() << " " + << backends_[1]->backend_service()->request_count() << " " + << backends_[2]->backend_service()->request_count(); if (backends_[0]->backend_service()->request_count() == 6 && backends_[1]->backend_service()->request_count() == 4 && backends_[2]->backend_service()->request_count() == 3) { diff --git a/test/cpp/ext/filters/logging/library.h b/test/cpp/ext/filters/logging/library.h index bce76c1a228..92b7311c5a6 100644 --- a/test/cpp/ext/filters/logging/library.h +++ b/test/cpp/ext/filters/logging/library.h @@ -22,6 +22,7 @@ #include #include // NOLINT +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "absl/time/time.h" @@ -58,10 +59,10 @@ class TestLoggingSink : public grpc_core::LoggingSink { grpc::internal::EntryToJsonStructProto(entry, &json); std::string output; ::google::protobuf::TextFormat::PrintToString(json, &output); - gpr_log(GPR_INFO, "%s", output.c_str()); - gpr_log(GPR_INFO, "trace_id: %s", entry.trace_id.c_str()); - gpr_log(GPR_INFO, "span_id: %s", entry.span_id.c_str()); - gpr_log(GPR_INFO, "is_sampled: %d", entry.is_sampled); + LOG(INFO) << output; + LOG(INFO) << "trace_id: " << entry.trace_id; + LOG(INFO) << "span_id: " << entry.span_id; + LOG(INFO) << "is_sampled: " << entry.is_sampled; grpc_core::MutexLock lock(&mu_); entries_.push_back(std::move(entry)); cv_.SignalAll(); diff --git a/test/cpp/interop/backend_metrics_lb_policy.cc b/test/cpp/interop/backend_metrics_lb_policy.cc index 216c537a9a6..55487bc221b 100644 --- a/test/cpp/interop/backend_metrics_lb_policy.cc +++ b/test/cpp/interop/backend_metrics_lb_policy.cc @@ -19,6 +19,7 @@ #include "test/cpp/interop/backend_metrics_lb_policy.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include @@ -264,7 +265,7 @@ LoadReportTracker::LoadReportEntry LoadReportTracker::WaitForOobLoadReport( auto report = std::move(oob_load_reports_.front()); oob_load_reports_.pop_front(); if (predicate(report)) { - gpr_log(GPR_DEBUG, "Report #%" PRIuPTR " matched", i + 1); + VLOG(2) << "Report #" << (i + 1) << " matched"; return report; } } diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 7d5a9dad71c..8a708c345da 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -20,10 +20,10 @@ #include #include "absl/flags/flag.h" +#include "absl/log/log.h" #include #include -#include #include #include #include @@ -186,8 +186,8 @@ ParseAdditionalMetadataFlag(const std::string& flag) { } } - gpr_log(GPR_INFO, "Adding additional metadata with key %s and value %s", - key.c_str(), value.c_str()); + LOG(INFO) << "Adding additional metadata with key " << key << " and value " + << value; additional_metadata.insert({key, value}); if (semicolon_pos == std::string::npos) { @@ -205,16 +205,14 @@ ParseAdditionalMetadataFlag(const std::string& flag) { int main(int argc, char** argv) { grpc::testing::TestEnvironment env(&argc, argv); grpc::testing::InitTest(&argc, &argv, true); - gpr_log(GPR_INFO, "Testing these cases: %s", - absl::GetFlag(FLAGS_test_case).c_str()); + LOG(INFO) << "Testing these cases: " << absl::GetFlag(FLAGS_test_case); int ret = 0; std::string test_case = absl::GetFlag(FLAGS_test_case); auto additional_metadata = ParseAdditionalMetadataFlag(absl::GetFlag(FLAGS_additional_metadata)); if (!additional_metadata.ok()) { - gpr_log(GPR_ERROR, "%s", - std::string(additional_metadata.status().message()).c_str()); + LOG(ERROR) << additional_metadata.status().message(); return 1; } grpc::testing::ChannelCreationFunc channel_creation_func = @@ -351,8 +349,9 @@ int main(int argc, char** argv) { if (!test_cases.empty()) test_cases += "\n"; test_cases += action.first; } - gpr_log(GPR_ERROR, "Unsupported test case %s. Valid options are\n%s", - absl::GetFlag(FLAGS_test_case).c_str(), test_cases.c_str()); + LOG(ERROR) << "Unsupported test case " << absl::GetFlag(FLAGS_test_case) + << ". Valid options are\n" + << test_cases; ret = 1; } diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index d9d10f1eeb9..8963aecc4ff 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -25,13 +25,13 @@ #include "absl/flags/declare.h" #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include "absl/strings/match.h" #include #include #include -#include #include #include #include @@ -70,7 +70,7 @@ std::string GetOauth2AccessToken() { std::shared_ptr creds = GoogleComputeEngineCredentials(); char* token = grpc_test_fetch_oauth2_token_with_credentials(creds->c_creds_); CHECK_NE(token, nullptr); - gpr_log(GPR_INFO, "Get raw oauth2 access token: %s", token); + LOG(INFO) << "Get raw oauth2 access token: " << token; std::string access_token(token + sizeof("Bearer ") - 1); gpr_free(token); return access_token; @@ -147,8 +147,7 @@ static void log_metadata_entry(const std::string& prefix, if (absl::EndsWith(key_str, "-bin")) { value_str = absl::Base64Escape(value_str); } - gpr_log(GPR_ERROR, "%s %s: %s", prefix.c_str(), key_str.c_str(), - value_str.c_str()); + LOG(ERROR) << prefix << " " << key_str << ": " << value_str; } void MetadataAndStatusLoggerInterceptor::Intercept( @@ -170,9 +169,8 @@ void MetadataAndStatusLoggerInterceptor::Intercept( } auto status = methods->GetRecvStatus(); - gpr_log(GPR_ERROR, "GRPC_STATUS %d", status->error_code()); - gpr_log(GPR_ERROR, "GRPC_ERROR_MESSAGE %s", - status->error_message().c_str()); + LOG(ERROR) << "GRPC_STATUS " << status->error_code(); + LOG(ERROR) << "GRPC_ERROR_MESSAGE " << status->error_message(); } methods->Proceed(); diff --git a/test/cpp/interop/istio_echo_server.cc b/test/cpp/interop/istio_echo_server.cc index 78175fdda9b..e81b1b2f170 100644 --- a/test/cpp/interop/istio_echo_server.cc +++ b/test/cpp/interop/istio_echo_server.cc @@ -30,6 +30,7 @@ #include "absl/algorithm/container.h" #include "absl/flags/flag.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" #include "absl/strings/str_split.h" @@ -114,8 +115,7 @@ void RunServer(const std::set& grpc_ports, const std::set& xds_ports, if (xds_ports.find(port) != xds_ports.end()) { xds_builder.AddListeningPort( server_address, XdsServerCredentials(InsecureServerCredentials())); - gpr_log(GPR_INFO, "Server listening on %s over xds", - server_address.c_str()); + LOG(INFO) << "Server listening on " << server_address << " over xds"; has_xds_listeners = true; } else if (tls_ports.find(port) != tls_ports.end()) { // Create Credentials for Tls Servers - @@ -130,12 +130,10 @@ void RunServer(const std::set& grpc_ports, const std::set& xds_ports, options.watch_identity_key_cert_pairs(); options.set_check_call_host(false); builder.AddListeningPort(server_address, TlsServerCredentials(options)); - gpr_log(GPR_INFO, "Server listening on %s over tls", - server_address.c_str()); + LOG(INFO) << "Server listening on " << server_address << " over tls"; } else { builder.AddListeningPort(server_address, InsecureServerCredentials()); - gpr_log(GPR_INFO, "Server listening on %s over insecure", - server_address.c_str()); + LOG(INFO) << "Server listening on " << server_address << " over insecure"; } } // Enable the default health check service, probably not needed though. @@ -206,7 +204,7 @@ int main(int argc, char** argv) { for (const auto& p : absl::GetFlag(FLAGS_xds_grpc_server)) { int port = 0; if (!absl::SimpleAtoi(p, &port)) { - gpr_log(GPR_ERROR, "SimpleAtoi Failure: %s", p.c_str()); + LOG(ERROR) << "SimpleAtoi Failure: " << p; return 1; } xds_ports.insert(port); @@ -220,7 +218,7 @@ int main(int argc, char** argv) { for (const auto& p : absl::GetFlag(FLAGS_tls)) { int port = 0; if (!absl::SimpleAtoi(p, &port)) { - gpr_log(GPR_ERROR, "SimpleAtoi Failure: %s", p.c_str()); + LOG(ERROR) << "SimpleAtoi Failure: " << p; return 1; } tls_ports.insert(port); diff --git a/test/cpp/interop/istio_echo_server_lib.cc b/test/cpp/interop/istio_echo_server_lib.cc index b9b7d3d1b68..cb39a15cf99 100644 --- a/test/cpp/interop/istio_echo_server_lib.cc +++ b/test/cpp/interop/istio_echo_server_lib.cc @@ -18,6 +18,7 @@ #include +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/str_split.h" @@ -109,7 +110,7 @@ Status EchoTestServiceImpl::Echo(ServerContext* context, absl::StrAppend(&s, kHostnameField, "=", this->hostname_, "\n"); absl::StrAppend(&s, "Echo=", request->message(), "\n"); response->set_message(s); - gpr_log(GPR_INFO, "Echo response:\n%s", s.c_str()); + LOG(INFO) << "Echo response:\n" << s; return Status::OK; } @@ -129,8 +130,7 @@ Status EchoTestServiceImpl::ForwardEcho(ServerContext* context, if (scheme == "xds") { // We can optionally add support for TLS creds, but we are primarily // concerned with proxyless-grpc here. - gpr_log(GPR_INFO, "Creating channel to %s using xDS Creds", - raw_url.c_str()); + LOG(INFO) << "Creating channel to " << raw_url << " using xDS Creds"; channel = CreateChannel(raw_url, XdsCredentials(InsecureChannelCredentials())); } else if (scheme == "grpc") { @@ -138,11 +138,11 @@ Status EchoTestServiceImpl::ForwardEcho(ServerContext* context, // this to be supported. If we ever decide to add support for this properly, // we would need to add support for TLS creds here. absl::string_view address = absl::StripPrefix(raw_url, "grpc://"); - gpr_log(GPR_INFO, "Creating channel to %s", std::string(address).c_str()); + LOG(INFO) << "Creating channel to " << address; channel = CreateChannel(std::string(address), InsecureChannelCredentials()); } else { - gpr_log(GPR_INFO, "Protocol %s not supported. Forwarding to %s", - scheme.c_str(), forwarding_address_.c_str()); + LOG(INFO) << "Protocol " << scheme << " not supported. Forwarding to " + << forwarding_address_; ClientContext forwarding_ctx; forwarding_ctx.set_deadline(context->deadline()); return forwarding_stub_->ForwardEcho(&forwarding_ctx, *request, response); @@ -197,11 +197,10 @@ Status EchoTestServiceImpl::ForwardEcho(ServerContext* context, absl::StrAppend(&body, absl::StrFormat("[%d body] %s\n", i, line)); } response->add_output(body); - gpr_log(GPR_INFO, "Forward Echo response:%d\n%s", i, body.c_str()); + LOG(INFO) << "Forward Echo response:" << i << "\n" << body; } else { - gpr_log(GPR_ERROR, "RPC %d failed %d: %s", i, - calls[i].status.error_code(), - calls[i].status.error_message().c_str()); + LOG(ERROR) << "RPC " << i << " failed " << calls[i].status.error_code() + << ": " << calls[i].status.error_message(); response->clear_output(); return calls[i].status; } diff --git a/test/cpp/interop/observability_interop_server_bootstrap.cc b/test/cpp/interop/observability_interop_server_bootstrap.cc index 65287fb0d62..f14755b5cd9 100644 --- a/test/cpp/interop/observability_interop_server_bootstrap.cc +++ b/test/cpp/interop/observability_interop_server_bootstrap.cc @@ -19,6 +19,7 @@ #include #include "absl/flags/flag.h" +#include "absl/log/log.h" #include @@ -44,7 +45,7 @@ int main(int argc, char** argv) { // TODO(someone): remove deprecated usage // NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations) auto status = grpc::experimental::GcpObservabilityInit(); - gpr_log(GPR_DEBUG, "GcpObservabilityInit() status_code: %d", status.code()); + VLOG(2) << "GcpObservabilityInit() status_code: " << status.code(); if (!status.ok()) { return 1; } diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc index b5370bca397..656bf77e906 100644 --- a/test/cpp/interop/reconnect_interop_server.cc +++ b/test/cpp/interop/reconnect_interop_server.cc @@ -27,9 +27,9 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include -#include #include #include #include @@ -167,7 +167,7 @@ void RunServer() { builder.AddListeningPort(server_address.str(), grpc::InsecureServerCredentials()); std::unique_ptr server(builder.BuildAndStart()); - gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str()); + LOG(INFO) << "Server listening on " << server_address.str(); while (!got_sigint) { service.Poll(5); } diff --git a/test/cpp/interop/stress_interop_client.cc b/test/cpp/interop/stress_interop_client.cc index b99e31158fa..91a33d2547c 100644 --- a/test/cpp/interop/stress_interop_client.cc +++ b/test/cpp/interop/stress_interop_client.cc @@ -23,9 +23,9 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include #include #include "src/core/lib/gprpp/crash.h" @@ -86,8 +86,8 @@ StressTestInteropClient::StressTestInteropClient( void StressTestInteropClient::MainLoop( const std::shared_ptr& qps_gauge) { - gpr_log(GPR_INFO, "Running test %d. ServerAddr: %s", test_id_, - server_address_.c_str()); + LOG(INFO) << "Running test " << test_id_ + << ". ServerAddr: " << server_address_; gpr_timespec test_end_time; if (test_duration_secs_ < 0) { @@ -103,7 +103,7 @@ void StressTestInteropClient::MainLoop( while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), test_end_time) < 0) { // Select the test case to execute based on the weights and execute it TestCaseType test_case = test_selector_.GetNextTest(); - gpr_log(GPR_DEBUG, "%d - Executing the test case %d", test_id_, test_case); + VLOG(2) << test_id_ << " - Executing the test case " << test_case; RunTest(test_case); qps_gauge->Incr(); diff --git a/test/cpp/interop/xds_interop_server_lib.cc b/test/cpp/interop/xds_interop_server_lib.cc index 12a26b16497..d1ee23381af 100644 --- a/test/cpp/interop/xds_interop_server_lib.cc +++ b/test/cpp/interop/xds_interop_server_lib.cc @@ -20,11 +20,11 @@ #include +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" #include -#include #include #include #include @@ -192,7 +192,7 @@ absl::optional GetStatusForRpcBehaviorMetadata( absl::string_view header_value, absl::string_view hostname) { for (auto part : absl::StrSplit(header_value, ' ')) { if (absl::ConsumePrefix(&part, kHostnameRpcBehaviorFilter)) { - gpr_log(GPR_INFO, "%s", std::string(part).c_str()); + LOG(INFO) << part; if (part.empty()) { return Status( grpc::StatusCode::INVALID_ARGUMENT, @@ -200,10 +200,8 @@ absl::optional GetStatusForRpcBehaviorMetadata( header_value)); } if (part != hostname) { - gpr_log( - GPR_DEBUG, - "RPC behavior for a different host: \"%s\", this one is: \"%s\"", - std::string(part).c_str(), std::string(hostname).c_str()); + VLOG(2) << "RPC behavior for a different host: \"" << std::string(part) + << "\", this one is: \"" << hostname << "\""; return absl::nullopt; } } else if (absl::ConsumePrefix(&part, kErrorCodeRpcBehavior)) { @@ -245,15 +243,14 @@ void RunServer(bool secure_mode, bool enable_csm_observability, int port, absl::StrCat("0.0.0.0:", port), grpc::XdsServerCredentials(grpc::InsecureServerCredentials())); xds_enabled_server = xds_builder.BuildAndStart(); - gpr_log(GPR_INFO, "Server starting on 0.0.0.0:%d", port); + LOG(INFO) << "Server starting on 0.0.0.0:" << port; ServerBuilder builder; maintenance_services.AddToServerBuilder(&builder); server = builder .AddListeningPort(absl::StrCat("0.0.0.0:", maintenance_port), grpc::InsecureServerCredentials()) .BuildAndStart(); - gpr_log(GPR_INFO, "Maintenance server listening on 0.0.0.0:%d", - maintenance_port); + LOG(INFO) << "Maintenance server listening on 0.0.0.0:" << maintenance_port; } else { // CSM Observability requires an xDS enabled server. auto builder = enable_csm_observability @@ -265,7 +262,7 @@ void RunServer(bool secure_mode, bool enable_csm_observability, int port, grpc::InsecureServerCredentials()) .RegisterService(&service) .BuildAndStart(); - gpr_log(GPR_INFO, "Server listening on 0.0.0.0:%d", port); + LOG(INFO) << "Server listening on 0.0.0.0:" << port; } server_callback(server.get()); server->Wait(); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index a0c34cc9666..9c752a6342f 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -26,11 +26,11 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/random/random.h" #include #include -#include #include "src/core/ext/transport/chttp2/transport/hpack_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser.h" @@ -135,7 +135,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { char* s = grpc_dump_slice(outbuf.slices[i], GPR_DUMP_HEX); - gpr_log(GPR_DEBUG, "%" PRIdPTR ": %s", i, s); + VLOG(2) << i << ": " << s; gpr_free(s); } } diff --git a/test/cpp/naming/address_sorting_test.cc b/test/cpp/naming/address_sorting_test.cc index 0ce5a1d5150..563ce7d8a36 100644 --- a/test/cpp/naming/address_sorting_test.cc +++ b/test/cpp/naming/address_sorting_test.cc @@ -25,10 +25,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include -#include #include #include #include @@ -120,8 +120,7 @@ class MockSourceAddrFactory : public address_sorting_source_addr_factory { .value(); auto it = dest_addr_to_src_addr_.find(ip_addr_str); if (it == dest_addr_to_src_addr_.end()) { - gpr_log(GPR_DEBUG, "can't find |%s| in dest to src map", - ip_addr_str.c_str()); + VLOG(2) << "can't find |" << ip_addr_str << "| in dest to src map"; return false; } grpc_resolved_address source_addr_as_resolved_addr = diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index 78909d9eb17..d42e5f7dda1 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -28,6 +28,7 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" @@ -35,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -241,8 +241,8 @@ void PollPollsetUntilRequestDone(ArgsStruct* args) { } gpr_timespec time_left = gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); - gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09d", args->done, - time_left.tv_sec, time_left.tv_nsec); + VLOG(2) << "done=" << args->done << ", time_left=" << time_left.tv_sec + << "." << absl::StrFormat("%09d", time_left.tv_nsec); CHECK_GE(gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)), 0); grpc_pollset_worker* worker = nullptr; grpc_core::ExecCtx exec_ctx; @@ -342,11 +342,11 @@ class CheckingResultHandler : public ResultHandler { AddActualAddresses(*balancer_addresses, /*is_balancer=*/true, &found_lb_addrs); } - gpr_log(GPR_INFO, - "found %" PRIdPTR " backend addresses and %" PRIdPTR - " balancer addresses", - result.addresses->size(), - balancer_addresses == nullptr ? 0L : balancer_addresses->size()); + LOG(INFO) << "found " << result.addresses->size() + << " backend addresses and " + << (balancer_addresses == nullptr ? 0L + : balancer_addresses->size()) + << " balancer addresses"; if (args->expected_addrs.size() != found_lb_addrs.size()) { grpc_core::Crash(absl::StrFormat("found lb addrs size is: %" PRIdPTR ". expected addrs size is %" PRIdPTR, @@ -359,10 +359,10 @@ class CheckingResultHandler : public ResultHandler { EXPECT_THAT(args->expected_addrs, UnorderedElementsAreArray(found_lb_addrs)); } else { - gpr_log(GPR_ERROR, - "Invalid for setting for --do_ordered_address_comparison. " - "Have %s, want True or False", - absl::GetFlag(FLAGS_do_ordered_address_comparison).c_str()); + LOG(ERROR) << "Invalid for setting for --do_ordered_address_comparison. " + "Have " + << absl::GetFlag(FLAGS_do_ordered_address_comparison) + << ", want True or False"; CHECK(0); } if (!result.service_config.ok()) { @@ -389,7 +389,7 @@ class CheckingResultHandler : public ResultHandler { std::string str = grpc_sockaddr_to_string(&addr.address(), true /* normalize */) .value(); - gpr_log(GPR_INFO, "%s", str.c_str()); + LOG(INFO) << str; out->emplace_back(GrpcLBAddress(std::move(str), is_balancer)); } } @@ -409,11 +409,9 @@ void InjectBrokenNameServerList(ares_channel* channel) { CHECK(grpc_core::SplitHostPort( absl::GetFlag(FLAGS_local_dns_server_address).c_str(), &unused_host, &local_dns_server_port)); - gpr_log(GPR_DEBUG, - "Injecting broken nameserver list. Bad server address:|[::1]:%d|. " - "Good server address:%s", - g_fake_non_responsive_dns_server_port, - absl::GetFlag(FLAGS_local_dns_server_address).c_str()); + VLOG(2) << "Injecting broken nameserver list. Bad server address:|[::1]:" + << g_fake_non_responsive_dns_server_port << "|. Good server address:" + << absl::GetFlag(FLAGS_local_dns_server_address); // Put the non-responsive DNS server at the front of c-ares's nameserver list. dns_server_addrs[0].family = AF_INET6; (reinterpret_cast(&dns_server_addrs[0].addr.addr6))[15] = 0x1; @@ -450,9 +448,8 @@ void RunResolvesRelevantRecordsTest( args.expected_lb_policy = absl::GetFlag(FLAGS_expected_lb_policy); // maybe build the address with an authority std::string whole_uri; - gpr_log(GPR_DEBUG, - "resolver_component_test: --inject_broken_nameserver_list: %s", - absl::GetFlag(FLAGS_inject_broken_nameserver_list).c_str()); + VLOG(2) << "resolver_component_test: --inject_broken_nameserver_list: " + << absl::GetFlag(FLAGS_inject_broken_nameserver_list); std::unique_ptr fake_non_responsive_dns_server; if (absl::GetFlag(FLAGS_inject_broken_nameserver_list) == "True") { @@ -471,16 +468,16 @@ void RunResolvesRelevantRecordsTest( } whole_uri = absl::StrCat("dns:///", absl::GetFlag(FLAGS_target_name)); } else if (absl::GetFlag(FLAGS_inject_broken_nameserver_list) == "False") { - gpr_log(GPR_INFO, "Specifying authority in uris to: %s", - absl::GetFlag(FLAGS_local_dns_server_address).c_str()); + LOG(INFO) << "Specifying authority in uris to: " + << absl::GetFlag(FLAGS_local_dns_server_address); whole_uri = absl::StrFormat("dns://%s/%s", absl::GetFlag(FLAGS_local_dns_server_address), absl::GetFlag(FLAGS_target_name)); } else { grpc_core::Crash("Invalid value for --inject_broken_nameserver_list."); } - gpr_log(GPR_DEBUG, "resolver_component_test: --enable_srv_queries: %s", - absl::GetFlag(FLAGS_enable_srv_queries).c_str()); + VLOG(2) << "resolver_component_test: --enable_srv_queries: " + << absl::GetFlag(FLAGS_enable_srv_queries); // By default, SRV queries are disabled, so tests that expect no SRV query // should avoid setting any channel arg. Test cases that do rely on the SRV // query must explicitly enable SRV though. @@ -489,8 +486,8 @@ void RunResolvesRelevantRecordsTest( } else if (absl::GetFlag(FLAGS_enable_srv_queries) != "False") { grpc_core::Crash("Invalid value for --enable_srv_queries."); } - gpr_log(GPR_DEBUG, "resolver_component_test: --enable_txt_queries: %s", - absl::GetFlag(FLAGS_enable_txt_queries).c_str()); + VLOG(2) << "resolver_component_test: --enable_txt_queries: " + << absl::GetFlag(FLAGS_enable_txt_queries); // By default, TXT queries are disabled, so tests that expect no TXT query // should avoid setting any channel arg. Test cases that do rely on the TXT // query must explicitly enable TXT though. diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc index c5e4dc7d8f1..4fb67300c5c 100644 --- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc +++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc @@ -28,11 +28,11 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include #include -#include #include #include "src/core/lib/gprpp/crash.h" @@ -128,9 +128,8 @@ int main(int argc, char** argv) { // an indication whether the test is running on RBE or not. Find a better way of // doing this. #ifndef GRPC_PORT_ISOLATED_RUNTIME - gpr_log(GPR_ERROR, - "You are invoking the test locally with Bazel, you may need to " - "invoke Bazel with --enable_runfiles=yes."); + LOG(ERROR) << "You are invoking the test locally with Bazel, you may need " + "to invoke Bazel with --enable_runfiles=yes."; #endif // GRPC_PORT_ISOLATED_RUNTIME result = grpc::testing::InvokeResolverComponentTestsRunner( grpc::testing::NormalizeFilePath( diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index 9bd8f009334..5811cbaee85 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -21,8 +21,8 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include #include @@ -262,10 +262,9 @@ static double UnaryPingPong(ThreadedFuzzingEventEngine* fuzzing_engine, auto end_stats = grpc_core::global_stats().Collect()->Diff(*baseline); double writes_per_iteration = end_stats->syscall_write / static_cast(kIterations); - gpr_log(GPR_DEBUG, - "UnaryPingPong(%d, %d): writes_per_iteration=%0.3f (total=%lu)", - request_size, response_size, writes_per_iteration, - end_stats->syscall_write); + VLOG(2) << "UnaryPingPong(" << request_size << ", " << response_size + << "): writes_per_iteration=" << writes_per_iteration + << " (total=" << end_stats->syscall_write << ")"; fixture.reset(); server_env[0]->~ServerEnv(); diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 18f9b4bad6e..11fd6b89e62 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -28,11 +28,11 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include #include -#include #include #include #include @@ -227,7 +227,7 @@ class AsyncClient : public ClientImpl { int num_threads = config.async_client_threads(); if (num_threads <= 0) { // Use dynamic sizing num_threads = cores_; - gpr_log(GPR_INFO, "Sizing async client to %d threads", num_threads); + LOG(INFO) << "Sizing async client to " << num_threads << " threads"; } return num_threads; } diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 92ed2c11fff..eb1d8aeea72 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -25,10 +25,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include -#include #include #include #include @@ -182,8 +182,8 @@ class SynchronousStreamingClient : public SynchronousClient { if (!s.ok()) { std::lock_guard l(stream_mu_[thread_idx]); if (!shutdown_[thread_idx].val) { - gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", - thread_idx, s.error_message().c_str()); + LOG(ERROR) << "Stream " << thread_idx << " received an error " + << s.error_message(); } } // Lock the stream_mu_ now because the client context could change diff --git a/test/cpp/qps/json_run_localhost.cc b/test/cpp/qps/json_run_localhost.cc index cc44252ea2a..8bc842328c9 100644 --- a/test/cpp/qps/json_run_localhost.cc +++ b/test/cpp/qps/json_run_localhost.cc @@ -29,8 +29,7 @@ #endif #include "absl/log/check.h" - -#include +#include "absl/log/log.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/env.h" @@ -71,13 +70,13 @@ static void register_sighandler() { static void LogStatus(int status, const char* label) { if (WIFEXITED(status)) { - gpr_log(GPR_INFO, "%s: subprocess exited with status %d", label, - WEXITSTATUS(status)); + LOG(INFO) << label << ": subprocess exited with status " + << WEXITSTATUS(status); } else if (WIFSIGNALED(status)) { - gpr_log(GPR_INFO, "%s: subprocess terminated with signal %d", label, - WTERMSIG(status)); + LOG(INFO) << label << ": subprocess terminated with signal " + << WTERMSIG(status); } else { - gpr_log(GPR_INFO, "%s: unknown subprocess status: %d", label, status); + LOG(INFO) << label << ": unknown subprocess status: " << status; } } diff --git a/test/cpp/qps/parse_json.cc b/test/cpp/qps/parse_json.cc index c104550f4a1..e283c8eae7d 100644 --- a/test/cpp/qps/parse_json.cc +++ b/test/cpp/qps/parse_json.cc @@ -21,10 +21,9 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include - #include "src/core/lib/gprpp/crash.h" namespace grpc { @@ -40,8 +39,8 @@ void ParseJson(const std::string& json, const std::string& type, type_resolver.get(), "type.googleapis.com/" + type, json, &binary); if (!status.ok()) { std::string errmsg(status.message()); - gpr_log(GPR_ERROR, "Failed to convert json to binary: errcode=%d msg=%s", - static_cast(status.code()), errmsg.c_str()); + LOG(ERROR) << "Failed to convert json to binary: errcode=" << status.code() + << " msg=" << errmsg; grpc_core::Crash(absl::StrFormat("JSON: %s", json.c_str())); } CHECK(msg->ParseFromString(binary)); diff --git a/test/cpp/qps/scenario_runner.cc b/test/cpp/qps/scenario_runner.cc index 1d8f6c82475..da08af6b619 100644 --- a/test/cpp/qps/scenario_runner.cc +++ b/test/cpp/qps/scenario_runner.cc @@ -13,8 +13,7 @@ // limitations under the License. #include "absl/flags/flag.h" - -#include +#include "absl/log/log.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/stats_data.h" @@ -40,7 +39,7 @@ static void RunScenario() { grpc_core::testing::GetFileContents(absl::GetFlag(FLAGS_loadtest_config)); Scenarios scenarios; ParseJson(json_str, "grpc.testing.Scenarios", &scenarios); - gpr_log(GPR_INFO, "Running %s", scenarios.scenarios(0).name().c_str()); + LOG(INFO) << "Running " << scenarios.scenarios(0).name(); const auto result = RunScenario(scenarios.scenarios(0).client_config(), 1, scenarios.scenarios(0).server_config(), 1, @@ -49,8 +48,8 @@ static void RunScenario() { kInsecureCredentialsType, {}, false, 0); GetReporter()->ReportQPS(*result); GetReporter()->ReportLatency(*result); - gpr_log(GPR_ERROR, "Global Stats:\n%s", - StatsAsJson(grpc_core::global_stats().Collect().get()).c_str()); + LOG(ERROR) << "Global Stats:\n" + << StatsAsJson(grpc_core::global_stats().Collect().get()); } } // namespace testing diff --git a/test/cpp/qps/server.h b/test/cpp/qps/server.h index 02d7fec717d..2413d2d566d 100644 --- a/test/cpp/qps/server.h +++ b/test/cpp/qps/server.h @@ -21,8 +21,9 @@ #include +#include "absl/log/log.h" + #include -#include #include #include #include @@ -133,8 +134,8 @@ class Server { channel_arg.int_value()); break; case ChannelArg::VALUE_NOT_SET: - gpr_log(GPR_ERROR, "Channel arg '%s' does not have a value", - channel_arg.name().c_str()); + LOG(ERROR) << "Channel arg '" << channel_arg.name() + << "' does not have a value"; break; } } diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 821a380c58d..16bb01e8960 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -23,9 +23,10 @@ #include #include +#include "absl/log/log.h" + #include #include -#include #include #include #include @@ -91,11 +92,9 @@ class AsyncQpsServerTest final : public grpc::testing::Server { int num_threads = config.async_server_threads(); if (num_threads <= 0) { // dynamic sizing num_threads = std::min(64, cores()); - gpr_log(GPR_INFO, - "Sizing async server to %d threads. Defaults to number of cores " - "in machine or 64 threads if machine has more than 64 cores to " - "avoid OOMs.", - num_threads); + LOG(INFO) << "Sizing async server to " << num_threads + << " threads. Defaults to number of cores in machine or 64 " + "threads if machine has more than 64 cores to avoid OOMs."; } int tpc = std::max(1, config.threads_per_cq()); // 1 if unspecified @@ -111,9 +110,9 @@ class AsyncQpsServerTest final : public grpc::testing::Server { server_ = builder->BuildAndStart(); if (server_ == nullptr) { - gpr_log(GPR_ERROR, "Server: Fail to BuildAndStart(port=%d)", port_num); + LOG(ERROR) << "Server: Fail to BuildAndStart(port=" << port_num << ")"; } else { - gpr_log(GPR_INFO, "Server: BuildAndStart(port=%d)", port_num); + LOG(INFO) << "Server: BuildAndStart(port=" << port_num << ")"; } auto process_rpc_bound = diff --git a/test/cpp/qps/server_callback.cc b/test/cpp/qps/server_callback.cc index bb2f2f16c3d..c198b3d86b0 100644 --- a/test/cpp/qps/server_callback.cc +++ b/test/cpp/qps/server_callback.cc @@ -15,6 +15,9 @@ // limitations under the License. // // + +#include "absl/log/log.h" + #include #include #include @@ -113,9 +116,9 @@ class CallbackServer final : public grpc::testing::Server { impl_ = builder->BuildAndStart(); if (impl_ == nullptr) { - gpr_log(GPR_ERROR, "Server: Fail to BuildAndStart(port=%d)", port_num); + LOG(ERROR) << "Server: Fail to BuildAndStart(port=" << port_num << ")"; } else { - gpr_log(GPR_INFO, "Server: BuildAndStart(port=%d)", port_num); + LOG(INFO) << "Server: BuildAndStart(port=" << port_num << ")"; } } diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index f78e17c2157..59a688d9b3e 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -19,6 +19,8 @@ #include #include +#include "absl/log/log.h" + #include #include #include @@ -171,9 +173,9 @@ class SynchronousServer final : public grpc::testing::Server { impl_ = builder->BuildAndStart(); if (impl_ == nullptr) { - gpr_log(GPR_ERROR, "Server: Fail to BuildAndStart(port=%d)", port_num); + LOG(ERROR) << "Server: Fail to BuildAndStart(port=" << port_num << ")"; } else { - gpr_log(GPR_INFO, "Server: BuildAndStart(port=%d)", port_num); + LOG(INFO) << "Server: BuildAndStart(port=" << port_num << ")"; } } diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index 1b3c8ba00f9..6c7eb3a3f34 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -26,7 +26,8 @@ #include -#include +#include "absl/log/log.h" + #include #include @@ -163,7 +164,7 @@ TEST_P(ThreadManagerTest, TestPollAndWork) { for (auto& tm : thread_manager_) { // Verify that The number of times DoWork() was called is equal to the // number of times WORK_FOUND was returned - gpr_log(GPR_DEBUG, "DoWork() called %d times", tm->num_do_work()); + VLOG(2) << "DoWork() called " << tm->num_do_work() << " times"; EXPECT_GE(tm->num_poll_for_work(), GetParam().max_poll_calls); EXPECT_EQ(tm->num_do_work(), tm->num_work_found()); } From c9df35a4d18ace94cd0632cd8f6951cffe3112f8 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 23 May 2024 14:53:31 -0700 Subject: [PATCH 13/20] [Clean-up] Fix MSAN and UBSAN issues found by clang-19 (#36707) Fixed various MSAN and UBSAN issues found in an attempt to bump the clang version used for RBE. (https://github.com/grpc/grpc/pull/36685) As our xSAN tests are using RBE, it revealed a few new issues. This PR is to fix all of those. Closes #36707 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36707 from veblush:fix-xsan ebbebc2d4e47f05ad2a406cdae6b0f603ac5242f PiperOrigin-RevId: 636685138 --- include/grpcpp/impl/call_op_set.h | 4 +- src/core/lib/iomgr/ev_poll_posix.cc | 38 ++++++++++++------- .../end2end/multiple_server_queues_test.cc | 1 + test/core/iomgr/tcp_server_posix_test.cc | 13 ++++++- test/core/surface/completion_queue_test.cc | 22 +++++------ 5 files changed, 50 insertions(+), 28 deletions(-) diff --git a/include/grpcpp/impl/call_op_set.h b/include/grpcpp/impl/call_op_set.h index 56ce6289082..d18cafcc337 100644 --- a/include/grpcpp/impl/call_op_set.h +++ b/include/grpcpp/impl/call_op_set.h @@ -771,7 +771,9 @@ class CallOpRecvInitialMetadata { class CallOpClientRecvStatus { public: CallOpClientRecvStatus() - : recv_status_(nullptr), debug_error_string_(nullptr) {} + : metadata_map_(nullptr), + recv_status_(nullptr), + debug_error_string_(nullptr) {} void ClientRecvStatus(grpc::ClientContext* context, Status* status) { client_context_ = context; diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index 7d290d7d83e..d4c78557f06 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -267,19 +267,29 @@ struct grpc_pollset_set { // static void fork_fd_list_remove_node(grpc_fork_fd_list* node) { + gpr_mu_lock(&fork_fd_list_mu); + if (fork_fd_list_head == node) { + fork_fd_list_head = node->next; + } + if (node->prev != nullptr) { + node->prev->next = node->next; + } + if (node->next != nullptr) { + node->next->prev = node->prev; + } + gpr_free(node); + gpr_mu_unlock(&fork_fd_list_mu); +} + +static void fork_fd_list_remove_grpc_fd(grpc_fd* fd) { if (track_fds_for_fork) { - gpr_mu_lock(&fork_fd_list_mu); - if (fork_fd_list_head == node) { - fork_fd_list_head = node->next; - } - if (node->prev != nullptr) { - node->prev->next = node->next; - } - if (node->next != nullptr) { - node->next->prev = node->prev; - } - gpr_free(node); - gpr_mu_unlock(&fork_fd_list_mu); + fork_fd_list_remove_node(fd->fork_fd_list); + } +} + +static void fork_fd_list_remove_wakeup_fd(grpc_cached_wakeup_fd* fd) { + if (track_fds_for_fork) { + fork_fd_list_remove_node(fd->fork_fd_list); } } @@ -361,7 +371,7 @@ static void unref_by(grpc_fd* fd, int n) { if (old == n) { gpr_mu_destroy(&fd->mu); grpc_iomgr_unregister_object(&fd->iomgr_object); - fork_fd_list_remove_node(fd->fork_fd_list); + fork_fd_list_remove_grpc_fd(fd); if (fd->shutdown) { } fd->shutdown_error.~Status(); @@ -860,7 +870,7 @@ static void pollset_destroy(grpc_pollset* pollset) { CHECK(!pollset_has_workers(pollset)); while (pollset->local_wakeup_cache) { grpc_cached_wakeup_fd* next = pollset->local_wakeup_cache->next; - fork_fd_list_remove_node(pollset->local_wakeup_cache->fork_fd_list); + fork_fd_list_remove_wakeup_fd(pollset->local_wakeup_cache); grpc_wakeup_fd_destroy(&pollset->local_wakeup_cache->fd); gpr_free(pollset->local_wakeup_cache); pollset->local_wakeup_cache = next; diff --git a/test/core/end2end/multiple_server_queues_test.cc b/test/core/end2end/multiple_server_queues_test.cc index 4711a7a2147..4b49412649c 100644 --- a/test/core/end2end/multiple_server_queues_test.cc +++ b/test/core/end2end/multiple_server_queues_test.cc @@ -37,6 +37,7 @@ int main(int argc, char** argv) { attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING; + attr.cq_shutdown_cb = nullptr; cq1 = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc index 469d6990502..235c789717a 100644 --- a/test/core/iomgr/tcp_server_posix_test.cc +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -39,6 +39,7 @@ #include #endif +#include #include #include "absl/log/log.h" @@ -330,8 +331,16 @@ static void test_connect(size_t num_connects, const grpc_channel_args* channel_args, test_addrs* dst_addrs, bool test_dst_addrs) { grpc_core::ExecCtx exec_ctx; - grpc_resolved_address resolved_addr; - grpc_resolved_address resolved_addr1; + // Use aligned_stroage to allocate grpc_resolved_address objects on stack + // to meet the alignment requirement of sockaddr_storage type. + std::aligned_storage::type resolved_addr_buffer; + std::aligned_storage::type resolved_addr1_buffer; + grpc_resolved_address& resolved_addr = + *reinterpret_cast(&resolved_addr_buffer); + grpc_resolved_address& resolved_addr1 = + *reinterpret_cast(&resolved_addr1_buffer); struct sockaddr_storage* const addr = reinterpret_cast(resolved_addr.addr); struct sockaddr_storage* const addr1 = diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc index 82dbaed6dd6..9175196fa1a 100644 --- a/test/core/surface/completion_queue_test.cc +++ b/test/core/surface/completion_queue_test.cc @@ -78,7 +78,7 @@ TEST(GrpcCompletionQueueTest, TestNoOp) { grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK}; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; LOG_TEST("test_no_op"); attr.version = 1; @@ -97,7 +97,7 @@ TEST(GrpcCompletionQueueTest, TestPollsetConversion) { grpc_cq_polling_type polling_types[] = {GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING}; grpc_completion_queue* cq; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; LOG_TEST("test_pollset_conversion"); @@ -118,7 +118,7 @@ TEST(GrpcCompletionQueueTest, TestWaitEmpty) { grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue* cc; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; grpc_event event; LOG_TEST("test_wait_empty"); @@ -145,7 +145,7 @@ TEST(GrpcCompletionQueueTest, TestCqEndOp) { grpc_cq_completion completion; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; void* tag = create_test_tag(); LOG_TEST("test_cq_end_op"); @@ -178,7 +178,7 @@ TEST(GrpcCompletionQueueTest, TestCqTlsCacheFull) { grpc_cq_completion completion; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; void* tag = create_test_tag(); void* res_tag; int ok; @@ -219,7 +219,7 @@ TEST(GrpcCompletionQueueTest, TestCqTlsCacheEmpty) { grpc_completion_queue* cc; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; void* res_tag; int ok; @@ -246,7 +246,7 @@ TEST(GrpcCompletionQueueTest, TestShutdownThenNextPolling) { grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue* cc; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); @@ -268,7 +268,7 @@ TEST(GrpcCompletionQueueTest, TestShutdownThenNextWithTimeout) { grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue* cc; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); @@ -294,7 +294,7 @@ TEST(GrpcCompletionQueueTest, TestPluck) { grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; unsigned i, j; LOG_TEST("test_pluck"); @@ -348,7 +348,7 @@ TEST(GrpcCompletionQueueTest, TestPluckAfterShutdown) { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_event ev; grpc_completion_queue* cc; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; LOG_TEST("test_pluck_after_shutdown"); @@ -372,7 +372,7 @@ TEST(GrpcCompletionQueueTest, TestCallback) { grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - grpc_completion_queue_attributes attr; + grpc_completion_queue_attributes attr = {}; unsigned i; static gpr_mu mu, shutdown_mu; static gpr_cv cv, shutdown_cv; From 6c08d36c3b44e92cef41a5ac3f74fd959cadd993 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 23 May 2024 15:51:05 -0700 Subject: [PATCH 14/20] [reorg] move telemetry code to src/core/telemetry (#36644) Closes #36644 PiperOrigin-RevId: 636702732 --- .gitattributes | 4 +- BUILD | 10 +- CMakeLists.txt | 46 ++++----- Makefile | 10 +- Package.swift | 22 ++--- build_autogenerated.yaml | 94 +++++++++---------- config.m4 | 11 ++- config.w32 | 11 ++- gRPC-C++.podspec | 24 ++--- gRPC-Core.podspec | 34 +++---- grpc.gemspec | 22 ++--- package.xml | 22 ++--- setup.py | 2 +- src/core/BUILD | 12 +-- .../client_channel/client_channel_filter.h | 2 +- .../client_channel/client_channel_internal.h | 2 +- src/core/client_channel/subchannel.cc | 4 +- .../message_compress/compression_filter.cc | 2 +- .../ext/filters/logging/logging_filter.cc | 2 +- .../chttp2/transport/chttp2_transport.cc | 8 +- .../chttp2/transport/chttp2_transport.h | 2 +- .../chttp2/transport/context_list_entry.h | 2 +- .../chttp2/transport/hpack_parser.cc | 6 +- .../transport/chttp2/transport/hpack_parser.h | 2 +- .../ext/transport/chttp2/transport/internal.h | 4 +- .../ext/transport/chttp2/transport/parsing.cc | 2 +- .../ext/transport/chttp2/transport/writing.cc | 6 +- .../security/security_handshaker.cc | 4 +- src/core/lib/channel/channel_stack.h | 2 +- src/core/lib/gprpp/work_serializer.cc | 4 +- src/core/lib/iomgr/call_combiner.cc | 4 +- src/core/lib/iomgr/ev_epoll1_linux.cc | 4 +- src/core/lib/iomgr/ev_poll_posix.cc | 4 +- src/core/lib/iomgr/iocp_windows.cc | 4 +- src/core/lib/iomgr/tcp_posix.cc | 4 +- src/core/lib/surface/call.cc | 6 +- src/core/lib/surface/channel.cc | 4 +- src/core/lib/surface/channel_create.cc | 4 +- src/core/lib/surface/completion_queue.cc | 4 +- src/core/lib/surface/legacy_channel.cc | 6 +- src/core/lib/surface/legacy_channel.h | 2 +- src/core/lib/transport/metadata_info.h | 2 +- src/core/load_balancing/lb_policy.h | 2 +- .../load_balancing/pick_first/pick_first.cc | 2 +- src/core/load_balancing/rls/rls.cc | 2 +- .../weighted_round_robin.cc | 6 +- .../load_balancing/xds/xds_cluster_impl.cc | 2 +- src/core/server/server.cc | 2 +- src/core/server/server.h | 2 +- src/core/server/server_call_tracer_filter.cc | 2 +- .../{lib/channel => telemetry}/call_tracer.cc | 4 +- .../{lib/channel => telemetry}/call_tracer.h | 8 +- .../debug => telemetry}/histogram_view.cc | 2 +- .../{lib/debug => telemetry}/histogram_view.h | 6 +- .../{lib/channel => telemetry}/metrics.cc | 2 +- src/core/{lib/channel => telemetry}/metrics.h | 8 +- src/core/{lib/debug => telemetry}/stats.cc | 2 +- src/core/{lib/debug => telemetry}/stats.h | 10 +- .../{lib/debug => telemetry}/stats_data.cc | 2 +- .../{lib/debug => telemetry}/stats_data.h | 8 +- .../{lib/debug => telemetry}/stats_data.yaml | 0 .../{lib/channel => telemetry}/tcp_tracer.h | 6 +- src/core/xds/grpc/xds_client_grpc.cc | 2 +- src/core/xds/grpc/xds_client_grpc.h | 2 +- src/core/xds/xds_client/xds_client_stats.h | 2 +- src/cpp/ext/csm/metadata_exchange.cc | 2 +- src/cpp/ext/filters/census/client_filter.cc | 2 +- src/cpp/ext/filters/census/grpc_plugin.cc | 2 +- .../filters/census/open_census_call_tracer.h | 4 +- .../ext/filters/census/server_call_tracer.cc | 4 +- .../ext/filters/census/server_call_tracer.h | 2 +- src/cpp/ext/otel/otel_client_call_tracer.cc | 2 +- src/cpp/ext/otel/otel_client_call_tracer.h | 4 +- src/cpp/ext/otel/otel_plugin.cc | 2 +- src/cpp/ext/otel/otel_plugin.h | 2 +- src/cpp/ext/otel/otel_server_call_tracer.cc | 2 +- src/cpp/ext/otel/otel_server_call_tracer.h | 2 +- .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 2 +- src/python/grpcio/grpc_core_dependencies.py | 10 +- .../grpc_observability/_cyobservability.pxd | 2 +- .../grpc_observability/client_call_tracer.h | 2 +- .../grpc_observability/server_call_tracer.cc | 2 +- .../grpc_observability/server_call_tracer.h | 2 +- src/python/grpcio_observability/setup.py | 2 +- test/core/channel/BUILD | 31 ------ .../server_call_tracer_factory_test.cc | 2 +- test/core/end2end/tests/http2_stats.cc | 6 +- test/core/end2end/tests/simple_request.cc | 4 +- .../fuzzing_event_engine.cc | 2 +- test/core/gprpp/work_serializer_test.cc | 6 +- test/core/load_balancing/pick_first_test.cc | 2 +- test/core/{debug => telemetry}/BUILD | 35 ++++++- .../call_tracer_test.cc | 2 +- .../{channel => telemetry}/metrics_test.cc | 2 +- test/core/{debug => telemetry}/stats_test.cc | 4 +- test/core/test_util/fake_stats_plugin.h | 6 +- .../end2end/xds/xds_cluster_end2end_test.cc | 2 +- test/cpp/ext/csm/metadata_exchange_test.cc | 2 +- test/cpp/ext/otel/otel_plugin_test.cc | 2 +- test/cpp/ext/otel/otel_test_library.cc | 2 +- test/cpp/ext/otel/otel_test_library.h | 2 +- test/cpp/microbenchmarks/helpers.h | 4 +- test/cpp/naming/cancel_ares_query_test.cc | 4 +- test/cpp/performance/writes_per_rpc_test.cc | 2 +- test/cpp/qps/scenario_runner.cc | 4 +- tools/codegen/core/gen_stats_data.py | 16 ++-- .../clang_tidy_all_the_things.sh | 2 +- tools/doxygen/Doxyfile.c++.internal | 22 ++--- tools/doxygen/Doxyfile.core.internal | 22 ++--- 109 files changed, 376 insertions(+), 374 deletions(-) rename src/core/{lib/channel => telemetry}/call_tracer.cc (99%) rename src/core/{lib/channel => telemetry}/call_tracer.h (97%) rename src/core/{lib/debug => telemetry}/histogram_view.cc (97%) rename src/core/{lib/debug => telemetry}/histogram_view.h (86%) rename src/core/{lib/channel => telemetry}/metrics.cc (99%) rename src/core/{lib/channel => telemetry}/metrics.h (99%) rename src/core/{lib/debug => telemetry}/stats.cc (98%) rename src/core/{lib/debug => telemetry}/stats.h (89%) rename src/core/{lib/debug => telemetry}/stats_data.cc (99%) rename src/core/{lib/debug => telemetry}/stats_data.h (99%) rename src/core/{lib/debug => telemetry}/stats_data.yaml (100%) rename src/core/{lib/channel => telemetry}/tcp_tracer.h (97%) rename test/core/{debug => telemetry}/BUILD (56%) rename test/core/{channel => telemetry}/call_tracer_test.cc (99%) rename test/core/{channel => telemetry}/metrics_test.cc (99%) rename test/core/{debug => telemetry}/stats_test.cc (97%) diff --git a/.gitattributes b/.gitattributes index b03b218eb51..2661229e94f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,8 +29,8 @@ tools/run_tests/tests.json linguist-generated=true tools/run_tests/generated/tests.json linguist-generated=true tools/run_tests/generated/sources_and_headers.json linguist-generated=true src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h linguist-generated=true -src/core/lib/debug/stats_data.h linguist-generated=true -src/core/lib/debug/stats_data.cc linguist-generated=true +src/core/telemetry/stats_data.h linguist-generated=true +src/core/telemetry/stats_data.cc linguist-generated=true src/core/lib/experiments/experiments.h linguist-generated=true src/core/lib/experiments/experiments.cc linguist-generated=true bazel/experiments.bzl linguist-generated=true diff --git a/BUILD b/BUILD index 6cfbe881c50..79ee22f7510 100644 --- a/BUILD +++ b/BUILD @@ -1742,10 +1742,10 @@ grpc_cc_library( grpc_cc_library( name = "call_tracer", srcs = [ - "//src/core:lib/channel/call_tracer.cc", + "//src/core:telemetry/call_tracer.cc", ], hdrs = [ - "//src/core:lib/channel/call_tracer.h", + "//src/core:telemetry/call_tracer.h", ], external_deps = [ "absl/log:check", @@ -3463,10 +3463,10 @@ grpc_cc_library( grpc_cc_library( name = "stats", srcs = [ - "//src/core:lib/debug/stats.cc", + "//src/core:telemetry/stats.cc", ], hdrs = [ - "//src/core:lib/debug/stats.h", + "//src/core:telemetry/stats.h", ], external_deps = [ "absl/strings", @@ -4751,7 +4751,7 @@ grpc_cc_library( grpc_cc_library( name = "tcp_tracer", hdrs = [ - "//src/core:lib/channel/tcp_tracer.h", + "//src/core:telemetry/tcp_tracer.h", ], external_deps = [ "absl/time", diff --git a/CMakeLists.txt b/CMakeLists.txt index d0172728836..f4090e8b821 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2228,7 +2228,6 @@ add_library(grpc src/core/lib/address_utils/sockaddr_utils.cc src/core/lib/backoff/backoff.cc src/core/lib/backoff/random_early_detection.cc - src/core/lib/channel/call_tracer.cc src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_args_preconditioning.cc src/core/lib/channel/channel_stack.cc @@ -2236,7 +2235,6 @@ add_library(grpc src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc src/core/lib/channel/status_util.cc src/core/lib/compression/compression.cc @@ -2244,9 +2242,6 @@ add_library(grpc src/core/lib/compression/message_compress.cc src/core/lib/config/core_configuration.cc src/core/lib/debug/event_log.cc - src/core/lib/debug/histogram_view.cc - src/core/lib/debug/stats.cc - src/core/lib/debug/stats_data.cc src/core/lib/debug/trace.cc src/core/lib/event_engine/ares_resolver.cc src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -2571,6 +2566,11 @@ add_library(grpc src/core/service_config/service_config_channel_arg_filter.cc src/core/service_config/service_config_impl.cc src/core/service_config/service_config_parser.cc + src/core/telemetry/call_tracer.cc + src/core/telemetry/histogram_view.cc + src/core/telemetry/metrics.cc + src/core/telemetry/stats.cc + src/core/telemetry/stats_data.cc src/core/tsi/alts/crypt/aes_gcm.cc src/core/tsi/alts/crypt/gsec.cc src/core/tsi/alts/frame_protector/alts_counter.cc @@ -3021,7 +3021,6 @@ add_library(grpc_unsecure src/core/lib/address_utils/sockaddr_utils.cc src/core/lib/backoff/backoff.cc src/core/lib/backoff/random_early_detection.cc - src/core/lib/channel/call_tracer.cc src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_args_preconditioning.cc src/core/lib/channel/channel_stack.cc @@ -3029,7 +3028,6 @@ add_library(grpc_unsecure src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc src/core/lib/channel/status_util.cc src/core/lib/compression/compression.cc @@ -3037,9 +3035,6 @@ add_library(grpc_unsecure src/core/lib/compression/message_compress.cc src/core/lib/config/core_configuration.cc src/core/lib/debug/event_log.cc - src/core/lib/debug/histogram_view.cc - src/core/lib/debug/stats.cc - src/core/lib/debug/stats_data.cc src/core/lib/debug/trace.cc src/core/lib/event_engine/ares_resolver.cc src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -3312,6 +3307,11 @@ add_library(grpc_unsecure src/core/service_config/service_config_channel_arg_filter.cc src/core/service_config/service_config_impl.cc src/core/service_config/service_config_parser.cc + src/core/telemetry/call_tracer.cc + src/core/telemetry/histogram_view.cc + src/core/telemetry/metrics.cc + src/core/telemetry/stats.cc + src/core/telemetry/stats_data.cc src/core/tsi/alts/handshaker/transport_security_common_api.cc src/core/tsi/fake_transport_security.cc src/core/tsi/local_transport_security.cc @@ -5139,7 +5139,6 @@ add_library(grpc_authorization_provider src/core/lib/address_utils/parse_address.cc src/core/lib/address_utils/sockaddr_utils.cc src/core/lib/backoff/backoff.cc - src/core/lib/channel/call_tracer.cc src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_args_preconditioning.cc src/core/lib/channel/channel_stack.cc @@ -5147,7 +5146,6 @@ add_library(grpc_authorization_provider src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc src/core/lib/channel/status_util.cc src/core/lib/compression/compression.cc @@ -5155,9 +5153,6 @@ add_library(grpc_authorization_provider src/core/lib/compression/message_compress.cc src/core/lib/config/core_configuration.cc src/core/lib/debug/event_log.cc - src/core/lib/debug/histogram_view.cc - src/core/lib/debug/stats.cc - src/core/lib/debug/stats_data.cc src/core/lib/debug/trace.cc src/core/lib/event_engine/ares_resolver.cc src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -5384,6 +5379,11 @@ add_library(grpc_authorization_provider src/core/resolver/resolver.cc src/core/resolver/resolver_registry.cc src/core/service_config/service_config_parser.cc + src/core/telemetry/call_tracer.cc + src/core/telemetry/histogram_view.cc + src/core/telemetry/metrics.cc + src/core/telemetry/stats.cc + src/core/telemetry/stats_data.cc src/core/tsi/alts/handshaker/transport_security_common_api.cc src/core/tsi/transport_security.cc src/core/tsi/transport_security_grpc.cc @@ -8703,7 +8703,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(call_tracer_test - test/core/channel/call_tracer_test.cc + test/core/telemetry/call_tracer_test.cc test/core/test_util/fake_stats_plugin.cc ) if(WIN32 AND MSVC) @@ -17768,7 +17768,6 @@ add_executable(interception_chain_test src/core/lib/address_utils/parse_address.cc src/core/lib/address_utils/sockaddr_utils.cc src/core/lib/backoff/backoff.cc - src/core/lib/channel/call_tracer.cc src/core/lib/channel/channel_args.cc src/core/lib/channel/channel_args_preconditioning.cc src/core/lib/channel/channel_stack.cc @@ -17776,7 +17775,6 @@ add_executable(interception_chain_test src/core/lib/channel/channel_stack_builder_impl.cc src/core/lib/channel/channel_stack_trace.cc src/core/lib/channel/connected_channel.cc - src/core/lib/channel/metrics.cc src/core/lib/channel/promise_based_filter.cc src/core/lib/channel/status_util.cc src/core/lib/compression/compression.cc @@ -17784,9 +17782,6 @@ add_executable(interception_chain_test src/core/lib/compression/message_compress.cc src/core/lib/config/core_configuration.cc src/core/lib/debug/event_log.cc - src/core/lib/debug/histogram_view.cc - src/core/lib/debug/stats.cc - src/core/lib/debug/stats_data.cc src/core/lib/debug/trace.cc src/core/lib/event_engine/ares_resolver.cc src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -17988,6 +17983,11 @@ add_executable(interception_chain_test src/core/resolver/resolver.cc src/core/resolver/resolver_registry.cc src/core/service_config/service_config_parser.cc + src/core/telemetry/call_tracer.cc + src/core/telemetry/histogram_view.cc + src/core/telemetry/metrics.cc + src/core/telemetry/stats.cc + src/core/telemetry/stats_data.cc src/core/tsi/alts/handshaker/transport_security_common_api.cc test/core/transport/interception_chain_test.cc third_party/upb/upb/mini_descriptor/build_enum.c @@ -20000,7 +20000,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(metrics_test - test/core/channel/metrics_test.cc + test/core/telemetry/metrics_test.cc test/core/test_util/fake_stats_plugin.cc ) if(WIN32 AND MSVC) @@ -28801,7 +28801,7 @@ endif() if(gRPC_BUILD_TESTS) add_executable(stats_test - test/core/debug/stats_test.cc + test/core/telemetry/stats_test.cc ) if(WIN32 AND MSVC) if(BUILD_SHARED_LIBS) diff --git a/Makefile b/Makefile index 5e22b66b5ee..3de6515f8a0 100644 --- a/Makefile +++ b/Makefile @@ -1068,7 +1068,6 @@ LIBGRPC_SRC = \ src/core/lib/address_utils/sockaddr_utils.cc \ src/core/lib/backoff/backoff.cc \ src/core/lib/backoff/random_early_detection.cc \ - src/core/lib/channel/call_tracer.cc \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_args_preconditioning.cc \ src/core/lib/channel/channel_stack.cc \ @@ -1076,7 +1075,6 @@ LIBGRPC_SRC = \ src/core/lib/channel/channel_stack_builder_impl.cc \ src/core/lib/channel/channel_stack_trace.cc \ src/core/lib/channel/connected_channel.cc \ - src/core/lib/channel/metrics.cc \ src/core/lib/channel/promise_based_filter.cc \ src/core/lib/channel/status_util.cc \ src/core/lib/compression/compression.cc \ @@ -1087,9 +1085,6 @@ LIBGRPC_SRC = \ src/core/lib/config/core_configuration.cc \ src/core/lib/config/load_config.cc \ src/core/lib/debug/event_log.cc \ - src/core/lib/debug/histogram_view.cc \ - src/core/lib/debug/stats.cc \ - src/core/lib/debug/stats_data.cc \ src/core/lib/debug/trace.cc \ src/core/lib/event_engine/ares_resolver.cc \ src/core/lib/event_engine/cf_engine/cf_engine.cc \ @@ -1430,6 +1425,11 @@ LIBGRPC_SRC = \ src/core/service_config/service_config_channel_arg_filter.cc \ src/core/service_config/service_config_impl.cc \ src/core/service_config/service_config_parser.cc \ + src/core/telemetry/call_tracer.cc \ + src/core/telemetry/histogram_view.cc \ + src/core/telemetry/metrics.cc \ + src/core/telemetry/stats.cc \ + src/core/telemetry/stats_data.cc \ src/core/tsi/alts/crypt/aes_gcm.cc \ src/core/tsi/alts/crypt/gsec.cc \ src/core/tsi/alts/frame_protector/alts_counter.cc \ diff --git a/Package.swift b/Package.swift index 2cfe0e1798e..cd30f90e602 100644 --- a/Package.swift +++ b/Package.swift @@ -1092,8 +1092,6 @@ let package = Package( "src/core/lib/backoff/random_early_detection.cc", "src/core/lib/backoff/random_early_detection.h", "src/core/lib/channel/call_finalization.h", - "src/core/lib/channel/call_tracer.cc", - "src/core/lib/channel/call_tracer.h", "src/core/lib/channel/channel_args.cc", "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_args_preconditioning.cc", @@ -1110,13 +1108,10 @@ let package = Package( "src/core/lib/channel/connected_channel.cc", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", - "src/core/lib/channel/metrics.cc", - "src/core/lib/channel/metrics.h", "src/core/lib/channel/promise_based_filter.cc", "src/core/lib/channel/promise_based_filter.h", "src/core/lib/channel/status_util.cc", "src/core/lib/channel/status_util.h", - "src/core/lib/channel/tcp_tracer.h", "src/core/lib/compression/compression.cc", "src/core/lib/compression/compression_internal.cc", "src/core/lib/compression/compression_internal.h", @@ -1131,12 +1126,6 @@ let package = Package( "src/core/lib/config/load_config.h", "src/core/lib/debug/event_log.cc", "src/core/lib/debug/event_log.h", - "src/core/lib/debug/histogram_view.cc", - "src/core/lib/debug/histogram_view.h", - "src/core/lib/debug/stats.cc", - "src/core/lib/debug/stats.h", - "src/core/lib/debug/stats_data.cc", - "src/core/lib/debug/stats_data.h", "src/core/lib/debug/trace.cc", "src/core/lib/debug/trace.h", "src/core/lib/event_engine/ares_resolver.cc", @@ -1866,6 +1855,17 @@ let package = Package( "src/core/service_config/service_config_impl.h", "src/core/service_config/service_config_parser.cc", "src/core/service_config/service_config_parser.h", + "src/core/telemetry/call_tracer.cc", + "src/core/telemetry/call_tracer.h", + "src/core/telemetry/histogram_view.cc", + "src/core/telemetry/histogram_view.h", + "src/core/telemetry/metrics.cc", + "src/core/telemetry/metrics.h", + "src/core/telemetry/stats.cc", + "src/core/telemetry/stats.h", + "src/core/telemetry/stats_data.cc", + "src/core/telemetry/stats_data.h", + "src/core/telemetry/tcp_tracer.h", "src/core/tsi/alts/crypt/aes_gcm.cc", "src/core/tsi/alts/crypt/gsec.cc", "src/core/tsi/alts/crypt/gsec.h", diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index f72466229e9..aaa5f04cc81 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -795,7 +795,6 @@ libs: - src/core/lib/backoff/backoff.h - src/core/lib/backoff/random_early_detection.h - src/core/lib/channel/call_finalization.h - - src/core/lib/channel/call_tracer.h - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_args_preconditioning.h - src/core/lib/channel/channel_fwd.h @@ -805,17 +804,12 @@ libs: - src/core/lib/channel/channel_stack_trace.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - - src/core/lib/channel/metrics.h - src/core/lib/channel/promise_based_filter.h - src/core/lib/channel/status_util.h - - src/core/lib/channel/tcp_tracer.h - src/core/lib/compression/compression_internal.h - src/core/lib/compression/message_compress.h - src/core/lib/config/core_configuration.h - src/core/lib/debug/event_log.h - - src/core/lib/debug/histogram_view.h - - src/core/lib/debug/stats.h - - src/core/lib/debug/stats_data.h - src/core/lib/debug/trace.h - src/core/lib/event_engine/ares_resolver.h - src/core/lib/event_engine/cf_engine/cf_engine.h @@ -1184,6 +1178,12 @@ libs: - src/core/service_config/service_config_call_data.h - src/core/service_config/service_config_impl.h - src/core/service_config/service_config_parser.h + - src/core/telemetry/call_tracer.h + - src/core/telemetry/histogram_view.h + - src/core/telemetry/metrics.h + - src/core/telemetry/stats.h + - src/core/telemetry/stats_data.h + - src/core/telemetry/tcp_tracer.h - src/core/tsi/alts/crypt/gsec.h - src/core/tsi/alts/frame_protector/alts_counter.h - src/core/tsi/alts/frame_protector/alts_crypter.h @@ -1649,7 +1649,6 @@ libs: - src/core/lib/address_utils/sockaddr_utils.cc - src/core/lib/backoff/backoff.cc - src/core/lib/backoff/random_early_detection.cc - - src/core/lib/channel/call_tracer.cc - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_args_preconditioning.cc - src/core/lib/channel/channel_stack.cc @@ -1657,7 +1656,6 @@ libs: - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/connected_channel.cc - - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc - src/core/lib/channel/status_util.cc - src/core/lib/compression/compression.cc @@ -1665,9 +1663,6 @@ libs: - src/core/lib/compression/message_compress.cc - src/core/lib/config/core_configuration.cc - src/core/lib/debug/event_log.cc - - src/core/lib/debug/histogram_view.cc - - src/core/lib/debug/stats.cc - - src/core/lib/debug/stats_data.cc - src/core/lib/debug/trace.cc - src/core/lib/event_engine/ares_resolver.cc - src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -1992,6 +1987,11 @@ libs: - src/core/service_config/service_config_channel_arg_filter.cc - src/core/service_config/service_config_impl.cc - src/core/service_config/service_config_parser.cc + - src/core/telemetry/call_tracer.cc + - src/core/telemetry/histogram_view.cc + - src/core/telemetry/metrics.cc + - src/core/telemetry/stats.cc + - src/core/telemetry/stats_data.cc - src/core/tsi/alts/crypt/aes_gcm.cc - src/core/tsi/alts/crypt/gsec.cc - src/core/tsi/alts/frame_protector/alts_counter.cc @@ -2333,7 +2333,6 @@ libs: - src/core/lib/backoff/backoff.h - src/core/lib/backoff/random_early_detection.h - src/core/lib/channel/call_finalization.h - - src/core/lib/channel/call_tracer.h - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_args_preconditioning.h - src/core/lib/channel/channel_fwd.h @@ -2343,17 +2342,12 @@ libs: - src/core/lib/channel/channel_stack_trace.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - - src/core/lib/channel/metrics.h - src/core/lib/channel/promise_based_filter.h - src/core/lib/channel/status_util.h - - src/core/lib/channel/tcp_tracer.h - src/core/lib/compression/compression_internal.h - src/core/lib/compression/message_compress.h - src/core/lib/config/core_configuration.h - src/core/lib/debug/event_log.h - - src/core/lib/debug/histogram_view.h - - src/core/lib/debug/stats.h - - src/core/lib/debug/stats_data.h - src/core/lib/debug/trace.h - src/core/lib/event_engine/ares_resolver.h - src/core/lib/event_engine/cf_engine/cf_engine.h @@ -2677,6 +2671,12 @@ libs: - src/core/service_config/service_config_call_data.h - src/core/service_config/service_config_impl.h - src/core/service_config/service_config_parser.h + - src/core/telemetry/call_tracer.h + - src/core/telemetry/histogram_view.h + - src/core/telemetry/metrics.h + - src/core/telemetry/stats.h + - src/core/telemetry/stats_data.h + - src/core/telemetry/tcp_tracer.h - src/core/tsi/alts/handshaker/transport_security_common_api.h - src/core/tsi/fake_transport_security.h - src/core/tsi/local_transport_security.h @@ -2802,7 +2802,6 @@ libs: - src/core/lib/address_utils/sockaddr_utils.cc - src/core/lib/backoff/backoff.cc - src/core/lib/backoff/random_early_detection.cc - - src/core/lib/channel/call_tracer.cc - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_args_preconditioning.cc - src/core/lib/channel/channel_stack.cc @@ -2810,7 +2809,6 @@ libs: - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/connected_channel.cc - - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc - src/core/lib/channel/status_util.cc - src/core/lib/compression/compression.cc @@ -2818,9 +2816,6 @@ libs: - src/core/lib/compression/message_compress.cc - src/core/lib/config/core_configuration.cc - src/core/lib/debug/event_log.cc - - src/core/lib/debug/histogram_view.cc - - src/core/lib/debug/stats.cc - - src/core/lib/debug/stats_data.cc - src/core/lib/debug/trace.cc - src/core/lib/event_engine/ares_resolver.cc - src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -3093,6 +3088,11 @@ libs: - src/core/service_config/service_config_channel_arg_filter.cc - src/core/service_config/service_config_impl.cc - src/core/service_config/service_config_parser.cc + - src/core/telemetry/call_tracer.cc + - src/core/telemetry/histogram_view.cc + - src/core/telemetry/metrics.cc + - src/core/telemetry/stats.cc + - src/core/telemetry/stats_data.cc - src/core/tsi/alts/handshaker/transport_security_common_api.cc - src/core/tsi/fake_transport_security.cc - src/core/tsi/local_transport_security.cc @@ -4423,7 +4423,6 @@ libs: - src/core/lib/avl/avl.h - src/core/lib/backoff/backoff.h - src/core/lib/channel/call_finalization.h - - src/core/lib/channel/call_tracer.h - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_args_preconditioning.h - src/core/lib/channel/channel_fwd.h @@ -4433,17 +4432,12 @@ libs: - src/core/lib/channel/channel_stack_trace.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - - src/core/lib/channel/metrics.h - src/core/lib/channel/promise_based_filter.h - src/core/lib/channel/status_util.h - - src/core/lib/channel/tcp_tracer.h - src/core/lib/compression/compression_internal.h - src/core/lib/compression/message_compress.h - src/core/lib/config/core_configuration.h - src/core/lib/debug/event_log.h - - src/core/lib/debug/histogram_view.h - - src/core/lib/debug/stats.h - - src/core/lib/debug/stats_data.h - src/core/lib/debug/trace.h - src/core/lib/event_engine/ares_resolver.h - src/core/lib/event_engine/cf_engine/cf_engine.h @@ -4726,6 +4720,12 @@ libs: - src/core/service_config/service_config.h - src/core/service_config/service_config_call_data.h - src/core/service_config/service_config_parser.h + - src/core/telemetry/call_tracer.h + - src/core/telemetry/histogram_view.h + - src/core/telemetry/metrics.h + - src/core/telemetry/stats.h + - src/core/telemetry/stats_data.h + - src/core/telemetry/tcp_tracer.h - src/core/tsi/alts/handshaker/transport_security_common_api.h - src/core/tsi/transport_security.h - src/core/tsi/transport_security_grpc.h @@ -4769,7 +4769,6 @@ libs: - src/core/lib/address_utils/parse_address.cc - src/core/lib/address_utils/sockaddr_utils.cc - src/core/lib/backoff/backoff.cc - - src/core/lib/channel/call_tracer.cc - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_args_preconditioning.cc - src/core/lib/channel/channel_stack.cc @@ -4777,7 +4776,6 @@ libs: - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/connected_channel.cc - - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc - src/core/lib/channel/status_util.cc - src/core/lib/compression/compression.cc @@ -4785,9 +4783,6 @@ libs: - src/core/lib/compression/message_compress.cc - src/core/lib/config/core_configuration.cc - src/core/lib/debug/event_log.cc - - src/core/lib/debug/histogram_view.cc - - src/core/lib/debug/stats.cc - - src/core/lib/debug/stats_data.cc - src/core/lib/debug/trace.cc - src/core/lib/event_engine/ares_resolver.cc - src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -5014,6 +5009,11 @@ libs: - src/core/resolver/resolver.cc - src/core/resolver/resolver_registry.cc - src/core/service_config/service_config_parser.cc + - src/core/telemetry/call_tracer.cc + - src/core/telemetry/histogram_view.cc + - src/core/telemetry/metrics.cc + - src/core/telemetry/stats.cc + - src/core/telemetry/stats_data.cc - src/core/tsi/alts/handshaker/transport_security_common_api.cc - src/core/tsi/transport_security.cc - src/core/tsi/transport_security_grpc.cc @@ -6605,7 +6605,7 @@ targets: headers: - test/core/test_util/fake_stats_plugin.h src: - - test/core/channel/call_tracer_test.cc + - test/core/telemetry/call_tracer_test.cc - test/core/test_util/fake_stats_plugin.cc deps: - gtest @@ -11582,7 +11582,6 @@ targets: - src/core/lib/avl/avl.h - src/core/lib/backoff/backoff.h - src/core/lib/channel/call_finalization.h - - src/core/lib/channel/call_tracer.h - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_args_preconditioning.h - src/core/lib/channel/channel_fwd.h @@ -11592,17 +11591,12 @@ targets: - src/core/lib/channel/channel_stack_trace.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - - src/core/lib/channel/metrics.h - src/core/lib/channel/promise_based_filter.h - src/core/lib/channel/status_util.h - - src/core/lib/channel/tcp_tracer.h - src/core/lib/compression/compression_internal.h - src/core/lib/compression/message_compress.h - src/core/lib/config/core_configuration.h - src/core/lib/debug/event_log.h - - src/core/lib/debug/histogram_view.h - - src/core/lib/debug/stats.h - - src/core/lib/debug/stats_data.h - src/core/lib/debug/trace.h - src/core/lib/event_engine/ares_resolver.h - src/core/lib/event_engine/cf_engine/cf_engine.h @@ -11861,6 +11855,12 @@ targets: - src/core/service_config/service_config.h - src/core/service_config/service_config_call_data.h - src/core/service_config/service_config_parser.h + - src/core/telemetry/call_tracer.h + - src/core/telemetry/histogram_view.h + - src/core/telemetry/metrics.h + - src/core/telemetry/stats.h + - src/core/telemetry/stats_data.h + - src/core/telemetry/tcp_tracer.h - src/core/tsi/alts/handshaker/transport_security_common_api.h - src/core/util/spinlock.h - test/core/promise/poll_matcher.h @@ -11897,7 +11897,6 @@ targets: - src/core/lib/address_utils/parse_address.cc - src/core/lib/address_utils/sockaddr_utils.cc - src/core/lib/backoff/backoff.cc - - src/core/lib/channel/call_tracer.cc - src/core/lib/channel/channel_args.cc - src/core/lib/channel/channel_args_preconditioning.cc - src/core/lib/channel/channel_stack.cc @@ -11905,7 +11904,6 @@ targets: - src/core/lib/channel/channel_stack_builder_impl.cc - src/core/lib/channel/channel_stack_trace.cc - src/core/lib/channel/connected_channel.cc - - src/core/lib/channel/metrics.cc - src/core/lib/channel/promise_based_filter.cc - src/core/lib/channel/status_util.cc - src/core/lib/compression/compression.cc @@ -11913,9 +11911,6 @@ targets: - src/core/lib/compression/message_compress.cc - src/core/lib/config/core_configuration.cc - src/core/lib/debug/event_log.cc - - src/core/lib/debug/histogram_view.cc - - src/core/lib/debug/stats.cc - - src/core/lib/debug/stats_data.cc - src/core/lib/debug/trace.cc - src/core/lib/event_engine/ares_resolver.cc - src/core/lib/event_engine/cf_engine/cf_engine.cc @@ -12117,6 +12112,11 @@ targets: - src/core/resolver/resolver.cc - src/core/resolver/resolver_registry.cc - src/core/service_config/service_config_parser.cc + - src/core/telemetry/call_tracer.cc + - src/core/telemetry/histogram_view.cc + - src/core/telemetry/metrics.cc + - src/core/telemetry/stats.cc + - src/core/telemetry/stats_data.cc - src/core/tsi/alts/handshaker/transport_security_common_api.cc - test/core/transport/interception_chain_test.cc - third_party/upb/upb/mini_descriptor/build_enum.c @@ -13379,7 +13379,7 @@ targets: headers: - test/core/test_util/fake_stats_plugin.h src: - - test/core/channel/metrics_test.cc + - test/core/telemetry/metrics_test.cc - test/core/test_util/fake_stats_plugin.cc deps: - gtest @@ -18776,7 +18776,7 @@ targets: language: c++ headers: [] src: - - test/core/debug/stats_test.cc + - test/core/telemetry/stats_test.cc deps: - gtest - grpc_test_util diff --git a/config.m4 b/config.m4 index 672e7101589..86b0b7922b3 100644 --- a/config.m4 +++ b/config.m4 @@ -443,7 +443,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/address_utils/sockaddr_utils.cc \ src/core/lib/backoff/backoff.cc \ src/core/lib/backoff/random_early_detection.cc \ - src/core/lib/channel/call_tracer.cc \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_args_preconditioning.cc \ src/core/lib/channel/channel_stack.cc \ @@ -451,7 +450,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/channel/channel_stack_builder_impl.cc \ src/core/lib/channel/channel_stack_trace.cc \ src/core/lib/channel/connected_channel.cc \ - src/core/lib/channel/metrics.cc \ src/core/lib/channel/promise_based_filter.cc \ src/core/lib/channel/status_util.cc \ src/core/lib/compression/compression.cc \ @@ -462,9 +460,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/config/core_configuration.cc \ src/core/lib/config/load_config.cc \ src/core/lib/debug/event_log.cc \ - src/core/lib/debug/histogram_view.cc \ - src/core/lib/debug/stats.cc \ - src/core/lib/debug/stats_data.cc \ src/core/lib/debug/trace.cc \ src/core/lib/event_engine/ares_resolver.cc \ src/core/lib/event_engine/cf_engine/cf_engine.cc \ @@ -805,6 +800,11 @@ if test "$PHP_GRPC" != "no"; then src/core/service_config/service_config_channel_arg_filter.cc \ src/core/service_config/service_config_impl.cc \ src/core/service_config/service_config_parser.cc \ + src/core/telemetry/call_tracer.cc \ + src/core/telemetry/histogram_view.cc \ + src/core/telemetry/metrics.cc \ + src/core/telemetry/stats.cc \ + src/core/telemetry/stats_data.cc \ src/core/tsi/alts/crypt/aes_gcm.cc \ src/core/tsi/alts/crypt/gsec.cc \ src/core/tsi/alts/frame_protector/alts_counter.cc \ @@ -1592,6 +1592,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/resolver/xds) PHP_ADD_BUILD_DIR($ext_builddir/src/core/server) PHP_ADD_BUILD_DIR($ext_builddir/src/core/service_config) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/telemetry) PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi) PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/alts/crypt) PHP_ADD_BUILD_DIR($ext_builddir/src/core/tsi/alts/frame_protector) diff --git a/config.w32 b/config.w32 index c430f747c0a..86eb1661975 100644 --- a/config.w32 +++ b/config.w32 @@ -408,7 +408,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\address_utils\\sockaddr_utils.cc " + "src\\core\\lib\\backoff\\backoff.cc " + "src\\core\\lib\\backoff\\random_early_detection.cc " + - "src\\core\\lib\\channel\\call_tracer.cc " + "src\\core\\lib\\channel\\channel_args.cc " + "src\\core\\lib\\channel\\channel_args_preconditioning.cc " + "src\\core\\lib\\channel\\channel_stack.cc " + @@ -416,7 +415,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\channel\\channel_stack_builder_impl.cc " + "src\\core\\lib\\channel\\channel_stack_trace.cc " + "src\\core\\lib\\channel\\connected_channel.cc " + - "src\\core\\lib\\channel\\metrics.cc " + "src\\core\\lib\\channel\\promise_based_filter.cc " + "src\\core\\lib\\channel\\status_util.cc " + "src\\core\\lib\\compression\\compression.cc " + @@ -427,9 +425,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\config\\core_configuration.cc " + "src\\core\\lib\\config\\load_config.cc " + "src\\core\\lib\\debug\\event_log.cc " + - "src\\core\\lib\\debug\\histogram_view.cc " + - "src\\core\\lib\\debug\\stats.cc " + - "src\\core\\lib\\debug\\stats_data.cc " + "src\\core\\lib\\debug\\trace.cc " + "src\\core\\lib\\event_engine\\ares_resolver.cc " + "src\\core\\lib\\event_engine\\cf_engine\\cf_engine.cc " + @@ -770,6 +765,11 @@ if (PHP_GRPC != "no") { "src\\core\\service_config\\service_config_channel_arg_filter.cc " + "src\\core\\service_config\\service_config_impl.cc " + "src\\core\\service_config\\service_config_parser.cc " + + "src\\core\\telemetry\\call_tracer.cc " + + "src\\core\\telemetry\\histogram_view.cc " + + "src\\core\\telemetry\\metrics.cc " + + "src\\core\\telemetry\\stats.cc " + + "src\\core\\telemetry\\stats_data.cc " + "src\\core\\tsi\\alts\\crypt\\aes_gcm.cc " + "src\\core\\tsi\\alts\\crypt\\gsec.cc " + "src\\core\\tsi\\alts\\frame_protector\\alts_counter.cc " + @@ -1730,6 +1730,7 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\resolver\\xds"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\server"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\service_config"); + FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\telemetry"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\alts"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\tsi\\alts\\crypt"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 457103324f9..f96e7926a7d 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -874,7 +874,6 @@ Pod::Spec.new do |s| 'src/core/lib/backoff/backoff.h', 'src/core/lib/backoff/random_early_detection.h', 'src/core/lib/channel/call_finalization.h', - 'src/core/lib/channel/call_tracer.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_args_preconditioning.h', 'src/core/lib/channel/channel_fwd.h', @@ -884,19 +883,14 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_trace.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', - 'src/core/lib/channel/metrics.h', 'src/core/lib/channel/promise_based_filter.h', 'src/core/lib/channel/status_util.h', - 'src/core/lib/channel/tcp_tracer.h', 'src/core/lib/compression/compression_internal.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/config/config_vars.h', 'src/core/lib/config/core_configuration.h', 'src/core/lib/config/load_config.h', 'src/core/lib/debug/event_log.h', - 'src/core/lib/debug/histogram_view.h', - 'src/core/lib/debug/stats.h', - 'src/core/lib/debug/stats_data.h', 'src/core/lib/debug/trace.h', 'src/core/lib/event_engine/ares_resolver.h', 'src/core/lib/event_engine/cf_engine/cf_engine.h', @@ -1282,6 +1276,12 @@ Pod::Spec.new do |s| 'src/core/service_config/service_config_call_data.h', 'src/core/service_config/service_config_impl.h', 'src/core/service_config/service_config_parser.h', + 'src/core/telemetry/call_tracer.h', + 'src/core/telemetry/histogram_view.h', + 'src/core/telemetry/metrics.h', + 'src/core/telemetry/stats.h', + 'src/core/telemetry/stats_data.h', + 'src/core/telemetry/tcp_tracer.h', 'src/core/tsi/alts/crypt/gsec.h', 'src/core/tsi/alts/frame_protector/alts_counter.h', 'src/core/tsi/alts/frame_protector/alts_crypter.h', @@ -2145,7 +2145,6 @@ Pod::Spec.new do |s| 'src/core/lib/backoff/backoff.h', 'src/core/lib/backoff/random_early_detection.h', 'src/core/lib/channel/call_finalization.h', - 'src/core/lib/channel/call_tracer.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_args_preconditioning.h', 'src/core/lib/channel/channel_fwd.h', @@ -2155,19 +2154,14 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_trace.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', - 'src/core/lib/channel/metrics.h', 'src/core/lib/channel/promise_based_filter.h', 'src/core/lib/channel/status_util.h', - 'src/core/lib/channel/tcp_tracer.h', 'src/core/lib/compression/compression_internal.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/config/config_vars.h', 'src/core/lib/config/core_configuration.h', 'src/core/lib/config/load_config.h', 'src/core/lib/debug/event_log.h', - 'src/core/lib/debug/histogram_view.h', - 'src/core/lib/debug/stats.h', - 'src/core/lib/debug/stats_data.h', 'src/core/lib/debug/trace.h', 'src/core/lib/event_engine/ares_resolver.h', 'src/core/lib/event_engine/cf_engine/cf_engine.h', @@ -2553,6 +2547,12 @@ Pod::Spec.new do |s| 'src/core/service_config/service_config_call_data.h', 'src/core/service_config/service_config_impl.h', 'src/core/service_config/service_config_parser.h', + 'src/core/telemetry/call_tracer.h', + 'src/core/telemetry/histogram_view.h', + 'src/core/telemetry/metrics.h', + 'src/core/telemetry/stats.h', + 'src/core/telemetry/stats_data.h', + 'src/core/telemetry/tcp_tracer.h', 'src/core/tsi/alts/crypt/gsec.h', 'src/core/tsi/alts/frame_protector/alts_counter.h', 'src/core/tsi/alts/frame_protector/alts_crypter.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 2d2af17efc5..8096fd0e6cd 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -1211,8 +1211,6 @@ Pod::Spec.new do |s| 'src/core/lib/backoff/random_early_detection.cc', 'src/core/lib/backoff/random_early_detection.h', 'src/core/lib/channel/call_finalization.h', - 'src/core/lib/channel/call_tracer.cc', - 'src/core/lib/channel/call_tracer.h', 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_args_preconditioning.cc', @@ -1229,13 +1227,10 @@ Pod::Spec.new do |s| 'src/core/lib/channel/connected_channel.cc', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', - 'src/core/lib/channel/metrics.cc', - 'src/core/lib/channel/metrics.h', 'src/core/lib/channel/promise_based_filter.cc', 'src/core/lib/channel/promise_based_filter.h', 'src/core/lib/channel/status_util.cc', 'src/core/lib/channel/status_util.h', - 'src/core/lib/channel/tcp_tracer.h', 'src/core/lib/compression/compression.cc', 'src/core/lib/compression/compression_internal.cc', 'src/core/lib/compression/compression_internal.h', @@ -1250,12 +1245,6 @@ Pod::Spec.new do |s| 'src/core/lib/config/load_config.h', 'src/core/lib/debug/event_log.cc', 'src/core/lib/debug/event_log.h', - 'src/core/lib/debug/histogram_view.cc', - 'src/core/lib/debug/histogram_view.h', - 'src/core/lib/debug/stats.cc', - 'src/core/lib/debug/stats.h', - 'src/core/lib/debug/stats_data.cc', - 'src/core/lib/debug/stats_data.h', 'src/core/lib/debug/trace.cc', 'src/core/lib/debug/trace.h', 'src/core/lib/event_engine/ares_resolver.cc', @@ -1981,6 +1970,17 @@ Pod::Spec.new do |s| 'src/core/service_config/service_config_impl.h', 'src/core/service_config/service_config_parser.cc', 'src/core/service_config/service_config_parser.h', + 'src/core/telemetry/call_tracer.cc', + 'src/core/telemetry/call_tracer.h', + 'src/core/telemetry/histogram_view.cc', + 'src/core/telemetry/histogram_view.h', + 'src/core/telemetry/metrics.cc', + 'src/core/telemetry/metrics.h', + 'src/core/telemetry/stats.cc', + 'src/core/telemetry/stats.h', + 'src/core/telemetry/stats_data.cc', + 'src/core/telemetry/stats_data.h', + 'src/core/telemetry/tcp_tracer.h', 'src/core/tsi/alts/crypt/aes_gcm.cc', 'src/core/tsi/alts/crypt/gsec.cc', 'src/core/tsi/alts/crypt/gsec.h', @@ -2925,7 +2925,6 @@ Pod::Spec.new do |s| 'src/core/lib/backoff/backoff.h', 'src/core/lib/backoff/random_early_detection.h', 'src/core/lib/channel/call_finalization.h', - 'src/core/lib/channel/call_tracer.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_args_preconditioning.h', 'src/core/lib/channel/channel_fwd.h', @@ -2935,19 +2934,14 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_stack_trace.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', - 'src/core/lib/channel/metrics.h', 'src/core/lib/channel/promise_based_filter.h', 'src/core/lib/channel/status_util.h', - 'src/core/lib/channel/tcp_tracer.h', 'src/core/lib/compression/compression_internal.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/config/config_vars.h', 'src/core/lib/config/core_configuration.h', 'src/core/lib/config/load_config.h', 'src/core/lib/debug/event_log.h', - 'src/core/lib/debug/histogram_view.h', - 'src/core/lib/debug/stats.h', - 'src/core/lib/debug/stats_data.h', 'src/core/lib/debug/trace.h', 'src/core/lib/event_engine/ares_resolver.h', 'src/core/lib/event_engine/cf_engine/cf_engine.h', @@ -3333,6 +3327,12 @@ Pod::Spec.new do |s| 'src/core/service_config/service_config_call_data.h', 'src/core/service_config/service_config_impl.h', 'src/core/service_config/service_config_parser.h', + 'src/core/telemetry/call_tracer.h', + 'src/core/telemetry/histogram_view.h', + 'src/core/telemetry/metrics.h', + 'src/core/telemetry/stats.h', + 'src/core/telemetry/stats_data.h', + 'src/core/telemetry/tcp_tracer.h', 'src/core/tsi/alts/crypt/gsec.h', 'src/core/tsi/alts/frame_protector/alts_counter.h', 'src/core/tsi/alts/frame_protector/alts_crypter.h', diff --git a/grpc.gemspec b/grpc.gemspec index 7104853d64f..1a0b2d73869 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -1098,8 +1098,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/backoff/random_early_detection.cc ) s.files += %w( src/core/lib/backoff/random_early_detection.h ) s.files += %w( src/core/lib/channel/call_finalization.h ) - s.files += %w( src/core/lib/channel/call_tracer.cc ) - s.files += %w( src/core/lib/channel/call_tracer.h ) s.files += %w( src/core/lib/channel/channel_args.cc ) s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_args_preconditioning.cc ) @@ -1116,13 +1114,10 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/connected_channel.cc ) s.files += %w( src/core/lib/channel/connected_channel.h ) s.files += %w( src/core/lib/channel/context.h ) - s.files += %w( src/core/lib/channel/metrics.cc ) - s.files += %w( src/core/lib/channel/metrics.h ) s.files += %w( src/core/lib/channel/promise_based_filter.cc ) s.files += %w( src/core/lib/channel/promise_based_filter.h ) s.files += %w( src/core/lib/channel/status_util.cc ) s.files += %w( src/core/lib/channel/status_util.h ) - s.files += %w( src/core/lib/channel/tcp_tracer.h ) s.files += %w( src/core/lib/compression/compression.cc ) s.files += %w( src/core/lib/compression/compression_internal.cc ) s.files += %w( src/core/lib/compression/compression_internal.h ) @@ -1137,12 +1132,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/config/load_config.h ) s.files += %w( src/core/lib/debug/event_log.cc ) s.files += %w( src/core/lib/debug/event_log.h ) - s.files += %w( src/core/lib/debug/histogram_view.cc ) - s.files += %w( src/core/lib/debug/histogram_view.h ) - s.files += %w( src/core/lib/debug/stats.cc ) - s.files += %w( src/core/lib/debug/stats.h ) - s.files += %w( src/core/lib/debug/stats_data.cc ) - s.files += %w( src/core/lib/debug/stats_data.h ) s.files += %w( src/core/lib/debug/trace.cc ) s.files += %w( src/core/lib/debug/trace.h ) s.files += %w( src/core/lib/event_engine/ares_resolver.cc ) @@ -1868,6 +1857,17 @@ Gem::Specification.new do |s| s.files += %w( src/core/service_config/service_config_impl.h ) s.files += %w( src/core/service_config/service_config_parser.cc ) s.files += %w( src/core/service_config/service_config_parser.h ) + s.files += %w( src/core/telemetry/call_tracer.cc ) + s.files += %w( src/core/telemetry/call_tracer.h ) + s.files += %w( src/core/telemetry/histogram_view.cc ) + s.files += %w( src/core/telemetry/histogram_view.h ) + s.files += %w( src/core/telemetry/metrics.cc ) + s.files += %w( src/core/telemetry/metrics.h ) + s.files += %w( src/core/telemetry/stats.cc ) + s.files += %w( src/core/telemetry/stats.h ) + s.files += %w( src/core/telemetry/stats_data.cc ) + s.files += %w( src/core/telemetry/stats_data.h ) + s.files += %w( src/core/telemetry/tcp_tracer.h ) s.files += %w( src/core/tsi/alts/crypt/aes_gcm.cc ) s.files += %w( src/core/tsi/alts/crypt/gsec.cc ) s.files += %w( src/core/tsi/alts/crypt/gsec.h ) diff --git a/package.xml b/package.xml index 3cd01a87805..249e19c2fff 100644 --- a/package.xml +++ b/package.xml @@ -1080,8 +1080,6 @@ - - @@ -1098,13 +1096,10 @@ - - - @@ -1119,12 +1114,6 @@ - - - - - - @@ -1850,6 +1839,17 @@ + + + + + + + + + + + diff --git a/setup.py b/setup.py index d25e924d594..b93637215ff 100644 --- a/setup.py +++ b/setup.py @@ -441,7 +441,7 @@ DEFINE_MACROS += (("GRPC_DO_NOT_INSTANTIATE_POSIX_POLLER", 1),) # Fix for Cython build issue in aarch64. # It's required to define this macro before include . -# was included in core/lib/channel/call_tracer.h. +# was included in core/telemetry/call_tracer.h. # This macro should already be defined in grpc/grpc.h through port_platform.h, # but we're still having issue in aarch64, so we manually define the macro here. # TODO(xuanwn): Figure out what's going on in the aarch64 build so we can support diff --git a/src/core/BUILD b/src/core/BUILD index 53457328bfd..0752f8b056f 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -2998,10 +2998,10 @@ grpc_cc_library( grpc_cc_library( name = "histogram_view", srcs = [ - "lib/debug/histogram_view.cc", + "telemetry/histogram_view.cc", ], hdrs = [ - "lib/debug/histogram_view.h", + "telemetry/histogram_view.h", ], deps = ["//:gpr"], ) @@ -3009,10 +3009,10 @@ grpc_cc_library( grpc_cc_library( name = "stats_data", srcs = [ - "lib/debug/stats_data.cc", + "telemetry/stats_data.cc", ], hdrs = [ - "lib/debug/stats_data.h", + "telemetry/stats_data.h", ], external_deps = ["absl/strings"], deps = [ @@ -7887,10 +7887,10 @@ grpc_cc_library( grpc_cc_library( name = "metrics", srcs = [ - "lib/channel/metrics.cc", + "telemetry/metrics.cc", ], hdrs = [ - "lib/channel/metrics.h", + "telemetry/metrics.h", ], external_deps = [ "absl/container:flat_hash_map", diff --git a/src/core/client_channel/client_channel_filter.h b/src/core/client_channel/client_channel_filter.h index 9e11e12d223..5bbafc68d68 100644 --- a/src/core/client_channel/client_channel_filter.h +++ b/src/core/client_channel/client_channel_filter.h @@ -43,7 +43,6 @@ #include "src/core/client_channel/dynamic_filters.h" #include "src/core/client_channel/subchannel.h" #include "src/core/client_channel/subchannel_pool_interface.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" @@ -70,6 +69,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/telemetry/call_tracer.h" #include "src/core/util/time_precise.h" // diff --git a/src/core/client_channel/client_channel_internal.h b/src/core/client_channel/client_channel_internal.h index adc09a81172..a2c759ec7d6 100644 --- a/src/core/client_channel/client_channel_internal.h +++ b/src/core/client_channel/client_channel_internal.h @@ -26,12 +26,12 @@ #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/gprpp/unique_type_name.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/service_config/service_config_call_data.h" +#include "src/core/telemetry/call_tracer.h" // // This file contains internal interfaces used to allow various plugins diff --git a/src/core/client_channel/subchannel.cc b/src/core/client_channel/subchannel.cc index d0f9edefeab..9ebb91b276e 100644 --- a/src/core/client_channel/subchannel.cc +++ b/src/core/client_channel/subchannel.cc @@ -49,8 +49,6 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/channel_stack_builder_impl.h" #include "src/core/lib/config/core_configuration.h" -#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/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -67,6 +65,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/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/alloc.h" #include "src/core/util/useful.h" diff --git a/src/core/ext/filters/http/message_compress/compression_filter.cc b/src/core/ext/filters/http/message_compress/compression_filter.cc index ed077de6e70..43fa643bbb8 100644 --- a/src/core/ext/filters/http/message_compress/compression_filter.cc +++ b/src/core/ext/filters/http/message_compress/compression_filter.cc @@ -35,7 +35,6 @@ #include #include "src/core/ext/filters/message_size/message_size_filter.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" @@ -54,6 +53,7 @@ #include "src/core/lib/surface/call_trace.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_core { diff --git a/src/core/ext/filters/logging/logging_filter.cc b/src/core/ext/filters/logging/logging_filter.cc index 06ee67de012..bd229acb5de 100644 --- a/src/core/ext/filters/logging/logging_filter.cc +++ b/src/core/ext/filters/logging/logging_filter.cc @@ -50,7 +50,6 @@ #include "src/core/client_channel/client_channel_filter.h" #include "src/core/ext/filters/logging/logging_sink.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" @@ -71,6 +70,7 @@ #include "src/core/lib/transport/transport.h" #include "src/core/lib/uri/uri_parser.h" #include "src/core/resolver/resolver_registry.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 5c2d1c5ae20..2b85004c1a6 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -73,12 +73,8 @@ #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/ext/transport/chttp2/transport/write_size_policy.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/context.h" -#include "src/core/lib/channel/tcp_tracer.h" -#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/gprpp/bitset.h" #include "src/core/lib/gprpp/crash.h" @@ -108,6 +104,10 @@ #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/telemetry/call_tracer.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" +#include "src/core/telemetry/tcp_tracer.h" #include "src/core/util/string.h" #include "src/core/util/useful.h" diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h index d83b38e8c5c..a98381b489d 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h @@ -29,7 +29,6 @@ #include "src/core/channelz/channelz.h" #include "src/core/ext/transport/chttp2/transport/flow_control.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -39,6 +38,7 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/call_tracer.h" extern grpc_core::TraceFlag grpc_keepalive_trace; extern grpc_core::TraceFlag grpc_trace_http2_stream_state; diff --git a/src/core/ext/transport/chttp2/transport/context_list_entry.h b/src/core/ext/transport/chttp2/transport/context_list_entry.h index cf080874fe7..8d64b321aef 100644 --- a/src/core/ext/transport/chttp2/transport/context_list_entry.h +++ b/src/core/ext/transport/chttp2/transport/context_list_entry.h @@ -28,7 +28,7 @@ #include -#include "src/core/lib/channel/tcp_tracer.h" +#include "src/core/telemetry/tcp_tracer.h" namespace grpc_core { diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 4c4500dc280..44ae22ea475 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -44,9 +44,6 @@ #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h" #include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h" -#include "src/core/lib/channel/call_tracer.h" -#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/gprpp/match.h" #include "src/core/lib/slice/slice.h" @@ -54,6 +51,9 @@ #include "src/core/lib/surface/validate_metadata.h" #include "src/core/lib/transport/metadata_info.h" #include "src/core/lib/transport/parsed_metadata.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" // IWYU pragma: no_include diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index 95f752c3ba8..463e051dc27 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -40,11 +40,11 @@ #include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h" #include "src/core/ext/transport/chttp2/transport/legacy_frame.h" #include "src/core/lib/backoff/random_early_detection.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_refcount.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/call_tracer.h" // IWYU pragma: no_include diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 058928a596d..aa04864ec00 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -57,9 +57,7 @@ #include "src/core/ext/transport/chttp2/transport/ping_callbacks.h" #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include "src/core/ext/transport/chttp2/transport/write_size_policy.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/bitset.h" #include "src/core/lib/gprpp/debug_location.h" @@ -79,6 +77,8 @@ #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/telemetry/call_tracer.h" +#include "src/core/telemetry/tcp_tracer.h" // Flag that this closure barrier may be covering a write in a pollset, and so // we should not complete this closure until we can prove that the write got diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc index a49d91263e5..856d3bcb220 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.cc +++ b/src/core/ext/transport/chttp2/transport/parsing.cc @@ -60,7 +60,6 @@ #include "src/core/ext/transport/chttp2/transport/max_concurrent_streams_policy.h" #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include "src/core/lib/backoff/random_early_detection.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/experiments/experiments.h" @@ -76,6 +75,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/telemetry/call_tracer.h" using grpc_core::HPackParser; diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index 6b99d9deee8..0cc28270314 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -54,9 +54,6 @@ #include "src/core/ext/transport/chttp2/transport/ping_callbacks.h" #include "src/core/ext/transport/chttp2/transport/ping_rate_policy.h" #include "src/core/ext/transport/chttp2/transport/write_size_policy.h" -#include "src/core/lib/channel/call_tracer.h" -#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/experiments/experiments.h" #include "src/core/lib/gprpp/match.h" @@ -72,6 +69,9 @@ #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/telemetry/call_tracer.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/useful.h" // IWYU pragma: no_include "src/core/lib/gprpp/orphanable.h" diff --git a/src/core/handshaker/security/security_handshaker.cc b/src/core/handshaker/security/security_handshaker.cc index 33b21f31d13..bf073a66561 100644 --- a/src/core/handshaker/security/security_handshaker.cc +++ b/src/core/handshaker/security/security_handshaker.cc @@ -51,8 +51,6 @@ #include "src/core/handshaker/security/tsi_error.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.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" @@ -66,6 +64,8 @@ #include "src/core/lib/security/context/security_context.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/tsi/transport_security_grpc.h" #define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256 diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index 10b326e88d3..9fc6564c8de 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -60,7 +60,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/channel/metrics.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -73,6 +72,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/telemetry/metrics.h" #include "src/core/util/time_precise.h" struct grpc_channel_element_args { diff --git a/src/core/lib/gprpp/work_serializer.cc b/src/core/lib/gprpp/work_serializer.cc index 88c10c00a8a..653aa8659cf 100644 --- a/src/core/lib/gprpp/work_serializer.cc +++ b/src/core/lib/gprpp/work_serializer.cc @@ -34,8 +34,6 @@ #include #include -#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/experiments/experiments.h" #include "src/core/lib/gprpp/debug_location.h" @@ -43,6 +41,8 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { diff --git a/src/core/lib/iomgr/call_combiner.cc b/src/core/lib/iomgr/call_combiner.cc index c6fb49cea1a..fa56bfa3e76 100644 --- a/src/core/lib/iomgr/call_combiner.cc +++ b/src/core/lib/iomgr/call_combiner.cc @@ -26,9 +26,9 @@ #include #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/crash.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index d40b20a93b7..f0021d0ed7e 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -49,8 +49,6 @@ #include #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/strerror.h" #include "src/core/lib/iomgr/block_annotate.h" @@ -59,6 +57,8 @@ #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/lockfree_event.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/string.h" #include "src/core/util/useful.h" diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index d4c78557f06..02c3bb77c4b 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -41,14 +41,14 @@ #include #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/ev_poll_posix.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/useful.h" #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker*)1) diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index a19c13ab7b6..9d6477aaaaf 100644 --- a/src/core/lib/iomgr/iocp_windows.cc +++ b/src/core/lib/iomgr/iocp_windows.cc @@ -33,14 +33,14 @@ #include #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/socket_windows.h" #include "src/core/lib/iomgr/timer.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" static ULONG g_iocp_kick_token; static OVERLAPPED g_iocp_custom_overlap; diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 1f9f9817e04..6992bcf687c 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -57,8 +57,6 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/debug/event_log.h" -#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/experiments/experiments.h" #include "src/core/lib/gprpp/crash.h" @@ -76,6 +74,8 @@ #include "src/core/lib/resource_quota/trace.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/string.h" #include "src/core/util/useful.h" diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index cd9a15d0bd6..9a54226862b 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -58,13 +58,10 @@ #include "src/core/channelz/channelz.h" #include "src/core/lib/channel/call_finalization.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/compression/compression_internal.h" -#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/gprpp/bitset.h" #include "src/core/lib/gprpp/cpp_impl_of.h" @@ -104,6 +101,9 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" #include "src/core/server/server_interface.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/alloc.h" #include "src/core/util/time_precise.h" #include "src/core/util/useful.h" diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 827d37f06b6..b8134974794 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -29,11 +29,11 @@ #include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/compression/compression_internal.h" -#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/iomgr/exec_ctx.h" #include "src/core/lib/surface/api_trace.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { diff --git a/src/core/lib/surface/channel_create.cc b/src/core/lib/surface/channel_create.cc index 0ad87af1f62..5ae280171e7 100644 --- a/src/core/lib/surface/channel_create.cc +++ b/src/core/lib/surface/channel_create.cc @@ -24,11 +24,11 @@ #include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/lame_client.h" #include "src/core/lib/surface/legacy_channel.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index b439191f1bb..1c77614f6fb 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -41,8 +41,6 @@ #include #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/atomic_utils.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted.h" @@ -55,6 +53,8 @@ #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/event_string.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/spinlock.h" #ifdef GPR_WINDOWS diff --git a/src/core/lib/surface/legacy_channel.cc b/src/core/lib/surface/legacy_channel.cc index d8f53540e32..69a41cf503e 100644 --- a/src/core/lib/surface/legacy_channel.cc +++ b/src/core/lib/surface/legacy_channel.cc @@ -36,10 +36,7 @@ #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/channel_stack_builder_impl.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/dual_ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -57,6 +54,9 @@ #include "src/core/lib/surface/init_internally.h" #include "src/core/lib/surface/lame_client.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/metrics.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { diff --git a/src/core/lib/surface/legacy_channel.h b/src/core/lib/surface/legacy_channel.h index 3cf3fa0db22..0ebf7b4aacb 100644 --- a/src/core/lib/surface/legacy_channel.h +++ b/src/core/lib/surface/legacy_channel.h @@ -32,7 +32,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" // IWYU pragma: keep -#include "src/core/lib/debug/stats.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/iomgr_fwd.h" @@ -40,6 +39,7 @@ #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel_stack_type.h" #include "src/core/lib/transport/call_arena_allocator.h" +#include "src/core/telemetry/stats.h" namespace grpc_core { diff --git a/src/core/lib/transport/metadata_info.h b/src/core/lib/transport/metadata_info.h index 76569a97c66..02ab305c81b 100644 --- a/src/core/lib/transport/metadata_info.h +++ b/src/core/lib/transport/metadata_info.h @@ -18,9 +18,9 @@ #include #include "src/core/ext/transport/chttp2/transport/hpack_constants.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_core { diff --git a/src/core/load_balancing/lb_policy.h b/src/core/load_balancing/lb_policy.h index 68f75e5271a..838d89ae2d5 100644 --- a/src/core/load_balancing/lb_policy.h +++ b/src/core/load_balancing/lb_policy.h @@ -38,7 +38,6 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/dual_ref_counted.h" @@ -52,6 +51,7 @@ #include "src/core/load_balancing/backend_metric_data.h" #include "src/core/load_balancing/subchannel_interface.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/telemetry/metrics.h" namespace grpc_core { diff --git a/src/core/load_balancing/pick_first/pick_first.cc b/src/core/load_balancing/pick_first/pick_first.cc index ae5cb82489b..d22fe292b6a 100644 --- a/src/core/load_balancing/pick_first/pick_first.cc +++ b/src/core/load_balancing/pick_first/pick_first.cc @@ -43,7 +43,6 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/experiments/experiments.h" @@ -65,6 +64,7 @@ #include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/subchannel_interface.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/telemetry/metrics.h" #include "src/core/util/useful.h" namespace grpc_core { diff --git a/src/core/load_balancing/rls/rls.cc b/src/core/load_balancing/rls/rls.cc index 53480d6f091..26bd71d0dda 100644 --- a/src/core/load_balancing/rls/rls.cc +++ b/src/core/load_balancing/rls/rls.cc @@ -70,7 +70,6 @@ #include "src/core/client_channel/client_channel_filter.h" #include "src/core/lib/backoff/backoff.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/debug_location.h" @@ -107,6 +106,7 @@ #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/resolver_registry.h" #include "src/core/service_config/service_config_impl.h" +#include "src/core/telemetry/metrics.h" #include "src/proto/grpc/lookup/v1/rls.upb.h" using ::grpc_event_engine::experimental::EventEngine; diff --git a/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc b/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc index d0a4165f393..f750b0ae0a0 100644 --- a/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +++ b/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc @@ -45,10 +45,7 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/config/core_configuration.h" -#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/experiments/experiments.h" #include "src/core/lib/gprpp/debug_location.h" @@ -74,6 +71,9 @@ #include "src/core/load_balancing/weighted_round_robin/static_stride_scheduler.h" #include "src/core/load_balancing/weighted_target/weighted_target.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/telemetry/metrics.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { diff --git a/src/core/load_balancing/xds/xds_cluster_impl.cc b/src/core/load_balancing/xds/xds_cluster_impl.cc index 0554e28b4e7..6ea74538a36 100644 --- a/src/core/load_balancing/xds/xds_cluster_impl.cc +++ b/src/core/load_balancing/xds/xds_cluster_impl.cc @@ -38,7 +38,6 @@ #include #include "src/core/client_channel/client_channel_internal.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/debug/trace.h" @@ -67,6 +66,7 @@ #include "src/core/load_balancing/xds/xds_channel_args.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/xds/xds_dependency_manager.h" +#include "src/core/telemetry/call_tracer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_client_grpc.h" #include "src/core/xds/grpc/xds_endpoint.h" diff --git a/src/core/server/server.cc b/src/core/server/server.cc index b891001f3d4..6397e03a62c 100644 --- a/src/core/server/server.cc +++ b/src/core/server/server.cc @@ -52,7 +52,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args_preconditioning.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/debug/stats.h" #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/debug_location.h" @@ -83,6 +82,7 @@ #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/error_utils.h" #include "src/core/lib/transport/interception_chain.h" +#include "src/core/telemetry/stats.h" #include "src/core/util/useful.h" namespace grpc_core { diff --git a/src/core/server/server.h b/src/core/server/server.h index 01b541c233e..279e1f8362b 100644 --- a/src/core/server/server.h +++ b/src/core/server/server.h @@ -47,7 +47,6 @@ #include "src/core/channelz/channelz.h" #include "src/core/lib/backoff/random_early_detection.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" @@ -70,6 +69,7 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" #include "src/core/server/server_interface.h" +#include "src/core/telemetry/call_tracer.h" #define GRPC_ARG_SERVER_MAX_PENDING_REQUESTS "grpc.server.max_pending_requests" #define GRPC_ARG_SERVER_MAX_PENDING_REQUESTS_HARD_LIMIT \ diff --git a/src/core/server/server_call_tracer_filter.cc b/src/core/server/server_call_tracer_filter.cc index 6ceb637d481..7a63b4768b6 100644 --- a/src/core/server/server_call_tracer_filter.cc +++ b/src/core/server/server_call_tracer_filter.cc @@ -26,7 +26,6 @@ #include #include "src/core/lib/channel/call_finalization.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack.h" @@ -40,6 +39,7 @@ #include "src/core/lib/promise/pipe.h" #include "src/core/lib/surface/channel_stack_type.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_core { diff --git a/src/core/lib/channel/call_tracer.cc b/src/core/telemetry/call_tracer.cc similarity index 99% rename from src/core/lib/channel/call_tracer.cc rename to src/core/telemetry/call_tracer.cc index 154bbdfbf06..093664e85f6 100644 --- a/src/core/lib/channel/call_tracer.cc +++ b/src/core/telemetry/call_tracer.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/call_tracer.h" +#include "src/core/telemetry/call_tracer.h" #include #include @@ -27,8 +27,8 @@ #include #include -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/promise/context.h" +#include "src/core/telemetry/tcp_tracer.h" namespace grpc_core { diff --git a/src/core/lib/channel/call_tracer.h b/src/core/telemetry/call_tracer.h similarity index 97% rename from src/core/lib/channel/call_tracer.h rename to src/core/telemetry/call_tracer.h index f0b74f7e598..3f98c7098e0 100644 --- a/src/core/lib/channel/call_tracer.h +++ b/src/core/telemetry/call_tracer.h @@ -16,8 +16,8 @@ // // -#ifndef GRPC_SRC_CORE_LIB_CHANNEL_CALL_TRACER_H -#define GRPC_SRC_CORE_LIB_CHANNEL_CALL_TRACER_H +#ifndef GRPC_SRC_CORE_TELEMETRY_CALL_TRACER_H +#define GRPC_SRC_CORE_TELEMETRY_CALL_TRACER_H #include #include @@ -31,13 +31,13 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/context.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/gprpp/ref_counted_string.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/call_final_info.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/tcp_tracer.h" namespace grpc_core { @@ -223,4 +223,4 @@ void AddServerCallTracerToContext(grpc_call_context_element* call_context, } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_CHANNEL_CALL_TRACER_H +#endif // GRPC_SRC_CORE_TELEMETRY_CALL_TRACER_H diff --git a/src/core/lib/debug/histogram_view.cc b/src/core/telemetry/histogram_view.cc similarity index 97% rename from src/core/lib/debug/histogram_view.cc rename to src/core/telemetry/histogram_view.cc index 803f7a2321e..fdfa402d6d2 100644 --- a/src/core/lib/debug/histogram_view.cc +++ b/src/core/telemetry/histogram_view.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/core/lib/debug/histogram_view.h" +#include "src/core/telemetry/histogram_view.h" #include diff --git a/src/core/lib/debug/histogram_view.h b/src/core/telemetry/histogram_view.h similarity index 86% rename from src/core/lib/debug/histogram_view.h rename to src/core/telemetry/histogram_view.h index dd6dd74fd41..62018d8b840 100644 --- a/src/core/lib/debug/histogram_view.h +++ b/src/core/telemetry/histogram_view.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GRPC_SRC_CORE_LIB_DEBUG_HISTOGRAM_VIEW_H -#define GRPC_SRC_CORE_LIB_DEBUG_HISTOGRAM_VIEW_H +#ifndef GRPC_SRC_CORE_TELEMETRY_HISTOGRAM_VIEW_H +#define GRPC_SRC_CORE_TELEMETRY_HISTOGRAM_VIEW_H #include @@ -34,4 +34,4 @@ struct HistogramView { } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_DEBUG_HISTOGRAM_VIEW_H +#endif // GRPC_SRC_CORE_TELEMETRY_HISTOGRAM_VIEW_H diff --git a/src/core/lib/channel/metrics.cc b/src/core/telemetry/metrics.cc similarity index 99% rename from src/core/lib/channel/metrics.cc rename to src/core/telemetry/metrics.cc index c3b734fc44d..b403a8649f2 100644 --- a/src/core/lib/channel/metrics.cc +++ b/src/core/telemetry/metrics.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/core/lib/channel/metrics.h" +#include "src/core/telemetry/metrics.h" #include diff --git a/src/core/lib/channel/metrics.h b/src/core/telemetry/metrics.h similarity index 99% rename from src/core/lib/channel/metrics.h rename to src/core/telemetry/metrics.h index 797be93fd7d..0a02cf9acfc 100644 --- a/src/core/lib/channel/metrics.h +++ b/src/core/telemetry/metrics.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GRPC_SRC_CORE_LIB_CHANNEL_METRICS_H -#define GRPC_SRC_CORE_LIB_CHANNEL_METRICS_H +#ifndef GRPC_SRC_CORE_TELEMETRY_METRICS_H +#define GRPC_SRC_CORE_TELEMETRY_METRICS_H #include #include @@ -29,13 +29,13 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/gprpp/no_destruct.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/slice/slice.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_core { @@ -536,4 +536,4 @@ class RegisteredMetricCallback { } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_CHANNEL_METRICS_H +#endif // GRPC_SRC_CORE_TELEMETRY_METRICS_H diff --git a/src/core/lib/debug/stats.cc b/src/core/telemetry/stats.cc similarity index 98% rename from src/core/lib/debug/stats.cc rename to src/core/telemetry/stats.cc index e7d6a63169d..c5137e71f85 100644 --- a/src/core/lib/debug/stats.cc +++ b/src/core/telemetry/stats.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/debug/stats.h" +#include "src/core/telemetry/stats.h" #include diff --git a/src/core/lib/debug/stats.h b/src/core/telemetry/stats.h similarity index 89% rename from src/core/lib/debug/stats.h rename to src/core/telemetry/stats.h index 6415a4cd039..b1026abbb28 100644 --- a/src/core/lib/debug/stats.h +++ b/src/core/telemetry/stats.h @@ -16,8 +16,8 @@ // // -#ifndef GRPC_SRC_CORE_LIB_DEBUG_STATS_H -#define GRPC_SRC_CORE_LIB_DEBUG_STATS_H +#ifndef GRPC_SRC_CORE_TELEMETRY_STATS_H +#define GRPC_SRC_CORE_TELEMETRY_STATS_H #include @@ -29,9 +29,9 @@ #include -#include "src/core/lib/debug/histogram_view.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/no_destruct.h" +#include "src/core/telemetry/histogram_view.h" +#include "src/core/telemetry/stats_data.h" namespace grpc_core { @@ -61,4 +61,4 @@ std::string StatsAsJson(T* data) { } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_DEBUG_STATS_H +#endif // GRPC_SRC_CORE_TELEMETRY_STATS_H diff --git a/src/core/lib/debug/stats_data.cc b/src/core/telemetry/stats_data.cc similarity index 99% rename from src/core/lib/debug/stats_data.cc rename to src/core/telemetry/stats_data.cc index a390927e78f..4a317b7fcf0 100644 --- a/src/core/lib/debug/stats_data.cc +++ b/src/core/telemetry/stats_data.cc @@ -14,7 +14,7 @@ // Automatically generated by tools/codegen/core/gen_stats_data.py -#include "src/core/lib/debug/stats_data.h" +#include "src/core/telemetry/stats_data.h" #include diff --git a/src/core/lib/debug/stats_data.h b/src/core/telemetry/stats_data.h similarity index 99% rename from src/core/lib/debug/stats_data.h rename to src/core/telemetry/stats_data.h index 8b9aa2b5fa8..6220a118f20 100644 --- a/src/core/lib/debug/stats_data.h +++ b/src/core/telemetry/stats_data.h @@ -14,8 +14,8 @@ // Automatically generated by tools/codegen/core/gen_stats_data.py -#ifndef GRPC_SRC_CORE_LIB_DEBUG_STATS_DATA_H -#define GRPC_SRC_CORE_LIB_DEBUG_STATS_DATA_H +#ifndef GRPC_SRC_CORE_TELEMETRY_STATS_DATA_H +#define GRPC_SRC_CORE_TELEMETRY_STATS_DATA_H #include @@ -26,8 +26,8 @@ #include -#include "src/core/lib/debug/histogram_view.h" #include "src/core/lib/gprpp/per_cpu.h" +#include "src/core/telemetry/histogram_view.h" namespace grpc_core { class HistogramCollector_100000_20; @@ -576,4 +576,4 @@ class GlobalStatsCollector { }; } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_DEBUG_STATS_DATA_H +#endif // GRPC_SRC_CORE_TELEMETRY_STATS_DATA_H diff --git a/src/core/lib/debug/stats_data.yaml b/src/core/telemetry/stats_data.yaml similarity index 100% rename from src/core/lib/debug/stats_data.yaml rename to src/core/telemetry/stats_data.yaml diff --git a/src/core/lib/channel/tcp_tracer.h b/src/core/telemetry/tcp_tracer.h similarity index 97% rename from src/core/lib/channel/tcp_tracer.h rename to src/core/telemetry/tcp_tracer.h index f6097447014..1068678cab8 100644 --- a/src/core/lib/channel/tcp_tracer.h +++ b/src/core/telemetry/tcp_tracer.h @@ -16,8 +16,8 @@ // // -#ifndef GRPC_SRC_CORE_LIB_CHANNEL_TCP_TRACER_H -#define GRPC_SRC_CORE_LIB_CHANNEL_TCP_TRACER_H +#ifndef GRPC_SRC_CORE_TELEMETRY_TCP_TRACER_H +#define GRPC_SRC_CORE_TELEMETRY_TCP_TRACER_H #include #include @@ -141,4 +141,4 @@ class TcpTracerInterface { } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_CHANNEL_TCP_TRACER_H +#endif // GRPC_SRC_CORE_TELEMETRY_TCP_TRACER_H diff --git a/src/core/xds/grpc/xds_client_grpc.cc b/src/core/xds/grpc/xds_client_grpc.cc index 3b00fed06e4..6855e7fa6d8 100644 --- a/src/core/xds/grpc/xds_client_grpc.cc +++ b/src/core/xds/grpc/xds_client_grpc.cc @@ -41,7 +41,6 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/debug_location.h" @@ -56,6 +55,7 @@ #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/error_utils.h" +#include "src/core/telemetry/metrics.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_transport_grpc.h" diff --git a/src/core/xds/grpc/xds_client_grpc.h b/src/core/xds/grpc/xds_client_grpc.h index 9fdb9bccceb..babfbf4bc37 100644 --- a/src/core/xds/grpc/xds_client_grpc.h +++ b/src/core/xds/grpc/xds_client_grpc.h @@ -26,11 +26,11 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/telemetry/metrics.h" #include "src/core/util/useful.h" #include "src/core/xds/grpc/certificate_provider_store.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" diff --git a/src/core/xds/xds_client/xds_client_stats.h b/src/core/xds/xds_client/xds_client_stats.h index 1bfc28c3f3e..291a9e25718 100644 --- a/src/core/xds/xds_client/xds_client_stats.h +++ b/src/core/xds/xds_client/xds_client_stats.h @@ -31,12 +31,12 @@ #include -#include "src/core/lib/channel/call_tracer.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/resolver/endpoint_addresses.h" +#include "src/core/telemetry/call_tracer.h" #include "src/core/util/useful.h" #include "src/core/xds/xds_client/xds_bootstrap.h" diff --git a/src/cpp/ext/csm/metadata_exchange.cc b/src/cpp/ext/csm/metadata_exchange.cc index 3a457a63d5a..96b26482ae2 100644 --- a/src/cpp/ext/csm/metadata_exchange.cc +++ b/src/cpp/ext/csm/metadata_exchange.cc @@ -39,7 +39,6 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/load_file.h" #include "src/core/lib/iomgr/error.h" @@ -47,6 +46,7 @@ #include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_reader.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/telemetry/call_tracer.h" #include "src/cpp/ext/otel/key_value_iterable.h" namespace grpc { diff --git a/src/cpp/ext/filters/census/client_filter.cc b/src/cpp/ext/filters/census/client_filter.cc index b7157f01599..efb191da95d 100644 --- a/src/cpp/ext/filters/census/client_filter.cc +++ b/src/cpp/ext/filters/census/client_filter.cc @@ -54,7 +54,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/promise/context.h" #include "src/core/lib/resource_quota/arena.h" @@ -63,6 +62,7 @@ #include "src/core/lib/surface/call.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/tcp_tracer.h" #include "src/cpp/ext/filters/census/context.h" #include "src/cpp/ext/filters/census/grpc_plugin.h" #include "src/cpp/ext/filters/census/measures.h" diff --git a/src/cpp/ext/filters/census/grpc_plugin.cc b/src/cpp/ext/filters/census/grpc_plugin.cc index 3e345c2f6d8..2a4cd786d1b 100644 --- a/src/cpp/ext/filters/census/grpc_plugin.cc +++ b/src/cpp/ext/filters/census/grpc_plugin.cc @@ -30,9 +30,9 @@ #include #include "src/core/ext/filters/logging/logging_filter.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/surface/channel_stack_type.h" +#include "src/core/telemetry/call_tracer.h" #include "src/cpp/ext/filters/census/client_filter.h" #include "src/cpp/ext/filters/census/measures.h" #include "src/cpp/ext/filters/census/server_call_tracer.h" diff --git a/src/cpp/ext/filters/census/open_census_call_tracer.h b/src/cpp/ext/filters/census/open_census_call_tracer.h index b0eb7e3cae0..690677b5d94 100644 --- a/src/cpp/ext/filters/census/open_census_call_tracer.h +++ b/src/cpp/ext/filters/census/open_census_call_tracer.h @@ -37,9 +37,7 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/context.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/resource_quota/arena.h" @@ -47,6 +45,8 @@ #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/tcp_tracer.h" // TODO(yashykt): This might not be the right place for this channel arg, but we // don't have a better place for this right now. diff --git a/src/cpp/ext/filters/census/server_call_tracer.cc b/src/cpp/ext/filters/census/server_call_tracer.cc index 39197015d45..e0852065320 100644 --- a/src/cpp/ext/filters/census/server_call_tracer.cc +++ b/src/cpp/ext/filters/census/server_call_tracer.cc @@ -43,16 +43,16 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/promise/context.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/tcp_tracer.h" #include "src/cpp/ext/filters/census/context.h" #include "src/cpp/ext/filters/census/grpc_plugin.h" #include "src/cpp/ext/filters/census/measures.h" diff --git a/src/cpp/ext/filters/census/server_call_tracer.h b/src/cpp/ext/filters/census/server_call_tracer.h index 4a11b4e8c53..25bb0f19303 100644 --- a/src/cpp/ext/filters/census/server_call_tracer.h +++ b/src/cpp/ext/filters/census/server_call_tracer.h @@ -21,8 +21,8 @@ #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/resource_quota/arena.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc { namespace internal { diff --git a/src/cpp/ext/otel/otel_client_call_tracer.cc b/src/cpp/ext/otel/otel_client_call_tracer.cc index f22fcbf992e..84123c0444e 100644 --- a/src/cpp/ext/otel/otel_client_call_tracer.cc +++ b/src/cpp/ext/otel/otel_client_call_tracer.cc @@ -48,13 +48,13 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/context.h" #include "src/core/lib/channel/status_util.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/promise/context.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/tcp_tracer.h" #include "src/cpp/ext/otel/key_value_iterable.h" #include "src/cpp/ext/otel/otel_plugin.h" diff --git a/src/cpp/ext/otel/otel_client_call_tracer.h b/src/cpp/ext/otel/otel_client_call_tracer.h index ed1465dabb5..366c83064f1 100644 --- a/src/cpp/ext/otel/otel_client_call_tracer.h +++ b/src/cpp/ext/otel/otel_client_call_tracer.h @@ -32,8 +32,6 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/resource_quota/arena.h" @@ -41,6 +39,8 @@ #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/tcp_tracer.h" #include "src/cpp/ext/otel/otel_plugin.h" namespace grpc { diff --git a/src/cpp/ext/otel/otel_plugin.cc b/src/cpp/ext/otel/otel_plugin.cc index acb81be35ee..588404f75df 100644 --- a/src/cpp/ext/otel/otel_plugin.cc +++ b/src/cpp/ext/otel/otel_plugin.cc @@ -36,11 +36,11 @@ #include #include "src/core/client_channel/client_channel_filter.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/match.h" #include "src/core/lib/surface/channel_stack_type.h" +#include "src/core/telemetry/call_tracer.h" #include "src/cpp/ext/otel/key_value_iterable.h" #include "src/cpp/ext/otel/otel_client_call_tracer.h" #include "src/cpp/ext/otel/otel_server_call_tracer.h" diff --git a/src/cpp/ext/otel/otel_plugin.h b/src/cpp/ext/otel/otel_plugin.h index 49d2cc3e384..5bce0cc39ac 100644 --- a/src/cpp/ext/otel/otel_plugin.h +++ b/src/cpp/ext/otel/otel_plugin.h @@ -42,8 +42,8 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/metrics.h" namespace grpc { namespace internal { diff --git a/src/cpp/ext/otel/otel_server_call_tracer.cc b/src/cpp/ext/otel/otel_server_call_tracer.cc index 21641f4baa8..d62af3d9081 100644 --- a/src/cpp/ext/otel/otel_server_call_tracer.cc +++ b/src/cpp/ext/otel/otel_server_call_tracer.cc @@ -37,12 +37,12 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/status_util.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/tcp_tracer.h" #include "src/cpp/ext/otel/key_value_iterable.h" #include "src/cpp/ext/otel/otel_plugin.h" diff --git a/src/cpp/ext/otel/otel_server_call_tracer.h b/src/cpp/ext/otel/otel_server_call_tracer.h index 8ae0f051a03..66c460d6b65 100644 --- a/src/cpp/ext/otel/otel_server_call_tracer.h +++ b/src/cpp/ext/otel/otel_server_call_tracer.h @@ -23,8 +23,8 @@ #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/telemetry/call_tracer.h" #include "src/cpp/ext/otel/otel_plugin.h" namespace grpc { diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 13c7b41ad98..5f5afcfc944 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -59,7 +59,7 @@ cdef extern from "" namespace "std" nogil: # gRPC Core Declarations -cdef extern from "src/core/lib/channel/call_tracer.h" namespace "grpc_core": +cdef extern from "src/core/telemetry/call_tracer.h" namespace "grpc_core": cdef cppclass ClientCallTracer: pass diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index a6e9be13ead..d79b4c9f96c 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -417,7 +417,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/address_utils/sockaddr_utils.cc', 'src/core/lib/backoff/backoff.cc', 'src/core/lib/backoff/random_early_detection.cc', - 'src/core/lib/channel/call_tracer.cc', 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_args_preconditioning.cc', 'src/core/lib/channel/channel_stack.cc', @@ -425,7 +424,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/channel/channel_stack_builder_impl.cc', 'src/core/lib/channel/channel_stack_trace.cc', 'src/core/lib/channel/connected_channel.cc', - 'src/core/lib/channel/metrics.cc', 'src/core/lib/channel/promise_based_filter.cc', 'src/core/lib/channel/status_util.cc', 'src/core/lib/compression/compression.cc', @@ -436,9 +434,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/config/core_configuration.cc', 'src/core/lib/config/load_config.cc', 'src/core/lib/debug/event_log.cc', - 'src/core/lib/debug/histogram_view.cc', - 'src/core/lib/debug/stats.cc', - 'src/core/lib/debug/stats_data.cc', 'src/core/lib/debug/trace.cc', 'src/core/lib/event_engine/ares_resolver.cc', 'src/core/lib/event_engine/cf_engine/cf_engine.cc', @@ -779,6 +774,11 @@ CORE_SOURCE_FILES = [ 'src/core/service_config/service_config_channel_arg_filter.cc', 'src/core/service_config/service_config_impl.cc', 'src/core/service_config/service_config_parser.cc', + 'src/core/telemetry/call_tracer.cc', + 'src/core/telemetry/histogram_view.cc', + 'src/core/telemetry/metrics.cc', + 'src/core/telemetry/stats.cc', + 'src/core/telemetry/stats_data.cc', 'src/core/tsi/alts/crypt/aes_gcm.cc', 'src/core/tsi/alts/crypt/gsec.cc', 'src/core/tsi/alts/frame_protector/alts_counter.cc', diff --git a/src/python/grpcio_observability/grpc_observability/_cyobservability.pxd b/src/python/grpcio_observability/grpc_observability/_cyobservability.pxd index c0c2fb25c61..240bf66e03a 100644 --- a/src/python/grpcio_observability/grpc_observability/_cyobservability.pxd +++ b/src/python/grpcio_observability/grpc_observability/_cyobservability.pxd @@ -34,7 +34,7 @@ cdef extern from "" namespace "std" nogil: cdef cppclass condition_variable: void notify_all() -cdef extern from "src/core/lib/channel/call_tracer.h" namespace "grpc_core": +cdef extern from "src/core/telemetry/call_tracer.h" namespace "grpc_core": cdef cppclass ClientCallTracer: pass diff --git a/src/python/grpcio_observability/grpc_observability/client_call_tracer.h b/src/python/grpcio_observability/grpc_observability/client_call_tracer.h index e100c4bcfc8..117e017cb2c 100644 --- a/src/python/grpcio_observability/grpc_observability/client_call_tracer.h +++ b/src/python/grpcio_observability/grpc_observability/client_call_tracer.h @@ -28,7 +28,7 @@ #include -#include "src/core/lib/channel/call_tracer.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_observability { diff --git a/src/python/grpcio_observability/grpc_observability/server_call_tracer.cc b/src/python/grpcio_observability/grpc_observability/server_call_tracer.cc index 6524013df17..a9a5a88c60f 100644 --- a/src/python/grpcio_observability/grpc_observability/server_call_tracer.cc +++ b/src/python/grpcio_observability/grpc_observability/server_call_tracer.cc @@ -35,13 +35,13 @@ #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_buffer.h" #include "src/core/lib/transport/metadata_batch.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_observability { diff --git a/src/python/grpcio_observability/grpc_observability/server_call_tracer.h b/src/python/grpcio_observability/grpc_observability/server_call_tracer.h index a704a0704a4..974d37d9cec 100644 --- a/src/python/grpcio_observability/grpc_observability/server_call_tracer.h +++ b/src/python/grpcio_observability/grpc_observability/server_call_tracer.h @@ -20,9 +20,9 @@ #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/resource_quota/arena.h" #include "src/core/lib/slice/slice.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_observability { diff --git a/src/python/grpcio_observability/setup.py b/src/python/grpcio_observability/setup.py index ce0d4f9f453..6d07015fb30 100644 --- a/src/python/grpcio_observability/setup.py +++ b/src/python/grpcio_observability/setup.py @@ -207,7 +207,7 @@ elif "linux" in sys.platform or "darwin" in sys.platform: # Fix for Cython build issue in aarch64. # It's required to define this macro before include . -# was included in core/lib/channel/call_tracer.h. +# was included in core/telemetry/call_tracer.h. # This macro should already be defined in grpc/grpc.h through port_platform.h, # but we're still having issue in aarch64, so we manually define the macro here. # TODO(xuanwn): Figure out what's going on in the aarch64 build so we can support diff --git a/test/core/channel/BUILD b/test/core/channel/BUILD index b54cc023fa3..f3c2342998e 100644 --- a/test/core/channel/BUILD +++ b/test/core/channel/BUILD @@ -18,20 +18,6 @@ grpc_package(name = "test/core/channel") licenses(["notice"]) -grpc_cc_test( - name = "call_tracer_test", - srcs = ["call_tracer_test.cc"], - external_deps = ["gtest"], - language = "C++", - uses_event_engine = False, - uses_polling = False, - deps = [ - "//:grpc", - "//test/core/test_util:fake_stats_plugin", - "//test/core/test_util:grpc_test_util", - ], -) - grpc_cc_test( name = "channel_args_test", srcs = ["channel_args_test.cc"], @@ -145,20 +131,3 @@ grpc_cc_test( "//test/core/test_util:grpc_test_util", ], ) - -grpc_cc_test( - name = "metrics_test", - srcs = ["metrics_test.cc"], - external_deps = [ - "absl/log:log", - "gtest", - ], - language = "C++", - uses_event_engine = False, - uses_polling = False, - deps = [ - "//src/core:metrics", - "//test/core/test_util:fake_stats_plugin", - "//test/core/test_util:grpc_test_util", - ], -) diff --git a/test/core/channel/server_call_tracer_factory_test.cc b/test/core/channel/server_call_tracer_factory_test.cc index 77862155b6c..fd4b2bac8d9 100644 --- a/test/core/channel/server_call_tracer_factory_test.cc +++ b/test/core/channel/server_call_tracer_factory_test.cc @@ -16,10 +16,10 @@ #include "gtest/gtest.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/resource_quota/arena.h" +#include "src/core/telemetry/call_tracer.h" namespace grpc_core { namespace { diff --git a/test/core/end2end/tests/http2_stats.cc b/test/core/end2end/tests/http2_stats.cc index a2931c98ea6..3cc2e830822 100644 --- a/test/core/end2end/tests/http2_stats.cc +++ b/test/core/end2end/tests/http2_stats.cc @@ -28,14 +28,11 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/channel_args.h" #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/channel/metrics.h" #include "src/core/lib/channel/promise_based_filter.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gprpp/notification.h" @@ -50,6 +47,9 @@ #include "src/core/lib/surface/channel_stack_type.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/metrics.h" +#include "src/core/telemetry/tcp_tracer.h" #include "test/core/end2end/end2end_tests.h" #include "test/core/test_util/fake_stats_plugin.h" diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index 1e39734d327..cd49842b8af 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -30,9 +30,9 @@ #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/gprpp/time.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "test/core/end2end/end2end_tests.h" using testing::HasSubstr; diff --git a/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc b/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc index bba8a824651..b1771665d97 100644 --- a/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc +++ b/test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.cc @@ -30,11 +30,11 @@ #include #include -#include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/event_engine/tcp_socket_utils.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/port.h" +#include "src/core/telemetry/stats.h" #include "src/core/util/useful.h" #include "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h" #include "test/core/test_util/port.h" diff --git a/test/core/gprpp/work_serializer_test.cc b/test/core/gprpp/work_serializer_test.cc index fc1c9ec7a1d..0d92acecba8 100644 --- a/test/core/gprpp/work_serializer_test.cc +++ b/test/core/gprpp/work_serializer_test.cc @@ -35,14 +35,14 @@ #include #include -#include "src/core/lib/debug/histogram_view.h" -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gprpp/notification.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/telemetry/histogram_view.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "test/core/event_engine/event_engine_test_utils.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/load_balancing/pick_first_test.cc b/test/core/load_balancing/pick_first_test.cc index 839afa62a3c..469af9c261e 100644 --- a/test/core/load_balancing/pick_first_test.cc +++ b/test/core/load_balancing/pick_first_test.cc @@ -37,7 +37,6 @@ #include #include -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/experiments/experiments.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/orphanable.h" @@ -48,6 +47,7 @@ #include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/telemetry/metrics.h" #include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/test_util/fake_stats_plugin.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/debug/BUILD b/test/core/telemetry/BUILD similarity index 56% rename from test/core/debug/BUILD rename to test/core/telemetry/BUILD index 7a123f32caa..ea9e61dd534 100644 --- a/test/core/debug/BUILD +++ b/test/core/telemetry/BUILD @@ -1,4 +1,4 @@ -# Copyright 2018 gRPC authors. +# Copyright 2016 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,10 +14,41 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package") -grpc_package(name = "test/core/debug") +grpc_package(name = "test/core/telemetry") licenses(["notice"]) +grpc_cc_test( + name = "call_tracer_test", + srcs = ["call_tracer_test.cc"], + external_deps = ["gtest"], + language = "C++", + uses_event_engine = False, + uses_polling = False, + deps = [ + "//:grpc", + "//test/core/test_util:fake_stats_plugin", + "//test/core/test_util:grpc_test_util", + ], +) + +grpc_cc_test( + name = "metrics_test", + srcs = ["metrics_test.cc"], + external_deps = [ + "absl/log:log", + "gtest", + ], + language = "C++", + uses_event_engine = False, + uses_polling = False, + deps = [ + "//src/core:metrics", + "//test/core/test_util:fake_stats_plugin", + "//test/core/test_util:grpc_test_util", + ], +) + grpc_cc_test( name = "stats_test", timeout = "long", diff --git a/test/core/channel/call_tracer_test.cc b/test/core/telemetry/call_tracer_test.cc similarity index 99% rename from test/core/channel/call_tracer_test.cc rename to test/core/telemetry/call_tracer_test.cc index e9058e509a5..3adfb0903d5 100644 --- a/test/core/channel/call_tracer_test.cc +++ b/test/core/telemetry/call_tracer_test.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/channel/call_tracer.h" +#include "src/core/telemetry/call_tracer.h" #include diff --git a/test/core/channel/metrics_test.cc b/test/core/telemetry/metrics_test.cc similarity index 99% rename from test/core/channel/metrics_test.cc rename to test/core/telemetry/metrics_test.cc index 3d57b32d2ab..51b98831018 100644 --- a/test/core/channel/metrics_test.cc +++ b/test/core/telemetry/metrics_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/core/lib/channel/metrics.h" +#include "src/core/telemetry/metrics.h" #include diff --git a/test/core/debug/stats_test.cc b/test/core/telemetry/stats_test.cc similarity index 97% rename from test/core/debug/stats_test.cc rename to test/core/telemetry/stats_test.cc index 14899457033..8f6a2f10960 100644 --- a/test/core/debug/stats_test.cc +++ b/test/core/telemetry/stats_test.cc @@ -16,7 +16,7 @@ // // -#include "src/core/lib/debug/stats.h" +#include "src/core/telemetry/stats.h" #include #include @@ -25,8 +25,8 @@ #include -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/telemetry/stats_data.h" #include "test/core/test_util/test_config.h" namespace grpc_core { diff --git a/test/core/test_util/fake_stats_plugin.h b/test/core/test_util/fake_stats_plugin.h index 655dfe0002c..5feeb79cb23 100644 --- a/test/core/test_util/fake_stats_plugin.h +++ b/test/core/test_util/fake_stats_plugin.h @@ -28,11 +28,11 @@ #include "absl/types/span.h" #include "gmock/gmock.h" -#include "src/core/lib/channel/call_tracer.h" -#include "src/core/lib/channel/metrics.h" #include "src/core/lib/channel/promise_based_filter.h" -#include "src/core/lib/channel/tcp_tracer.h" #include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/telemetry/call_tracer.h" +#include "src/core/telemetry/metrics.h" +#include "src/core/telemetry/tcp_tracer.h" namespace grpc_core { diff --git a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc index e8f37fc35e8..f2160f6c070 100644 --- a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc @@ -26,9 +26,9 @@ #include "src/core/client_channel/backup_poller.h" #include "src/core/lib/address_utils/sockaddr_utils.h" -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/config/config_vars.h" #include "src/core/lib/surface/call.h" +#include "src/core/telemetry/call_tracer.h" #include "src/proto/grpc/testing/xds/v3/orca_load_report.pb.h" #include "test/core/test_util/fake_stats_plugin.h" #include "test/core/test_util/scoped_env_var.h" diff --git a/test/cpp/ext/csm/metadata_exchange_test.cc b/test/cpp/ext/csm/metadata_exchange_test.cc index 3f5d8af74b7..f83577cc7d9 100644 --- a/test/cpp/ext/csm/metadata_exchange_test.cc +++ b/test/cpp/ext/csm/metadata_exchange_test.cc @@ -29,9 +29,9 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/env.h" +#include "src/core/telemetry/call_tracer.h" #include "src/core/util/tmpfile.h" #include "src/cpp/ext/csm/csm_observability.h" #include "src/cpp/ext/otel/otel_plugin.h" diff --git a/test/cpp/ext/otel/otel_plugin_test.cc b/test/cpp/ext/otel/otel_plugin_test.cc index 4cc39847910..a71dff599af 100644 --- a/test/cpp/ext/otel/otel_plugin_test.cc +++ b/test/cpp/ext/otel/otel_plugin_test.cc @@ -37,8 +37,8 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/config/core_configuration.h" +#include "src/core/telemetry/call_tracer.h" #include "test/core/test_util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" #include "test/cpp/ext/otel/otel_test_library.h" diff --git a/test/cpp/ext/otel/otel_test_library.cc b/test/cpp/ext/otel/otel_test_library.cc index 38bac047055..40153f13dda 100644 --- a/test/cpp/ext/otel/otel_test_library.cc +++ b/test/cpp/ext/otel/otel_test_library.cc @@ -30,10 +30,10 @@ #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/channel/promise_based_filter.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/notification.h" +#include "src/core/telemetry/call_tracer.h" #include "test/core/test_util/fake_stats_plugin.h" #include "test/core/test_util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" diff --git a/test/cpp/ext/otel/otel_test_library.h b/test/cpp/ext/otel/otel_test_library.h index bd33c30a586..f8573ccaa90 100644 --- a/test/cpp/ext/otel/otel_test_library.h +++ b/test/cpp/ext/otel/otel_test_library.h @@ -33,8 +33,8 @@ #include #include -#include "src/core/lib/channel/call_tracer.h" #include "src/core/lib/config/core_configuration.h" +#include "src/core/telemetry/call_tracer.h" #include "src/cpp/ext/otel/otel_plugin.h" #include "test/core/test_util/test_config.h" #include "test/cpp/end2end/test_service_impl.h" diff --git a/test/cpp/microbenchmarks/helpers.h b/test/cpp/microbenchmarks/helpers.h index 11b7b9b642a..34105a98d63 100644 --- a/test/cpp/microbenchmarks/helpers.h +++ b/test/cpp/microbenchmarks/helpers.h @@ -27,8 +27,8 @@ #include #include -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" class LibraryInitializer { public: diff --git a/test/cpp/naming/cancel_ares_query_test.cc b/test/cpp/naming/cancel_ares_query_test.cc index 29b5a19d65c..03d787d0b69 100644 --- a/test/cpp/naming/cancel_ares_query_test.cc +++ b/test/cpp/naming/cancel_ares_query_test.cc @@ -38,8 +38,6 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/config_vars.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/event_engine/ares_resolver.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/experiments/experiments.h" @@ -53,6 +51,8 @@ #include "src/core/resolver/dns/c_ares/grpc_ares_wrapper.h" #include "src/core/resolver/resolver.h" #include "src/core/resolver/resolver_registry.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/core/util/string.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/test_util/cmdline.h" diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index 5811cbaee85..189d972fc2e 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -34,7 +34,6 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/debug/stats.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/event_engine/tcp_socket_utils.h" @@ -45,6 +44,7 @@ #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel_create.h" #include "src/core/server/server.h" +#include "src/core/telemetry/stats.h" #include "src/cpp/client/create_channel_internal.h" #include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h" diff --git a/test/cpp/qps/scenario_runner.cc b/test/cpp/qps/scenario_runner.cc index da08af6b619..7ca32f983ca 100644 --- a/test/cpp/qps/scenario_runner.cc +++ b/test/cpp/qps/scenario_runner.cc @@ -15,9 +15,9 @@ #include "absl/flags/flag.h" #include "absl/log/log.h" -#include "src/core/lib/debug/stats.h" -#include "src/core/lib/debug/stats_data.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/telemetry/stats.h" +#include "src/core/telemetry/stats_data.h" #include "src/proto/grpc/testing/control.pb.h" #include "test/core/test_util/test_config.h" #include "test/core/test_util/tls_utils.h" diff --git a/tools/codegen/core/gen_stats_data.py b/tools/codegen/core/gen_stats_data.py index de41f434a19..b7e66f00107 100755 --- a/tools/codegen/core/gen_stats_data.py +++ b/tools/codegen/core/gen_stats_data.py @@ -24,7 +24,7 @@ import sys import yaml -with open("src/core/lib/debug/stats_data.yaml") as f: +with open("src/core/telemetry/stats_data.yaml") as f: attrs = yaml.safe_load(f.read()) REQUIRED_FIELDS = ["name", "doc"] @@ -259,7 +259,7 @@ def snake_to_pascal(name): return "".join([x.capitalize() for x in name.split("_")]) -with open("src/core/lib/debug/stats_data.h", "w") as H: +with open("src/core/telemetry/stats_data.h", "w") as H: # copy-paste copyright notice from this file with open(sys.argv[0]) as my_source: copyright = [] @@ -280,14 +280,14 @@ with open("src/core/lib/debug/stats_data.h", "w") as H: [H], ["Automatically generated by tools/codegen/core/gen_stats_data.py"] ) - print("#ifndef GRPC_SRC_CORE_LIB_DEBUG_STATS_DATA_H", file=H) - print("#define GRPC_SRC_CORE_LIB_DEBUG_STATS_DATA_H", file=H) + print("#ifndef GRPC_SRC_CORE_TELEMETRY_STATS_DATA_H", file=H) + print("#define GRPC_SRC_CORE_TELEMETRY_STATS_DATA_H", file=H) print(file=H) print("#include ", file=H) print("#include ", file=H) print("#include ", file=H) print("#include ", file=H) - print('#include "src/core/lib/debug/histogram_view.h"', file=H) + print('#include "src/core/telemetry/histogram_view.h"', file=H) print('#include "absl/strings/string_view.h"', file=H) print('#include "src/core/lib/gprpp/per_cpu.h"', file=H) print(file=H) @@ -441,9 +441,9 @@ with open("src/core/lib/debug/stats_data.h", "w") as H: print("}", file=H) print(file=H) - print("#endif // GRPC_SRC_CORE_LIB_DEBUG_STATS_DATA_H", file=H) + print("#endif // GRPC_SRC_CORE_TELEMETRY_STATS_DATA_H", file=H) -with open("src/core/lib/debug/stats_data.cc", "w") as C: +with open("src/core/telemetry/stats_data.cc", "w") as C: # copy-paste copyright notice from this file with open(sys.argv[0]) as my_source: copyright = [] @@ -466,7 +466,7 @@ with open("src/core/lib/debug/stats_data.cc", "w") as C: print("#include ", file=C) print(file=C) - print('#include "src/core/lib/debug/stats_data.h"', file=C) + print('#include "src/core/telemetry/stats_data.h"', file=C) print("#include ", file=C) print(file=C) diff --git a/tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh b/tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh index 81c90600422..6ceda3a0216 100755 --- a/tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_tidy/clang_tidy_all_the_things.sh @@ -23,7 +23,7 @@ cd ${CLANG_TIDY_ROOT} # run clang tidy for all source files cat compile_commands.json | jq -r '.[].file' \ | grep -E "(^include/|^src/core/|^src/cpp/|^test/core/|^test/cpp/)" \ - | grep -v -E "src/core/lib/debug/stats_data" \ + | grep -v -E "src/core/telemetry/stats_data" \ | grep -v -E "/upb-gen/|/upbdefs-gen/" \ | sort \ | xargs tools/distrib/run_clang_tidy.py "$@" diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 3f4a53208c2..180bf607854 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -2097,8 +2097,6 @@ src/core/lib/backoff/backoff.h \ src/core/lib/backoff/random_early_detection.cc \ src/core/lib/backoff/random_early_detection.h \ src/core/lib/channel/call_finalization.h \ -src/core/lib/channel/call_tracer.cc \ -src/core/lib/channel/call_tracer.h \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_args.h \ src/core/lib/channel/channel_args_preconditioning.cc \ @@ -2115,13 +2113,10 @@ src/core/lib/channel/channel_stack_trace.h \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ -src/core/lib/channel/metrics.cc \ -src/core/lib/channel/metrics.h \ src/core/lib/channel/promise_based_filter.cc \ src/core/lib/channel/promise_based_filter.h \ src/core/lib/channel/status_util.cc \ src/core/lib/channel/status_util.h \ -src/core/lib/channel/tcp_tracer.h \ src/core/lib/compression/compression.cc \ src/core/lib/compression/compression_internal.cc \ src/core/lib/compression/compression_internal.h \ @@ -2136,12 +2131,6 @@ src/core/lib/config/load_config.cc \ src/core/lib/config/load_config.h \ src/core/lib/debug/event_log.cc \ src/core/lib/debug/event_log.h \ -src/core/lib/debug/histogram_view.cc \ -src/core/lib/debug/histogram_view.h \ -src/core/lib/debug/stats.cc \ -src/core/lib/debug/stats.h \ -src/core/lib/debug/stats_data.cc \ -src/core/lib/debug/stats_data.h \ src/core/lib/debug/trace.cc \ src/core/lib/debug/trace.h \ src/core/lib/event_engine/ares_resolver.cc \ @@ -2867,6 +2856,17 @@ src/core/service_config/service_config_impl.cc \ src/core/service_config/service_config_impl.h \ src/core/service_config/service_config_parser.cc \ src/core/service_config/service_config_parser.h \ +src/core/telemetry/call_tracer.cc \ +src/core/telemetry/call_tracer.h \ +src/core/telemetry/histogram_view.cc \ +src/core/telemetry/histogram_view.h \ +src/core/telemetry/metrics.cc \ +src/core/telemetry/metrics.h \ +src/core/telemetry/stats.cc \ +src/core/telemetry/stats.h \ +src/core/telemetry/stats_data.cc \ +src/core/telemetry/stats_data.h \ +src/core/telemetry/tcp_tracer.h \ src/core/tsi/alts/crypt/aes_gcm.cc \ src/core/tsi/alts/crypt/gsec.cc \ src/core/tsi/alts/crypt/gsec.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 72b1676eeaf..74d2f0c7e17 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1869,8 +1869,6 @@ src/core/lib/backoff/random_early_detection.cc \ src/core/lib/backoff/random_early_detection.h \ src/core/lib/channel/README.md \ src/core/lib/channel/call_finalization.h \ -src/core/lib/channel/call_tracer.cc \ -src/core/lib/channel/call_tracer.h \ src/core/lib/channel/channel_args.cc \ src/core/lib/channel/channel_args.h \ src/core/lib/channel/channel_args_preconditioning.cc \ @@ -1887,13 +1885,10 @@ src/core/lib/channel/channel_stack_trace.h \ src/core/lib/channel/connected_channel.cc \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ -src/core/lib/channel/metrics.cc \ -src/core/lib/channel/metrics.h \ src/core/lib/channel/promise_based_filter.cc \ src/core/lib/channel/promise_based_filter.h \ src/core/lib/channel/status_util.cc \ src/core/lib/channel/status_util.h \ -src/core/lib/channel/tcp_tracer.h \ src/core/lib/compression/compression.cc \ src/core/lib/compression/compression_internal.cc \ src/core/lib/compression/compression_internal.h \ @@ -1908,12 +1903,6 @@ src/core/lib/config/load_config.cc \ src/core/lib/config/load_config.h \ src/core/lib/debug/event_log.cc \ src/core/lib/debug/event_log.h \ -src/core/lib/debug/histogram_view.cc \ -src/core/lib/debug/histogram_view.h \ -src/core/lib/debug/stats.cc \ -src/core/lib/debug/stats.h \ -src/core/lib/debug/stats_data.cc \ -src/core/lib/debug/stats_data.h \ src/core/lib/debug/trace.cc \ src/core/lib/debug/trace.h \ src/core/lib/event_engine/ares_resolver.cc \ @@ -2647,6 +2636,17 @@ src/core/service_config/service_config_impl.cc \ src/core/service_config/service_config_impl.h \ src/core/service_config/service_config_parser.cc \ src/core/service_config/service_config_parser.h \ +src/core/telemetry/call_tracer.cc \ +src/core/telemetry/call_tracer.h \ +src/core/telemetry/histogram_view.cc \ +src/core/telemetry/histogram_view.h \ +src/core/telemetry/metrics.cc \ +src/core/telemetry/metrics.h \ +src/core/telemetry/stats.cc \ +src/core/telemetry/stats.h \ +src/core/telemetry/stats_data.cc \ +src/core/telemetry/stats_data.h \ +src/core/telemetry/tcp_tracer.h \ src/core/tsi/README.md \ src/core/tsi/alts/crypt/aes_gcm.cc \ src/core/tsi/alts/crypt/gsec.cc \ From 182f6885d3d3d81e658cc314cc856ff5487ed136 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 23 May 2024 16:33:43 -0700 Subject: [PATCH 15/20] [transport] remove GetEndpoint() method (#36597) Closes #36597 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36597 from markdroth:transport_endpoint_cleanup 6bd73e402eab2cb4e5885e67f4e25fb48920b948 PiperOrigin-RevId: 636714985 --- src/core/ext/transport/binder/transport/binder_transport.cc | 5 ----- src/core/ext/transport/binder/transport/binder_transport.h | 1 - src/core/ext/transport/chaotic_good/client_transport.h | 1 - src/core/ext/transport/chaotic_good/server_transport.h | 3 +-- src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 2 -- src/core/ext/transport/chttp2/transport/internal.h | 1 - src/core/ext/transport/cronet/transport/cronet_transport.cc | 1 - src/core/ext/transport/inproc/inproc_transport.cc | 2 -- src/core/ext/transport/inproc/legacy_inproc_transport.cc | 3 --- src/core/lib/transport/transport.h | 3 --- test/core/channel/minimal_stack_is_minimal_test.cc | 1 - test/core/server/xds_channel_stack_modifier_test.cc | 1 - 12 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/core/ext/transport/binder/transport/binder_transport.cc b/src/core/ext/transport/binder/transport/binder_transport.cc index 7c832505d9d..691ac50d6e4 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.cc +++ b/src/core/ext/transport/binder/transport/binder_transport.cc @@ -693,11 +693,6 @@ void grpc_binder_transport::Orphan() { absl::OkStatus()); } -grpc_endpoint* grpc_binder_transport::GetEndpoint() { - gpr_log(GPR_INFO, __func__); - return nullptr; -} - size_t grpc_binder_transport::SizeOfStream() const { return sizeof(grpc_binder_stream); } diff --git a/src/core/ext/transport/binder/transport/binder_transport.h b/src/core/ext/transport/binder/transport/binder_transport.h index d800bcee676..20399818762 100644 --- a/src/core/ext/transport/binder/transport/binder_transport.h +++ b/src/core/ext/transport/binder/transport/binder_transport.h @@ -60,7 +60,6 @@ struct grpc_binder_transport final : public grpc_core::FilterStackTransport { void SetPollset(grpc_stream*, grpc_pollset*) override {} void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {} void PerformOp(grpc_transport_op* op) override; - grpc_endpoint* GetEndpoint() override; size_t SizeOfStream() const override; bool HackyDisableStreamOpBatchCoalescingInConnectedChannel() const override { return false; diff --git a/src/core/ext/transport/chaotic_good/client_transport.h b/src/core/ext/transport/chaotic_good/client_transport.h index f07099e296f..12a96403d9a 100644 --- a/src/core/ext/transport/chaotic_good/client_transport.h +++ b/src/core/ext/transport/chaotic_good/client_transport.h @@ -82,7 +82,6 @@ class ChaoticGoodClientTransport final : public ClientTransport { void SetPollset(grpc_stream*, grpc_pollset*) override {} void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {} void PerformOp(grpc_transport_op*) override; - grpc_endpoint* GetEndpoint() override { return nullptr; } void Orphan() override { AbortWithError(); Unref(); diff --git a/src/core/ext/transport/chaotic_good/server_transport.h b/src/core/ext/transport/chaotic_good/server_transport.h index 140641abcf6..2cd1fb5974c 100644 --- a/src/core/ext/transport/chaotic_good/server_transport.h +++ b/src/core/ext/transport/chaotic_good/server_transport.h @@ -94,7 +94,6 @@ class ChaoticGoodServerTransport final : public ServerTransport { void SetPollset(grpc_stream*, grpc_pollset*) override {} void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {} void PerformOp(grpc_transport_op*) override; - grpc_endpoint* GetEndpoint() override { return nullptr; } void Orphan() override; void SetCallDestination( @@ -158,4 +157,4 @@ class ChaoticGoodServerTransport final : public ServerTransport { } // namespace chaotic_good } // namespace grpc_core -#endif // GRPC_SRC_CORE_EXT_TRANSPORT_CHAOTIC_GOOD_SERVER_TRANSPORT_H \ No newline at end of file +#endif // GRPC_SRC_CORE_EXT_TRANSPORT_CHAOTIC_GOOD_SERVER_TRANSPORT_H diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 2b85004c1a6..118b1f99488 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -3168,8 +3168,6 @@ const char* grpc_chttp2_initiate_write_reason_string( GPR_UNREACHABLE_CODE(return "unknown"); } -grpc_endpoint* grpc_chttp2_transport::GetEndpoint() { return ep; } - size_t grpc_chttp2_transport::SizeOfStream() const { return sizeof(grpc_chttp2_stream); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index aa04864ec00..ed596278686 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -256,7 +256,6 @@ struct grpc_chttp2_transport final : public grpc_core::FilterStackTransport, void SetPollsetSet(grpc_stream* stream, grpc_pollset_set* pollset_set) override; void PerformOp(grpc_transport_op* op) override; - grpc_endpoint* GetEndpoint() override; grpc_endpoint* ep; grpc_core::Slice peer_string; diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index bd6c4b411dc..8e1242a3f4b 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -131,7 +131,6 @@ struct grpc_cronet_transport final : public grpc_core::FilterStackTransport { void SetPollsetSet(grpc_stream* /*stream*/, grpc_pollset_set* /*pollset_set*/) override {} void PerformOp(grpc_transport_op* op) override; - grpc_endpoint* GetEndpoint() override { return nullptr; } size_t SizeOfStream() const override; void InitStream(grpc_stream* gs, grpc_stream_refcount* refcount, const void* server_data, grpc_core::Arena* arena) override; diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index dbbd3e63123..7913e631fe8 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -85,7 +85,6 @@ class InprocServerTransport final : public ServerTransport { Crash("set_accept_stream not supported on inproc transport"); } } - grpc_endpoint* GetEndpoint() override { return nullptr; } void Disconnect(absl::Status error) { if (disconnecting_.exchange(true, std::memory_order_relaxed)) return; @@ -162,7 +161,6 @@ class InprocClientTransport final : public ClientTransport { void SetPollset(grpc_stream*, grpc_pollset*) override {} void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {} void PerformOp(grpc_transport_op*) override { Crash("unimplemented"); } - grpc_endpoint* GetEndpoint() override { return nullptr; } private: ~InprocClientTransport() override { diff --git a/src/core/ext/transport/inproc/legacy_inproc_transport.cc b/src/core/ext/transport/inproc/legacy_inproc_transport.cc index 9412fe41e4e..bf63cc2e3a7 100644 --- a/src/core/ext/transport/inproc/legacy_inproc_transport.cc +++ b/src/core/ext/transport/inproc/legacy_inproc_transport.cc @@ -135,7 +135,6 @@ struct inproc_transport final : public grpc_core::FilterStackTransport { void SetPollsetSet(grpc_stream* stream, grpc_pollset_set* pollset_set) override; void PerformOp(grpc_transport_op* op) override; - grpc_endpoint* GetEndpoint() override; size_t SizeOfStream() const override; bool HackyDisableStreamOpBatchCoalescingInConnectedChannel() const override { @@ -1214,8 +1213,6 @@ void inproc_transport::SetPollsetSet(grpc_stream* /*gs*/, // Nothing to do here } -grpc_endpoint* inproc_transport::GetEndpoint() { return nullptr; } - //****************************************************************************** // Main inproc transport functions // diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 5dbe2c6695f..7d879a91de5 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -565,9 +565,6 @@ class Transport : public InternallyRefCounted { op->disconnect_with_error = error; PerformOp(op); } - - // implementation of grpc_transport_get_endpoint - virtual grpc_endpoint* GetEndpoint() = 0; }; class FilterStackTransport : public Transport { diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index 44193d7f1ca..ebf0f66c82c 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -74,7 +74,6 @@ class FakeTransport final : public grpc_core::Transport { void SetPollset(grpc_stream*, grpc_pollset*) override {} void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {} void PerformOp(grpc_transport_op*) override {} - grpc_endpoint* GetEndpoint() override { return nullptr; } void Orphan() override {} private: diff --git a/test/core/server/xds_channel_stack_modifier_test.cc b/test/core/server/xds_channel_stack_modifier_test.cc index f01860e4adb..e7cae694aec 100644 --- a/test/core/server/xds_channel_stack_modifier_test.cc +++ b/test/core/server/xds_channel_stack_modifier_test.cc @@ -84,7 +84,6 @@ class FakeTransport final : public Transport { void SetPollset(grpc_stream*, grpc_pollset*) override {} void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {} void PerformOp(grpc_transport_op*) override {} - grpc_endpoint* GetEndpoint() override { return nullptr; } void Orphan() override {} }; } // namespace From fe817c8ab18448e8a277610186b09aa531c6f28f Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 23 May 2024 19:48:59 -0700 Subject: [PATCH 16/20] [reorg] move lib/json -> util/json (#36645) Closes #36645 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36645 from markdroth:reorg_json 5b6434dd44a0d147731db08b7c2154f61d3b0ef9 PiperOrigin-RevId: 636757495 --- CMakeLists.txt | 20 +++---- Makefile | 8 +-- Package.swift | 22 +++---- build_autogenerated.yaml | 60 +++++++++---------- config.m4 | 10 ++-- config.w32 | 10 ++-- gRPC-C++.podspec | 28 ++++----- gRPC-Core.podspec | 36 +++++------ grpc.gemspec | 22 +++---- package.xml | 22 +++---- src/core/BUILD | 22 +++---- src/core/channelz/channel_trace.h | 2 +- src/core/channelz/channelz.cc | 2 +- src/core/channelz/channelz.h | 2 +- src/core/channelz/channelz_registry.cc | 4 +- .../client_channel/client_channel_filter.cc | 2 +- .../client_channel_service_config.h | 6 +- .../client_channel/retry_service_config.cc | 2 +- .../client_channel/retry_service_config.h | 6 +- .../fault_injection_service_config_parser.h | 6 +- .../message_size/message_size_filter.h | 6 +- .../rbac/rbac_service_config_parser.cc | 4 +- .../filters/rbac/rbac_service_config_parser.h | 2 +- .../stateful_session_service_config_parser.h | 6 +- .../security/authorization/rbac_translator.cc | 4 +- .../certificate_provider_factory.h | 4 +- .../credentials/channel_creds_registry.h | 4 +- .../channel_creds_registry_init.cc | 6 +- .../aws_external_account_credentials.cc | 6 +- .../external/external_account_credentials.cc | 4 +- .../external/external_account_credentials.h | 2 +- .../file_external_account_credentials.cc | 4 +- .../url_external_account_credentials.cc | 4 +- .../google_default_credentials.cc | 4 +- .../security/credentials/jwt/json_token.cc | 4 +- .../lib/security/credentials/jwt/json_token.h | 2 +- .../credentials/jwt/jwt_credentials.cc | 6 +- .../security/credentials/jwt/jwt_verifier.cc | 2 +- .../security/credentials/jwt/jwt_verifier.h | 2 +- .../credentials/oauth2/oauth2_credentials.cc | 4 +- .../credentials/oauth2/oauth2_credentials.h | 2 +- src/core/lib/security/util/json_util.h | 2 +- src/core/load_balancing/endpoint_list.cc | 2 +- src/core/load_balancing/grpclb/grpclb.cc | 6 +- src/core/load_balancing/lb_policy_factory.h | 2 +- src/core/load_balancing/lb_policy_registry.h | 2 +- .../outlier_detection/outlier_detection.cc | 2 +- .../outlier_detection/outlier_detection.h | 6 +- .../load_balancing/pick_first/pick_first.cc | 6 +- src/core/load_balancing/priority/priority.cc | 6 +- .../load_balancing/ring_hash/ring_hash.cc | 2 +- src/core/load_balancing/ring_hash/ring_hash.h | 6 +- src/core/load_balancing/rls/rls.cc | 8 +-- .../load_balancing/round_robin/round_robin.cc | 2 +- .../weighted_round_robin.cc | 6 +- .../weighted_target/weighted_target.cc | 6 +- src/core/load_balancing/xds/cds.cc | 8 +-- .../load_balancing/xds/xds_cluster_impl.cc | 6 +- .../load_balancing/xds/xds_cluster_manager.cc | 6 +- .../load_balancing/xds/xds_override_host.cc | 6 +- .../load_balancing/xds/xds_override_host.h | 6 +- .../load_balancing/xds/xds_wrr_locality.cc | 8 +-- .../dns/event_engine/service_config_helper.cc | 10 ++-- .../google_c2p/google_c2p_resolver.cc | 4 +- .../service_config/service_config_impl.cc | 10 ++-- src/core/service_config/service_config_impl.h | 2 +- .../service_config/service_config_parser.h | 2 +- src/core/{lib => util}/json/json.h | 9 +-- src/core/{lib => util}/json/json_args.h | 10 ++-- .../{lib => util}/json/json_channel_args.h | 12 ++-- .../{lib => util}/json/json_object_loader.cc | 5 +- .../{lib => util}/json/json_object_loader.h | 14 ++--- src/core/{lib => util}/json/json_reader.cc | 5 +- src/core/{lib => util}/json/json_reader.h | 12 ++-- src/core/{lib => util}/json/json_util.cc | 8 +-- src/core/{lib => util}/json/json_util.h | 12 ++-- src/core/{lib => util}/json/json_writer.cc | 6 +- src/core/{lib => util}/json/json_writer.h | 12 ++-- .../xds/grpc/certificate_provider_store.h | 6 +- ...ile_watcher_certificate_provider_factory.h | 6 +- src/core/xds/grpc/xds_audit_logger_registry.h | 2 +- src/core/xds/grpc/xds_bootstrap_grpc.cc | 8 +-- src/core/xds/grpc/xds_bootstrap_grpc.h | 6 +- src/core/xds/grpc/xds_cluster.cc | 2 +- src/core/xds/grpc/xds_cluster.h | 2 +- .../xds/grpc/xds_cluster_specifier_plugin.cc | 4 +- .../xds/grpc/xds_cluster_specifier_plugin.h | 2 +- src/core/xds/grpc/xds_common_types.cc | 2 +- src/core/xds/grpc/xds_common_types.h | 2 +- src/core/xds/grpc/xds_http_fault_filter.cc | 4 +- src/core/xds/grpc/xds_http_filters.h | 4 +- src/core/xds/grpc/xds_http_rbac_filter.cc | 4 +- .../grpc/xds_http_stateful_session_filter.cc | 4 +- src/core/xds/grpc/xds_lb_policy_registry.h | 2 +- src/core/xds/grpc/xds_route_config.cc | 4 +- src/core/xds/xds_client/xds_api.cc | 2 +- src/core/xds/xds_client/xds_bootstrap.h | 2 +- src/cpp/client/secure_credentials.cc | 4 +- src/cpp/ext/csm/metadata_exchange.cc | 6 +- src/cpp/ext/gcp/observability_config.cc | 4 +- src/cpp/ext/gcp/observability_config.h | 6 +- src/cpp/ext/gcp/observability_logging_sink.cc | 2 +- src/python/grpcio/grpc_core_dependencies.py | 8 +-- test/core/channelz/channel_trace_test.cc | 4 +- test/core/channelz/channelz_test.cc | 4 +- test/core/end2end/tests/retry_lb_drop.cc | 2 +- .../rbac/rbac_service_config_parser_test.cc | 2 +- test/core/json/fuzzer.cc | 4 +- test/core/json/json_object_loader_test.cc | 6 +- test/core/json/json_test.cc | 6 +- test/core/load_balancing/lb_policy_test_lib.h | 2 +- .../load_balancing/outlier_detection_test.cc | 2 +- test/core/load_balancing/pick_first_test.cc | 2 +- test/core/load_balancing/ring_hash_test.cc | 2 +- .../weighted_round_robin_test.cc | 4 +- .../load_balancing/xds_override_host_test.cc | 2 +- test/core/security/credentials_test.cc | 2 +- test/core/security/grpc_audit_logging_test.cc | 6 +- .../grpc_authorization_engine_test.cc | 2 +- test/core/security/json_token_test.cc | 4 +- test/core/security/jwt_verifier_test.cc | 2 +- test/core/security/rbac_translator_test.cc | 4 +- test/core/security/verify_jwt.cc | 2 +- .../service_config/service_config_test.cc | 6 +- test/core/test_util/audit_logging_utils.cc | 2 +- test/core/test_util/test_lb_policies.cc | 4 +- ...tcher_certificate_provider_factory_test.cc | 2 +- .../xds/xds_audit_logger_registry_test.cc | 4 +- test/core/xds/xds_bootstrap_test.cc | 8 +-- test/core/xds/xds_client_test.cc | 10 ++-- .../xds/xds_cluster_resource_type_test.cc | 4 +- test/core/xds/xds_common_types_test.cc | 2 +- test/core/xds/xds_http_filters_test.cc | 2 +- test/core/xds/xds_lb_policy_registry_test.cc | 2 +- .../xds/xds_listener_resource_type_test.cc | 4 +- .../xds_route_config_resource_type_test.cc | 2 +- test/cpp/ext/gcp/observability_config_test.cc | 2 +- .../gcp/observability_logging_sink_test.cc | 2 +- test/cpp/interop/rpc_behavior_lb_policy.cc | 4 +- test/cpp/util/channel_trace_proto_helper.cc | 6 +- test/cpp/util/channelz_sampler.cc | 4 +- tools/doxygen/Doxyfile.c++.internal | 22 +++---- tools/doxygen/Doxyfile.core.internal | 22 +++---- 143 files changed, 445 insertions(+), 442 deletions(-) rename src/core/{lib => util}/json/json.h (86%) rename src/core/{lib => util}/json/json_args.h (86%) rename src/core/{lib => util}/json/json_channel_args.h (84%) rename src/core/{lib => util}/json/json_object_loader.cc (99%) rename src/core/{lib => util}/json/json_object_loader.h (98%) rename src/core/{lib => util}/json/json_reader.cc (99%) rename src/core/{lib => util}/json/json_reader.h (82%) rename src/core/{lib => util}/json/json_util.cc (96%) rename src/core/{lib => util}/json/json_util.h (97%) rename src/core/{lib => util}/json/json_writer.cc (99%) rename src/core/{lib => util}/json/json_writer.h (81%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f4090e8b821..32839763f43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2384,10 +2384,6 @@ add_library(grpc src/core/lib/iomgr/wakeup_fd_nospecial.cc src/core/lib/iomgr/wakeup_fd_pipe.cc src/core/lib/iomgr/wakeup_fd_posix.cc - src/core/lib/json/json_object_loader.cc - src/core/lib/json/json_reader.cc - src/core/lib/json/json_util.cc - src/core/lib/json/json_writer.cc src/core/lib/matchers/matchers.cc src/core/lib/promise/activity.cc src/core/lib/promise/party.cc @@ -2600,6 +2596,10 @@ add_library(grpc src/core/tsi/ssl_transport_security_utils.cc src/core/tsi/transport_security.cc src/core/tsi/transport_security_grpc.cc + src/core/util/json/json_object_loader.cc + src/core/util/json/json_reader.cc + src/core/util/json/json_util.cc + src/core/util/json/json_writer.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 @@ -3174,9 +3174,6 @@ add_library(grpc_unsecure src/core/lib/iomgr/wakeup_fd_nospecial.cc src/core/lib/iomgr/wakeup_fd_pipe.cc src/core/lib/iomgr/wakeup_fd_posix.cc - src/core/lib/json/json_object_loader.cc - src/core/lib/json/json_reader.cc - src/core/lib/json/json_writer.cc src/core/lib/promise/activity.cc src/core/lib/promise/party.cc src/core/lib/promise/sleep.cc @@ -3317,6 +3314,9 @@ add_library(grpc_unsecure src/core/tsi/local_transport_security.cc src/core/tsi/transport_security.cc src/core/tsi/transport_security_grpc.cc + src/core/util/json/json_object_loader.cc + src/core/util/json/json_reader.cc + src/core/util/json/json_writer.cc third_party/upb/upb/mini_descriptor/build_enum.c third_party/upb/upb/mini_descriptor/decode.c third_party/upb/upb/mini_descriptor/internal/base92.c @@ -5288,8 +5288,6 @@ add_library(grpc_authorization_provider src/core/lib/iomgr/wakeup_fd_nospecial.cc src/core/lib/iomgr/wakeup_fd_pipe.cc src/core/lib/iomgr/wakeup_fd_posix.cc - src/core/lib/json/json_reader.cc - src/core/lib/json/json_writer.cc src/core/lib/matchers/matchers.cc src/core/lib/promise/activity.cc src/core/lib/promise/party.cc @@ -5387,6 +5385,8 @@ add_library(grpc_authorization_provider src/core/tsi/alts/handshaker/transport_security_common_api.cc src/core/tsi/transport_security.cc src/core/tsi/transport_security_grpc.cc + src/core/util/json/json_reader.cc + src/core/util/json/json_writer.cc third_party/upb/upb/mini_descriptor/build_enum.c third_party/upb/upb/mini_descriptor/decode.c third_party/upb/upb/mini_descriptor/internal/base92.c @@ -17917,7 +17917,6 @@ add_executable(interception_chain_test src/core/lib/iomgr/wakeup_fd_nospecial.cc src/core/lib/iomgr/wakeup_fd_pipe.cc src/core/lib/iomgr/wakeup_fd_posix.cc - src/core/lib/json/json_writer.cc src/core/lib/promise/activity.cc src/core/lib/promise/party.cc src/core/lib/promise/trace.cc @@ -17989,6 +17988,7 @@ add_executable(interception_chain_test src/core/telemetry/stats.cc src/core/telemetry/stats_data.cc src/core/tsi/alts/handshaker/transport_security_common_api.cc + src/core/util/json/json_writer.cc test/core/transport/interception_chain_test.cc third_party/upb/upb/mini_descriptor/build_enum.c third_party/upb/upb/mini_descriptor/decode.c diff --git a/Makefile b/Makefile index 3de6515f8a0..0cc5cc6a80b 100644 --- a/Makefile +++ b/Makefile @@ -1243,10 +1243,6 @@ LIBGRPC_SRC = \ src/core/lib/iomgr/wakeup_fd_nospecial.cc \ src/core/lib/iomgr/wakeup_fd_pipe.cc \ src/core/lib/iomgr/wakeup_fd_posix.cc \ - src/core/lib/json/json_object_loader.cc \ - src/core/lib/json/json_reader.cc \ - src/core/lib/json/json_util.cc \ - src/core/lib/json/json_writer.cc \ src/core/lib/matchers/matchers.cc \ src/core/lib/promise/activity.cc \ src/core/lib/promise/party.cc \ @@ -1463,6 +1459,10 @@ LIBGRPC_SRC = \ src/core/util/android/log.cc \ src/core/util/atm.cc \ src/core/util/iphone/cpu.cc \ + src/core/util/json/json_object_loader.cc \ + src/core/util/json/json_reader.cc \ + src/core/util/json/json_util.cc \ + src/core/util/json/json_writer.cc \ src/core/util/linux/cpu.cc \ src/core/util/linux/log.cc \ src/core/util/log.cc \ diff --git a/Package.swift b/Package.swift index cd30f90e602..75efbc101c2 100644 --- a/Package.swift +++ b/Package.swift @@ -1467,17 +1467,6 @@ let package = Package( "src/core/lib/iomgr/wakeup_fd_pipe.h", "src/core/lib/iomgr/wakeup_fd_posix.cc", "src/core/lib/iomgr/wakeup_fd_posix.h", - "src/core/lib/json/json.h", - "src/core/lib/json/json_args.h", - "src/core/lib/json/json_channel_args.h", - "src/core/lib/json/json_object_loader.cc", - "src/core/lib/json/json_object_loader.h", - "src/core/lib/json/json_reader.cc", - "src/core/lib/json/json_reader.h", - "src/core/lib/json/json_util.cc", - "src/core/lib/json/json_util.h", - "src/core/lib/json/json_writer.cc", - "src/core/lib/json/json_writer.h", "src/core/lib/matchers/matchers.cc", "src/core/lib/matchers/matchers.h", "src/core/lib/promise/activity.cc", @@ -1929,6 +1918,17 @@ let package = Package( "src/core/util/android/log.cc", "src/core/util/atm.cc", "src/core/util/iphone/cpu.cc", + "src/core/util/json/json.h", + "src/core/util/json/json_args.h", + "src/core/util/json/json_channel_args.h", + "src/core/util/json/json_object_loader.cc", + "src/core/util/json/json_object_loader.h", + "src/core/util/json/json_reader.cc", + "src/core/util/json/json_reader.h", + "src/core/util/json/json_util.cc", + "src/core/util/json/json_util.h", + "src/core/util/json/json_writer.cc", + "src/core/util/json/json_writer.h", "src/core/util/linux/cpu.cc", "src/core/util/linux/log.cc", "src/core/util/log.cc", diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index aaa5f04cc81..b505f641e0f 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -976,13 +976,6 @@ libs: - src/core/lib/iomgr/vsock.h - src/core/lib/iomgr/wakeup_fd_pipe.h - src/core/lib/iomgr/wakeup_fd_posix.h - - src/core/lib/json/json.h - - src/core/lib/json/json_args.h - - src/core/lib/json/json_channel_args.h - - src/core/lib/json/json_object_loader.h - - src/core/lib/json/json_reader.h - - src/core/lib/json/json_util.h - - src/core/lib/json/json_writer.h - src/core/lib/matchers/matchers.h - src/core/lib/promise/activity.h - src/core/lib/promise/all_ok.h @@ -1213,6 +1206,13 @@ libs: - src/core/tsi/transport_security.h - src/core/tsi/transport_security_grpc.h - src/core/tsi/transport_security_interface.h + - src/core/util/json/json.h + - src/core/util/json/json_args.h + - src/core/util/json/json_channel_args.h + - src/core/util/json/json_object_loader.h + - src/core/util/json/json_reader.h + - src/core/util/json/json_util.h + - src/core/util/json/json_writer.h - src/core/util/spinlock.h - src/core/xds/grpc/certificate_provider_store.h - src/core/xds/grpc/file_watcher_certificate_provider_factory.h @@ -1805,10 +1805,6 @@ libs: - src/core/lib/iomgr/wakeup_fd_nospecial.cc - src/core/lib/iomgr/wakeup_fd_pipe.cc - src/core/lib/iomgr/wakeup_fd_posix.cc - - src/core/lib/json/json_object_loader.cc - - src/core/lib/json/json_reader.cc - - src/core/lib/json/json_util.cc - - src/core/lib/json/json_writer.cc - src/core/lib/matchers/matchers.cc - src/core/lib/promise/activity.cc - src/core/lib/promise/party.cc @@ -2021,6 +2017,10 @@ libs: - src/core/tsi/ssl_transport_security_utils.cc - src/core/tsi/transport_security.cc - src/core/tsi/transport_security_grpc.cc + - src/core/util/json/json_object_loader.cc + - src/core/util/json/json_reader.cc + - src/core/util/json/json_util.cc + - src/core/util/json/json_writer.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 @@ -2511,12 +2511,6 @@ libs: - src/core/lib/iomgr/vsock.h - src/core/lib/iomgr/wakeup_fd_pipe.h - src/core/lib/iomgr/wakeup_fd_posix.h - - src/core/lib/json/json.h - - src/core/lib/json/json_args.h - - src/core/lib/json/json_channel_args.h - - src/core/lib/json/json_object_loader.h - - src/core/lib/json/json_reader.h - - src/core/lib/json/json_writer.h - src/core/lib/promise/activity.h - src/core/lib/promise/all_ok.h - src/core/lib/promise/arena_promise.h @@ -2683,6 +2677,12 @@ libs: - src/core/tsi/transport_security.h - src/core/tsi/transport_security_grpc.h - src/core/tsi/transport_security_interface.h + - src/core/util/json/json.h + - src/core/util/json/json_args.h + - src/core/util/json/json_channel_args.h + - src/core/util/json/json_object_loader.h + - src/core/util/json/json_reader.h + - src/core/util/json/json_writer.h - src/core/util/spinlock.h - third_party/upb/upb/generated_code_support.h - third_party/upb/upb/mini_descriptor/build_enum.h @@ -2955,9 +2955,6 @@ libs: - src/core/lib/iomgr/wakeup_fd_nospecial.cc - src/core/lib/iomgr/wakeup_fd_pipe.cc - src/core/lib/iomgr/wakeup_fd_posix.cc - - src/core/lib/json/json_object_loader.cc - - src/core/lib/json/json_reader.cc - - src/core/lib/json/json_writer.cc - src/core/lib/promise/activity.cc - src/core/lib/promise/party.cc - src/core/lib/promise/sleep.cc @@ -3098,6 +3095,9 @@ libs: - src/core/tsi/local_transport_security.cc - src/core/tsi/transport_security.cc - src/core/tsi/transport_security_grpc.cc + - src/core/util/json/json_object_loader.cc + - src/core/util/json/json_reader.cc + - src/core/util/json/json_writer.cc - third_party/upb/upb/mini_descriptor/build_enum.c - third_party/upb/upb/mini_descriptor/decode.c - third_party/upb/upb/mini_descriptor/internal/base92.c @@ -4596,10 +4596,6 @@ libs: - src/core/lib/iomgr/vsock.h - src/core/lib/iomgr/wakeup_fd_pipe.h - src/core/lib/iomgr/wakeup_fd_posix.h - - src/core/lib/json/json.h - - src/core/lib/json/json_args.h - - src/core/lib/json/json_reader.h - - src/core/lib/json/json_writer.h - src/core/lib/matchers/matchers.h - src/core/lib/promise/activity.h - src/core/lib/promise/all_ok.h @@ -4730,6 +4726,10 @@ libs: - src/core/tsi/transport_security.h - src/core/tsi/transport_security_grpc.h - src/core/tsi/transport_security_interface.h + - src/core/util/json/json.h + - src/core/util/json/json_args.h + - src/core/util/json/json_reader.h + - src/core/util/json/json_writer.h - src/core/util/spinlock.h - third_party/upb/upb/generated_code_support.h - third_party/upb/upb/mini_descriptor/build_enum.h @@ -4918,8 +4918,6 @@ libs: - src/core/lib/iomgr/wakeup_fd_nospecial.cc - src/core/lib/iomgr/wakeup_fd_pipe.cc - src/core/lib/iomgr/wakeup_fd_posix.cc - - src/core/lib/json/json_reader.cc - - src/core/lib/json/json_writer.cc - src/core/lib/matchers/matchers.cc - src/core/lib/promise/activity.cc - src/core/lib/promise/party.cc @@ -5017,6 +5015,8 @@ libs: - src/core/tsi/alts/handshaker/transport_security_common_api.cc - src/core/tsi/transport_security.cc - src/core/tsi/transport_security_grpc.cc + - src/core/util/json/json_reader.cc + - src/core/util/json/json_writer.cc - third_party/upb/upb/mini_descriptor/build_enum.c - third_party/upb/upb/mini_descriptor/decode.c - third_party/upb/upb/mini_descriptor/internal/base92.c @@ -11755,9 +11755,6 @@ targets: - src/core/lib/iomgr/vsock.h - src/core/lib/iomgr/wakeup_fd_pipe.h - src/core/lib/iomgr/wakeup_fd_posix.h - - src/core/lib/json/json.h - - src/core/lib/json/json_args.h - - src/core/lib/json/json_writer.h - src/core/lib/promise/activity.h - src/core/lib/promise/all_ok.h - src/core/lib/promise/arena_promise.h @@ -11862,6 +11859,9 @@ targets: - src/core/telemetry/stats_data.h - src/core/telemetry/tcp_tracer.h - src/core/tsi/alts/handshaker/transport_security_common_api.h + - src/core/util/json/json.h + - src/core/util/json/json_args.h + - src/core/util/json/json_writer.h - src/core/util/spinlock.h - test/core/promise/poll_matcher.h - third_party/upb/upb/generated_code_support.h @@ -12046,7 +12046,6 @@ targets: - src/core/lib/iomgr/wakeup_fd_nospecial.cc - src/core/lib/iomgr/wakeup_fd_pipe.cc - src/core/lib/iomgr/wakeup_fd_posix.cc - - src/core/lib/json/json_writer.cc - src/core/lib/promise/activity.cc - src/core/lib/promise/party.cc - src/core/lib/promise/trace.cc @@ -12118,6 +12117,7 @@ targets: - src/core/telemetry/stats.cc - src/core/telemetry/stats_data.cc - src/core/tsi/alts/handshaker/transport_security_common_api.cc + - src/core/util/json/json_writer.cc - test/core/transport/interception_chain_test.cc - third_party/upb/upb/mini_descriptor/build_enum.c - third_party/upb/upb/mini_descriptor/decode.c diff --git a/config.m4 b/config.m4 index 86b0b7922b3..804c3aa0de5 100644 --- a/config.m4 +++ b/config.m4 @@ -618,10 +618,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/iomgr/wakeup_fd_nospecial.cc \ src/core/lib/iomgr/wakeup_fd_pipe.cc \ src/core/lib/iomgr/wakeup_fd_posix.cc \ - src/core/lib/json/json_object_loader.cc \ - src/core/lib/json/json_reader.cc \ - src/core/lib/json/json_util.cc \ - src/core/lib/json/json_writer.cc \ src/core/lib/matchers/matchers.cc \ src/core/lib/promise/activity.cc \ src/core/lib/promise/party.cc \ @@ -838,6 +834,10 @@ if test "$PHP_GRPC" != "no"; then src/core/util/android/log.cc \ src/core/util/atm.cc \ src/core/util/iphone/cpu.cc \ + src/core/util/json/json_object_loader.cc \ + src/core/util/json/json_reader.cc \ + src/core/util/json/json_util.cc \ + src/core/util/json/json_writer.cc \ src/core/util/linux/cpu.cc \ src/core/util/linux/log.cc \ src/core/util/log.cc \ @@ -1533,7 +1533,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/http) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/iomgr) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/iomgr/event_engine_shims) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/json) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/matchers) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/promise) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/resource_quota) @@ -1603,6 +1602,7 @@ if test "$PHP_GRPC" != "no"; then 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/json) 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) diff --git a/config.w32 b/config.w32 index 86eb1661975..9bf2bf2d20d 100644 --- a/config.w32 +++ b/config.w32 @@ -583,10 +583,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\iomgr\\wakeup_fd_nospecial.cc " + "src\\core\\lib\\iomgr\\wakeup_fd_pipe.cc " + "src\\core\\lib\\iomgr\\wakeup_fd_posix.cc " + - "src\\core\\lib\\json\\json_object_loader.cc " + - "src\\core\\lib\\json\\json_reader.cc " + - "src\\core\\lib\\json\\json_util.cc " + - "src\\core\\lib\\json\\json_writer.cc " + "src\\core\\lib\\matchers\\matchers.cc " + "src\\core\\lib\\promise\\activity.cc " + "src\\core\\lib\\promise\\party.cc " + @@ -803,6 +799,10 @@ if (PHP_GRPC != "no") { "src\\core\\util\\android\\log.cc " + "src\\core\\util\\atm.cc " + "src\\core\\util\\iphone\\cpu.cc " + + "src\\core\\util\\json\\json_object_loader.cc " + + "src\\core\\util\\json\\json_reader.cc " + + "src\\core\\util\\json\\json_util.cc " + + "src\\core\\util\\json\\json_writer.cc " + "src\\core\\util\\linux\\cpu.cc " + "src\\core\\util\\linux\\log.cc " + "src\\core\\util\\log.cc " + @@ -1670,7 +1670,6 @@ if (PHP_GRPC != "no") { FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\http"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\iomgr"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\iomgr\\event_engine_shims"); - FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\json"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\matchers"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\promise"); FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\resource_quota"); @@ -1743,6 +1742,7 @@ if (PHP_GRPC != "no") { 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\\json"); 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"); diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index f96e7926a7d..6b74801bc8c 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -1074,13 +1074,6 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/vsock.h', 'src/core/lib/iomgr/wakeup_fd_pipe.h', 'src/core/lib/iomgr/wakeup_fd_posix.h', - 'src/core/lib/json/json.h', - 'src/core/lib/json/json_args.h', - 'src/core/lib/json/json_channel_args.h', - 'src/core/lib/json/json_object_loader.h', - 'src/core/lib/json/json_reader.h', - 'src/core/lib/json/json_util.h', - 'src/core/lib/json/json_writer.h', 'src/core/lib/matchers/matchers.h', 'src/core/lib/promise/activity.h', 'src/core/lib/promise/all_ok.h', @@ -1312,6 +1305,13 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_grpc.h', 'src/core/tsi/transport_security_interface.h', 'src/core/util/alloc.h', + 'src/core/util/json/json.h', + 'src/core/util/json/json_args.h', + 'src/core/util/json/json_channel_args.h', + 'src/core/util/json/json_object_loader.h', + 'src/core/util/json/json_reader.h', + 'src/core/util/json/json_util.h', + 'src/core/util/json/json_writer.h', 'src/core/util/spinlock.h', 'src/core/util/string.h', 'src/core/util/time_precise.h', @@ -2345,13 +2345,6 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/vsock.h', 'src/core/lib/iomgr/wakeup_fd_pipe.h', 'src/core/lib/iomgr/wakeup_fd_posix.h', - 'src/core/lib/json/json.h', - 'src/core/lib/json/json_args.h', - 'src/core/lib/json/json_channel_args.h', - 'src/core/lib/json/json_object_loader.h', - 'src/core/lib/json/json_reader.h', - 'src/core/lib/json/json_util.h', - 'src/core/lib/json/json_writer.h', 'src/core/lib/matchers/matchers.h', 'src/core/lib/promise/activity.h', 'src/core/lib/promise/all_ok.h', @@ -2583,6 +2576,13 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_grpc.h', 'src/core/tsi/transport_security_interface.h', 'src/core/util/alloc.h', + 'src/core/util/json/json.h', + 'src/core/util/json/json_args.h', + 'src/core/util/json/json_channel_args.h', + 'src/core/util/json/json_object_loader.h', + 'src/core/util/json/json_reader.h', + 'src/core/util/json/json_util.h', + 'src/core/util/json/json_writer.h', 'src/core/util/spinlock.h', 'src/core/util/string.h', 'src/core/util/time_precise.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 8096fd0e6cd..410e0f9095a 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -1586,17 +1586,6 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/wakeup_fd_pipe.h', 'src/core/lib/iomgr/wakeup_fd_posix.cc', 'src/core/lib/iomgr/wakeup_fd_posix.h', - 'src/core/lib/json/json.h', - 'src/core/lib/json/json_args.h', - 'src/core/lib/json/json_channel_args.h', - 'src/core/lib/json/json_object_loader.cc', - 'src/core/lib/json/json_object_loader.h', - 'src/core/lib/json/json_reader.cc', - 'src/core/lib/json/json_reader.h', - 'src/core/lib/json/json_util.cc', - 'src/core/lib/json/json_util.h', - 'src/core/lib/json/json_writer.cc', - 'src/core/lib/json/json_writer.h', 'src/core/lib/matchers/matchers.cc', 'src/core/lib/matchers/matchers.h', 'src/core/lib/promise/activity.cc', @@ -2044,6 +2033,17 @@ Pod::Spec.new do |s| 'src/core/util/android/log.cc', 'src/core/util/atm.cc', 'src/core/util/iphone/cpu.cc', + 'src/core/util/json/json.h', + 'src/core/util/json/json_args.h', + 'src/core/util/json/json_channel_args.h', + 'src/core/util/json/json_object_loader.cc', + 'src/core/util/json/json_object_loader.h', + 'src/core/util/json/json_reader.cc', + 'src/core/util/json/json_reader.h', + 'src/core/util/json/json_util.cc', + 'src/core/util/json/json_util.h', + 'src/core/util/json/json_writer.cc', + 'src/core/util/json/json_writer.h', 'src/core/util/linux/cpu.cc', 'src/core/util/linux/log.cc', 'src/core/util/log.cc', @@ -3125,13 +3125,6 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/vsock.h', 'src/core/lib/iomgr/wakeup_fd_pipe.h', 'src/core/lib/iomgr/wakeup_fd_posix.h', - 'src/core/lib/json/json.h', - 'src/core/lib/json/json_args.h', - 'src/core/lib/json/json_channel_args.h', - 'src/core/lib/json/json_object_loader.h', - 'src/core/lib/json/json_reader.h', - 'src/core/lib/json/json_util.h', - 'src/core/lib/json/json_writer.h', 'src/core/lib/matchers/matchers.h', 'src/core/lib/promise/activity.h', 'src/core/lib/promise/all_ok.h', @@ -3363,6 +3356,13 @@ Pod::Spec.new do |s| 'src/core/tsi/transport_security_grpc.h', 'src/core/tsi/transport_security_interface.h', 'src/core/util/alloc.h', + 'src/core/util/json/json.h', + 'src/core/util/json/json_args.h', + 'src/core/util/json/json_channel_args.h', + 'src/core/util/json/json_object_loader.h', + 'src/core/util/json/json_reader.h', + 'src/core/util/json/json_util.h', + 'src/core/util/json/json_writer.h', 'src/core/util/spinlock.h', 'src/core/util/string.h', 'src/core/util/time_precise.h', diff --git a/grpc.gemspec b/grpc.gemspec index 1a0b2d73869..26c0f1f1f31 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -1473,17 +1473,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/wakeup_fd_pipe.h ) s.files += %w( src/core/lib/iomgr/wakeup_fd_posix.cc ) s.files += %w( src/core/lib/iomgr/wakeup_fd_posix.h ) - s.files += %w( src/core/lib/json/json.h ) - s.files += %w( src/core/lib/json/json_args.h ) - s.files += %w( src/core/lib/json/json_channel_args.h ) - s.files += %w( src/core/lib/json/json_object_loader.cc ) - s.files += %w( src/core/lib/json/json_object_loader.h ) - s.files += %w( src/core/lib/json/json_reader.cc ) - s.files += %w( src/core/lib/json/json_reader.h ) - s.files += %w( src/core/lib/json/json_util.cc ) - s.files += %w( src/core/lib/json/json_util.h ) - s.files += %w( src/core/lib/json/json_writer.cc ) - s.files += %w( src/core/lib/json/json_writer.h ) s.files += %w( src/core/lib/matchers/matchers.cc ) s.files += %w( src/core/lib/matchers/matchers.h ) s.files += %w( src/core/lib/promise/activity.cc ) @@ -1931,6 +1920,17 @@ Gem::Specification.new do |s| 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/json/json.h ) + s.files += %w( src/core/util/json/json_args.h ) + s.files += %w( src/core/util/json/json_channel_args.h ) + s.files += %w( src/core/util/json/json_object_loader.cc ) + s.files += %w( src/core/util/json/json_object_loader.h ) + s.files += %w( src/core/util/json/json_reader.cc ) + s.files += %w( src/core/util/json/json_reader.h ) + s.files += %w( src/core/util/json/json_util.cc ) + s.files += %w( src/core/util/json/json_util.h ) + s.files += %w( src/core/util/json/json_writer.cc ) + s.files += %w( src/core/util/json/json_writer.h ) 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 ) diff --git a/package.xml b/package.xml index 249e19c2fff..eda4309713c 100644 --- a/package.xml +++ b/package.xml @@ -1455,17 +1455,6 @@ - - - - - - - - - - - @@ -1913,6 +1902,17 @@ + + + + + + + + + + + diff --git a/src/core/BUILD b/src/core/BUILD index 0752f8b056f..b1f10e5fdd8 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -4524,7 +4524,7 @@ grpc_cc_library( grpc_cc_library( name = "json", hdrs = [ - "lib/json/json.h", + "util/json/json.h", ], deps = ["//:gpr"], ) @@ -4532,10 +4532,10 @@ grpc_cc_library( grpc_cc_library( name = "json_reader", srcs = [ - "lib/json/json_reader.cc", + "util/json/json_reader.cc", ], hdrs = [ - "lib/json/json_reader.h", + "util/json/json_reader.h", ], external_deps = [ "absl/base:core_headers", @@ -4557,10 +4557,10 @@ grpc_cc_library( grpc_cc_library( name = "json_writer", srcs = [ - "lib/json/json_writer.cc", + "util/json/json_writer.cc", ], hdrs = [ - "lib/json/json_writer.h", + "util/json/json_writer.h", ], external_deps = ["absl/strings"], deps = [ @@ -4571,8 +4571,8 @@ grpc_cc_library( grpc_cc_library( name = "json_util", - srcs = ["lib/json/json_util.cc"], - hdrs = ["lib/json/json_util.h"], + srcs = ["util/json/json_util.cc"], + hdrs = ["util/json/json_util.h"], external_deps = ["absl/strings"], deps = [ "error", @@ -4588,15 +4588,15 @@ grpc_cc_library( grpc_cc_library( name = "json_args", - hdrs = ["lib/json/json_args.h"], + hdrs = ["util/json/json_args.h"], external_deps = ["absl/strings"], deps = ["//:gpr"], ) grpc_cc_library( name = "json_object_loader", - srcs = ["lib/json/json_object_loader.cc"], - hdrs = ["lib/json/json_object_loader.h"], + srcs = ["util/json/json_object_loader.cc"], + hdrs = ["util/json/json_object_loader.h"], external_deps = [ "absl/meta:type_traits", "absl/status", @@ -4617,7 +4617,7 @@ grpc_cc_library( grpc_cc_library( name = "json_channel_args", - hdrs = ["lib/json/json_channel_args.h"], + hdrs = ["util/json/json_channel_args.h"], external_deps = [ "absl/strings", "absl/types:optional", diff --git a/src/core/channelz/channel_trace.h b/src/core/channelz/channel_trace.h index b0465b5861a..c6c245c5cf5 100644 --- a/src/core/channelz/channel_trace.h +++ b/src/core/channelz/channel_trace.h @@ -30,7 +30,7 @@ #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/json/json.h" namespace grpc_core { namespace channelz { diff --git a/src/core/channelz/channelz.cc b/src/core/channelz/channelz.cc index 699ee188af6..1baf851ed6a 100644 --- a/src/core/channelz/channelz.cc +++ b/src/core/channelz/channelz.cc @@ -38,9 +38,9 @@ #include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/channel/channel_args.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/json/json_writer.h" #include "src/core/util/string.h" #include "src/core/util/useful.h" diff --git a/src/core/channelz/channelz.h b/src/core/channelz/channelz.h index 5ecf702c845..e441edc81a6 100644 --- a/src/core/channelz/channelz.h +++ b/src/core/channelz/channelz.h @@ -42,7 +42,7 @@ #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/json/json.h" #include "src/core/util/time_precise.h" #include "src/core/util/useful.h" diff --git a/src/core/channelz/channelz_registry.cc b/src/core/channelz/channelz_registry.cc index 0ba7a2ac438..8089cc273bf 100644 --- a/src/core/channelz/channelz_registry.cc +++ b/src/core/channelz/channelz_registry.cc @@ -36,8 +36,8 @@ #include "src/core/channelz/channelz.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/exec_ctx.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" namespace grpc_core { namespace channelz { diff --git a/src/core/client_channel/client_channel_filter.cc b/src/core/client_channel/client_channel_filter.cc index 10918a8cba7..3cb76ff8409 100644 --- a/src/core/client_channel/client_channel_filter.cc +++ b/src/core/client_channel/client_channel_filter.cc @@ -79,7 +79,6 @@ #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/promise/cancel_callback.h" #include "src/core/lib/promise/context.h" #include "src/core/lib/promise/latch.h" @@ -103,6 +102,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/json/json.h" #include "src/core/util/useful.h" // diff --git a/src/core/client_channel/client_channel_service_config.h b/src/core/client_channel/client_channel_service_config.h index 21778d9be18..60340e2685f 100644 --- a/src/core/client_channel/client_channel_service_config.h +++ b/src/core/client_channel/client_channel_service_config.h @@ -32,11 +32,11 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { namespace internal { diff --git a/src/core/client_channel/retry_service_config.cc b/src/core/client_channel/retry_service_config.cc index dd228d5f4f0..54a48442353 100644 --- a/src/core/client_channel/retry_service_config.cc +++ b/src/core/client_channel/retry_service_config.cc @@ -35,7 +35,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/config/core_configuration.h" -#include "src/core/lib/json/json_channel_args.h" +#include "src/core/util/json/json_channel_args.h" // As per the retry design, we do not allow more than 5 retry attempts. #define MAX_MAX_RETRY_ATTEMPTS 5 diff --git a/src/core/client_channel/retry_service_config.h b/src/core/client_channel/retry_service_config.h index 7c47e3b8c5a..6e4bbc29753 100644 --- a/src/core/client_channel/retry_service_config.h +++ b/src/core/client_channel/retry_service_config.h @@ -32,10 +32,10 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { namespace internal { diff --git a/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h b/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h index 4cb2c1b03bb..bef8185fe27 100644 --- a/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h +++ b/src/core/ext/filters/fault_injection/fault_injection_service_config_parser.h @@ -35,10 +35,10 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" // Channel arg key for enabling parsing fault injection via method config. #define GRPC_ARG_PARSE_FAULT_INJECTION_METHOD_CONFIG \ diff --git a/src/core/ext/filters/message_size/message_size_filter.h b/src/core/ext/filters/message_size/message_size_filter.h index 1637bfe3561..200f6880883 100644 --- a/src/core/ext/filters/message_size/message_size_filter.h +++ b/src/core/ext/filters/message_size/message_size_filter.h @@ -34,12 +34,12 @@ #include "src/core/lib/channel/promise_based_filter.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/promise/arena_promise.h" #include "src/core/lib/transport/transport.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/ext/filters/rbac/rbac_service_config_parser.cc b/src/core/ext/filters/rbac/rbac_service_config_parser.cc index bb9b529e9f7..000440f5274 100644 --- a/src/core/ext/filters/rbac/rbac_service_config_parser.cc +++ b/src/core/ext/filters/rbac/rbac_service_config_parser.cc @@ -31,10 +31,10 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/matchers/matchers.h" #include "src/core/lib/security/authorization/audit_logging.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/ext/filters/rbac/rbac_service_config_parser.h b/src/core/ext/filters/rbac/rbac_service_config_parser.h index 4d1ff294d14..728a92e1bf0 100644 --- a/src/core/ext/filters/rbac/rbac_service_config_parser.h +++ b/src/core/ext/filters/rbac/rbac_service_config_parser.h @@ -31,10 +31,10 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/security/authorization/grpc_authorization_engine.h" #include "src/core/lib/security/authorization/rbac_policy.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h b/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h index 876c0fda405..ccb6245b28f 100644 --- a/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +++ b/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h @@ -32,10 +32,10 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" // Channel arg key for enabling parsing fault injection via method config. #define GRPC_ARG_PARSE_STATEFUL_SESSION_METHOD_CONFIG \ diff --git a/src/core/lib/security/authorization/rbac_translator.cc b/src/core/lib/security/authorization/rbac_translator.cc index 7ae89a4d7a8..1dbbe8bf16d 100644 --- a/src/core/lib/security/authorization/rbac_translator.cc +++ b/src/core/lib/security/authorization/rbac_translator.cc @@ -37,10 +37,10 @@ #include #include -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/matchers/matchers.h" #include "src/core/lib/security/authorization/audit_logging.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" #include "src/core/util/useful.h" namespace grpc_core { diff --git a/src/core/lib/security/certificate_provider/certificate_provider_factory.h b/src/core/lib/security/certificate_provider/certificate_provider_factory.h index 6d1b36e7b20..719561a1eec 100644 --- a/src/core/lib/security/certificate_provider/certificate_provider_factory.h +++ b/src/core/lib/security/certificate_provider/certificate_provider_factory.h @@ -30,8 +30,8 @@ #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/channel_creds_registry.h b/src/core/lib/security/credentials/channel_creds_registry.h index 3c3ade7e5be..8fa2462f2ba 100644 --- a/src/core/lib/security/credentials/channel_creds_registry.h +++ b/src/core/lib/security/credentials/channel_creds_registry.h @@ -29,8 +29,8 @@ #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" struct grpc_channel_credentials; diff --git a/src/core/lib/security/credentials/channel_creds_registry_init.cc b/src/core/lib/security/credentials/channel_creds_registry_init.cc index 4f19760f377..9b7a0e04372 100644 --- a/src/core/lib/security/credentials/channel_creds_registry_init.cc +++ b/src/core/lib/security/credentials/channel_creds_registry_init.cc @@ -34,9 +34,6 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/security/credentials/channel_creds_registry.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/fake/fake_credentials.h" @@ -44,6 +41,9 @@ #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h" #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" #include "src/core/lib/security/credentials/tls/tls_credentials.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/external/aws_external_account_credentials.cc b/src/core/lib/security/credentials/external/aws_external_account_credentials.cc index 5bdb1f1aad6..06122b04a81 100644 --- a/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/aws_external_account_credentials.cc @@ -41,11 +41,11 @@ #include "src/core/lib/gprpp/env.h" #include "src/core/lib/http/httpcli_ssl_credentials.h" #include "src/core/lib/iomgr/closure.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/uri/uri_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/external/external_account_credentials.cc b/src/core/lib/security/credentials/external/external_account_credentials.cc index a5d7add62b9..f604d1e9815 100644 --- a/src/core/lib/security/credentials/external/external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/external_account_credentials.cc @@ -48,14 +48,14 @@ #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/http/httpcli_ssl_credentials.h" #include "src/core/lib/http/parser.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/external/aws_external_account_credentials.h" #include "src/core/lib/security/credentials/external/file_external_account_credentials.h" #include "src/core/lib/security/credentials/external/url_external_account_credentials.h" #include "src/core/lib/security/util/json_util.h" #include "src/core/lib/uri/uri_parser.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" #define EXTERNAL_ACCOUNT_CREDENTIALS_GRANT_TYPE \ "urn:ietf:params:oauth:grant-type:token-exchange" diff --git a/src/core/lib/security/credentials/external/external_account_credentials.h b/src/core/lib/security/credentials/external/external_account_credentials.h index 95a622928d6..c194fd60163 100644 --- a/src/core/lib/security/credentials/external/external_account_credentials.h +++ b/src/core/lib/security/credentials/external/external_account_credentials.h @@ -35,8 +35,8 @@ #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/polling_entity.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/external/file_external_account_credentials.cc b/src/core/lib/security/credentials/external/file_external_account_credentials.cc index 472a1cabb39..0bbef7b8a07 100644 --- a/src/core/lib/security/credentials/external/file_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/file_external_account_credentials.cc @@ -27,10 +27,10 @@ #include #include "src/core/lib/gprpp/load_file.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/external/url_external_account_credentials.cc b/src/core/lib/security/credentials/external/url_external_account_credentials.cc index c73f84d498c..cf9d646e579 100644 --- a/src/core/lib/security/credentials/external/url_external_account_credentials.cc +++ b/src/core/lib/security/credentials/external/url_external_account_credentials.cc @@ -40,10 +40,10 @@ #include "src/core/lib/http/httpcli_ssl_credentials.h" #include "src/core/lib/http/parser.h" #include "src/core/lib/iomgr/closure.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/transport/error_utils.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" namespace grpc_core { diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.cc b/src/core/lib/security/credentials/google_default/google_default_credentials.cc index 17455936444..86602f6c519 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.cc +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.cc @@ -57,8 +57,6 @@ #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/iomgr/pollset.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/external/external_account_credentials.h" @@ -72,6 +70,8 @@ #include "src/core/lib/uri/uri_parser.h" #include "src/core/load_balancing/grpclb/grpclb.h" #include "src/core/load_balancing/xds/xds_channel_args.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" using grpc_core::Json; diff --git a/src/core/lib/security/credentials/jwt/json_token.cc b/src/core/lib/security/credentials/jwt/json_token.cc index 2f1c5c35fc4..456ff99dd4f 100644 --- a/src/core/lib/security/credentials/jwt/json_token.cc +++ b/src/core/lib/security/credentials/jwt/json_token.cc @@ -45,9 +45,9 @@ #include #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/util/json_util.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" using grpc_core::Json; diff --git a/src/core/lib/security/credentials/jwt/json_token.h b/src/core/lib/security/credentials/jwt/json_token.h index 3b2c7d5c348..5576b643ce1 100644 --- a/src/core/lib/security/credentials/jwt/json_token.h +++ b/src/core/lib/security/credentials/jwt/json_token.h @@ -24,7 +24,7 @@ #include #include -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" // --- Constants. --- diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.cc b/src/core/lib/security/credentials/jwt/jwt_credentials.cc index b1ae58f2dea..398a898f2b2 100644 --- a/src/core/lib/security/credentials/jwt/jwt_credentials.cc +++ b/src/core/lib/security/credentials/jwt/jwt_credentials.cc @@ -40,14 +40,14 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/exec_ctx.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/promise/promise.h" #include "src/core/lib/security/credentials/call_creds_util.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/uri/uri_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" using grpc_core::Json; diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc index 100e09012eb..02a7c548e98 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc @@ -66,12 +66,12 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/polling_entity.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/credentials/credentials.h" // IWYU pragma: keep #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/uri/uri_parser.h" #include "src/core/tsi/ssl_types.h" +#include "src/core/util/json/json_reader.h" #include "src/core/util/string.h" using grpc_core::Json; diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.h b/src/core/lib/security/credentials/jwt/jwt_verifier.h index 814c40204a3..922da79d4c9 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.h +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.h @@ -26,7 +26,7 @@ #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/iomgr_fwd.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" // --- Constants. --- diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index 63ecb7300e1..313485e53d6 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -54,8 +54,6 @@ #include "src/core/lib/http/httpcli_ssl_credentials.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/promise/context.h" #include "src/core/lib/promise/poll.h" #include "src/core/lib/promise/promise.h" @@ -64,6 +62,8 @@ #include "src/core/lib/transport/error_utils.h" #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/uri/uri_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" using grpc_core::Json; diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h index 491fbcb1768..5144905284b 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.h @@ -42,13 +42,13 @@ #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/polling_entity.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/promise/activity.h" #include "src/core/lib/promise/arena_promise.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/transport/transport.h" #include "src/core/lib/uri/uri_parser.h" +#include "src/core/util/json/json.h" #include "src/core/util/useful.h" // Constants. diff --git a/src/core/lib/security/util/json_util.h b/src/core/lib/security/util/json_util.h index b7dff369a6e..6425d32aaf7 100644 --- a/src/core/lib/security/util/json_util.h +++ b/src/core/lib/security/util/json_util.h @@ -22,7 +22,7 @@ #include #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" // Constants. #define GRPC_AUTH_JSON_TYPE_INVALID "invalid" diff --git a/src/core/load_balancing/endpoint_list.cc b/src/core/load_balancing/endpoint_list.cc index 84b5848e7b9..261711ba81a 100644 --- a/src/core/load_balancing/endpoint_list.cc +++ b/src/core/load_balancing/endpoint_list.cc @@ -38,12 +38,12 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/pick_first/pick_first.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/load_balancing/grpclb/grpclb.cc b/src/core/load_balancing/grpclb/grpclb.cc index fcc3034bf03..e4aadff0d90 100644 --- a/src/core/load_balancing/grpclb/grpclb.cc +++ b/src/core/load_balancing/grpclb/grpclb.cc @@ -117,9 +117,6 @@ #include "src/core/lib/iomgr/resolved_address.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/socket_utils.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_string_helpers.h" @@ -141,6 +138,9 @@ #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/fake/fake_resolver.h" #include "src/core/resolver/resolver.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "src/core/util/string.h" #include "src/core/util/useful.h" diff --git a/src/core/load_balancing/lb_policy_factory.h b/src/core/load_balancing/lb_policy_factory.h index b4116f5ff30..697a5321667 100644 --- a/src/core/load_balancing/lb_policy_factory.h +++ b/src/core/load_balancing/lb_policy_factory.h @@ -24,8 +24,8 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/load_balancing/lb_policy_registry.h b/src/core/load_balancing/lb_policy_registry.h index dea9b5ad277..44d1e487522 100644 --- a/src/core/load_balancing/lb_policy_registry.h +++ b/src/core/load_balancing/lb_policy_registry.h @@ -27,9 +27,9 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy_factory.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/load_balancing/outlier_detection/outlier_detection.cc b/src/core/load_balancing/outlier_detection/outlier_detection.cc index ffafdedbf86..2545345cf33 100644 --- a/src/core/load_balancing/outlier_detection/outlier_detection.cc +++ b/src/core/load_balancing/outlier_detection/outlier_detection.cc @@ -62,7 +62,6 @@ #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/child_policy_handler.h" #include "src/core/load_balancing/delegating_helper.h" @@ -72,6 +71,7 @@ #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/subchannel_interface.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/load_balancing/outlier_detection/outlier_detection.h b/src/core/load_balancing/outlier_detection/outlier_detection.h index 468591ddfc7..ba5767914ec 100644 --- a/src/core/load_balancing/outlier_detection/outlier_detection.h +++ b/src/core/load_balancing/outlier_detection/outlier_detection.h @@ -25,9 +25,9 @@ #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/load_balancing/pick_first/pick_first.cc b/src/core/load_balancing/pick_first/pick_first.cc index d22fe292b6a..47b43a30114 100644 --- a/src/core/load_balancing/pick_first/pick_first.cc +++ b/src/core/load_balancing/pick_first/pick_first.cc @@ -55,9 +55,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/health_check_client.h" #include "src/core/load_balancing/lb_policy.h" @@ -65,6 +62,9 @@ #include "src/core/load_balancing/subchannel_interface.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/telemetry/metrics.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "src/core/util/useful.h" namespace grpc_core { diff --git a/src/core/load_balancing/priority/priority.cc b/src/core/load_balancing/priority/priority.cc index 2c8d483055b..114ca5df053 100644 --- a/src/core/load_balancing/priority/priority.cc +++ b/src/core/load_balancing/priority/priority.cc @@ -51,9 +51,6 @@ #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/address_filtering.h" #include "src/core/load_balancing/child_policy_handler.h" @@ -62,6 +59,9 @@ #include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/load_balancing/ring_hash/ring_hash.cc b/src/core/load_balancing/ring_hash/ring_hash.cc index 114c13b645a..87f4e722105 100644 --- a/src/core/load_balancing/ring_hash/ring_hash.cc +++ b/src/core/load_balancing/ring_hash/ring_hash.cc @@ -60,7 +60,6 @@ #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/lb_policy.h" @@ -68,6 +67,7 @@ #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/pick_first/pick_first.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/load_balancing/ring_hash/ring_hash.h b/src/core/load_balancing/ring_hash/ring_hash.h index 001de901543..c5f6205e170 100644 --- a/src/core/load_balancing/ring_hash/ring_hash.h +++ b/src/core/load_balancing/ring_hash/ring_hash.h @@ -23,10 +23,10 @@ #include "src/core/lib/gprpp/unique_type_name.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/service_config/service_config_call_data.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/load_balancing/rls/rls.cc b/src/core/load_balancing/rls/rls.cc index 26bd71d0dda..57caea01739 100644 --- a/src/core/load_balancing/rls/rls.cc +++ b/src/core/load_balancing/rls/rls.cc @@ -87,10 +87,6 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" @@ -107,6 +103,10 @@ #include "src/core/resolver/resolver_registry.h" #include "src/core/service_config/service_config_impl.h" #include "src/core/telemetry/metrics.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_writer.h" #include "src/proto/grpc/lookup/v1/rls.upb.h" using ::grpc_event_engine::experimental::EventEngine; diff --git a/src/core/load_balancing/round_robin/round_robin.cc b/src/core/load_balancing/round_robin/round_robin.cc index 27f7f8b0a21..f149d153078 100644 --- a/src/core/load_balancing/round_robin/round_robin.cc +++ b/src/core/load_balancing/round_robin/round_robin.cc @@ -44,12 +44,12 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/work_serializer.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/endpoint_list.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc b/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc index f750b0ae0a0..e4f805f7384 100644 --- a/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +++ b/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc @@ -58,9 +58,6 @@ #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/backend_metric_data.h" #include "src/core/load_balancing/endpoint_list.h" @@ -74,6 +71,9 @@ #include "src/core/telemetry/metrics.h" #include "src/core/telemetry/stats.h" #include "src/core/telemetry/stats_data.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/load_balancing/weighted_target/weighted_target.cc b/src/core/load_balancing/weighted_target/weighted_target.cc index 19f5c9d5bcf..61c4777851d 100644 --- a/src/core/load_balancing/weighted_target/weighted_target.cc +++ b/src/core/load_balancing/weighted_target/weighted_target.cc @@ -54,9 +54,6 @@ #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/address_filtering.h" #include "src/core/load_balancing/child_policy_handler.h" @@ -65,6 +62,9 @@ #include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" // IWYU pragma: no_include diff --git a/src/core/load_balancing/xds/cds.cc b/src/core/load_balancing/xds/cds.cc index be516ce09c9..88813f87d78 100644 --- a/src/core/load_balancing/xds/cds.cc +++ b/src/core/load_balancing/xds/cds.cc @@ -49,10 +49,6 @@ #include "src/core/lib/gprpp/unique_type_name.h" #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/load_balancing/address_filtering.h" #include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/lb_policy.h" @@ -61,6 +57,10 @@ #include "src/core/load_balancing/outlier_detection/outlier_detection.h" #include "src/core/load_balancing/xds/xds_channel_args.h" #include "src/core/resolver/xds/xds_dependency_manager.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_cluster.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/grpc/xds_health_status.h" diff --git a/src/core/load_balancing/xds/xds_cluster_impl.cc b/src/core/load_balancing/xds/xds_cluster_impl.cc index 6ea74538a36..25b6a0c464a 100644 --- a/src/core/load_balancing/xds/xds_cluster_impl.cc +++ b/src/core/load_balancing/xds/xds_cluster_impl.cc @@ -51,9 +51,6 @@ #include "src/core/lib/gprpp/validation_errors.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/security/credentials/xds/xds_credentials.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/backend_metric_data.h" @@ -67,6 +64,9 @@ #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/xds/xds_dependency_manager.h" #include "src/core/telemetry/call_tracer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_client_grpc.h" #include "src/core/xds/grpc/xds_endpoint.h" diff --git a/src/core/load_balancing/xds/xds_cluster_manager.cc b/src/core/load_balancing/xds/xds_cluster_manager.cc index f2aea70f293..5c4b8e641bc 100644 --- a/src/core/load_balancing/xds/xds_cluster_manager.cc +++ b/src/core/load_balancing/xds/xds_cluster_manager.cc @@ -49,9 +49,6 @@ #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/child_policy_handler.h" #include "src/core/load_balancing/delegating_helper.h" @@ -60,6 +57,9 @@ #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/xds/xds_resolver_attributes.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/load_balancing/xds/xds_override_host.cc b/src/core/load_balancing/xds/xds_override_host.cc index 41b3eb36ef6..06b73fc509f 100644 --- a/src/core/load_balancing/xds/xds_override_host.cc +++ b/src/core/load_balancing/xds/xds_override_host.cc @@ -70,9 +70,6 @@ #include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/load_balancing/child_policy_handler.h" #include "src/core/load_balancing/delegating_helper.h" @@ -82,6 +79,9 @@ #include "src/core/load_balancing/subchannel_interface.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/xds/xds_dependency_manager.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "src/core/xds/grpc/xds_health_status.h" namespace grpc_core { diff --git a/src/core/load_balancing/xds/xds_override_host.h b/src/core/load_balancing/xds/xds_override_host.h index 392f325ec35..226b55dee01 100644 --- a/src/core/load_balancing/xds/xds_override_host.h +++ b/src/core/load_balancing/xds/xds_override_host.h @@ -23,10 +23,10 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/load_balancing/lb_policy.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/load_balancing/xds/xds_wrr_locality.cc b/src/core/load_balancing/xds/xds_wrr_locality.cc index ac79f69f417..0d2ea0472b2 100644 --- a/src/core/load_balancing/xds/xds_wrr_locality.cc +++ b/src/core/load_balancing/xds/xds_wrr_locality.cc @@ -40,16 +40,16 @@ #include "src/core/lib/gprpp/ref_counted_string.h" #include "src/core/lib/gprpp/validation_errors.h" #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/xds/xds_channel_args.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/xds_client/xds_client_stats.h" namespace grpc_core { diff --git a/src/core/resolver/dns/event_engine/service_config_helper.cc b/src/core/resolver/dns/event_engine/service_config_helper.cc index 40b932b8deb..92cea5ec517 100644 --- a/src/core/resolver/dns/event_engine/service_config_helper.cc +++ b/src/core/resolver/dns/event_engine/service_config_helper.cc @@ -25,11 +25,11 @@ #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/iomgr/gethostname.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" namespace grpc_core { diff --git a/src/core/resolver/google_c2p/google_c2p_resolver.cc b/src/core/resolver/google_c2p/google_c2p_resolver.cc index d58e9a81b3e..74239361742 100644 --- a/src/core/resolver/google_c2p/google_c2p_resolver.cc +++ b/src/core/resolver/google_c2p/google_c2p_resolver.cc @@ -43,14 +43,14 @@ #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/polling_entity.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/resource_quota/resource_quota.h" #include "src/core/lib/security/credentials/alts/check_gcp_environment.h" #include "src/core/lib/uri/uri_parser.h" #include "src/core/resolver/resolver.h" #include "src/core/resolver/resolver_factory.h" #include "src/core/resolver/resolver_registry.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_client_grpc.h" #include "src/core/xds/xds_client/xds_bootstrap.h" diff --git a/src/core/service_config/service_config_impl.cc b/src/core/service_config/service_config_impl.cc index 78b66bd7f43..034e635690b 100644 --- a/src/core/service_config/service_config_impl.cc +++ b/src/core/service_config/service_config_impl.cc @@ -31,14 +31,14 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" namespace grpc_core { diff --git a/src/core/service_config/service_config_impl.h b/src/core/service_config/service_config_impl.h index 3b5b96e182d..f617163a956 100644 --- a/src/core/service_config/service_config_impl.h +++ b/src/core/service_config/service_config_impl.h @@ -35,10 +35,10 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/service_config/service_config.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" // The main purpose of the code here is to parse the service config in // JSON form, which will look like this: diff --git a/src/core/service_config/service_config_parser.h b/src/core/service_config/service_config_parser.h index d911f869ad0..9b7983a7680 100644 --- a/src/core/service_config/service_config_parser.h +++ b/src/core/service_config/service_config_parser.h @@ -30,7 +30,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/lib/json/json.h b/src/core/util/json/json.h similarity index 86% rename from src/core/lib/json/json.h rename to src/core/util/json/json.h index 6ffa7e77975..9dbc95e3b94 100644 --- a/src/core/lib/json/json.h +++ b/src/core/util/json/json.h @@ -14,16 +14,17 @@ // limitations under the License. // -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_H +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_H -#include #include +#include + namespace grpc_core { using Json = experimental::Json; } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_H diff --git a/src/core/lib/json/json_args.h b/src/core/util/json/json_args.h similarity index 86% rename from src/core/lib/json/json_args.h rename to src/core/util/json/json_args.h index 875b1f477d2..5fe104552c7 100644 --- a/src/core/lib/json/json_args.h +++ b/src/core/util/json/json_args.h @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_ARGS_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_ARGS_H - -#include "absl/strings/string_view.h" +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_ARGS_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_ARGS_H #include +#include "absl/strings/string_view.h" + namespace grpc_core { class JsonArgs { @@ -31,4 +31,4 @@ class JsonArgs { } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_ARGS_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_ARGS_H diff --git a/src/core/lib/json/json_channel_args.h b/src/core/util/json/json_channel_args.h similarity index 84% rename from src/core/lib/json/json_channel_args.h rename to src/core/util/json/json_channel_args.h index 82fb8536760..fe64a377faa 100644 --- a/src/core/lib/json/json_channel_args.h +++ b/src/core/util/json/json_channel_args.h @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_CHANNEL_ARGS_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_CHANNEL_ARGS_H +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_CHANNEL_ARGS_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_CHANNEL_ARGS_H + +#include #include "absl/strings/string_view.h" #include "absl/types/optional.h" -#include - #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/json/json_args.h" +#include "src/core/util/json/json_args.h" namespace grpc_core { @@ -39,4 +39,4 @@ class JsonChannelArgs : public JsonArgs { } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_CHANNEL_ARGS_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_CHANNEL_ARGS_H diff --git a/src/core/lib/json/json_object_loader.cc b/src/core/util/json/json_object_loader.cc similarity index 99% rename from src/core/lib/json/json_object_loader.cc rename to src/core/util/json/json_object_loader.cc index f7e445be1e1..0d6dd4588a5 100644 --- a/src/core/lib/json/json_object_loader.cc +++ b/src/core/util/json/json_object_loader.cc @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/core/lib/json/json_object_loader.h" +#include + +#include "src/core/util/json/json_object_loader.h" #include @@ -21,7 +23,6 @@ #include "absl/strings/strip.h" #include -#include namespace grpc_core { namespace json_detail { diff --git a/src/core/lib/json/json_object_loader.h b/src/core/util/json/json_object_loader.h similarity index 98% rename from src/core/lib/json/json_object_loader.h rename to src/core/util/json/json_object_loader.h index f6295d07aa2..03bce3efefd 100644 --- a/src/core/lib/json/json_object_loader.h +++ b/src/core/util/json/json_object_loader.h @@ -12,8 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_OBJECT_LOADER_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_OBJECT_LOADER_H +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_OBJECT_LOADER_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_OBJECT_LOADER_H + +#include #include #include @@ -30,14 +32,12 @@ #include "absl/strings/string_view.h" #include "absl/types/optional.h" -#include - #include "src/core/lib/gprpp/no_destruct.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" // Provides a means to load JSON objects into C++ objects, with the aim of // minimizing object code size. @@ -642,4 +642,4 @@ absl::optional LoadJsonObjectField(const Json::Object& json, } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_OBJECT_LOADER_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_OBJECT_LOADER_H diff --git a/src/core/lib/json/json_reader.cc b/src/core/util/json/json_reader.cc similarity index 99% rename from src/core/lib/json/json_reader.cc rename to src/core/util/json/json_reader.cc index ae249b3824c..291e96544d6 100644 --- a/src/core/lib/json/json_reader.cc +++ b/src/core/util/json/json_reader.cc @@ -14,6 +14,8 @@ // limitations under the License. // +#include + #include #include @@ -35,10 +37,9 @@ #include #include -#include #include "src/core/lib/gprpp/match.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #define GRPC_JSON_MAX_DEPTH 255 #define GRPC_JSON_MAX_ERRORS 16 diff --git a/src/core/lib/json/json_reader.h b/src/core/util/json/json_reader.h similarity index 82% rename from src/core/lib/json/json_reader.h rename to src/core/util/json/json_reader.h index fa26f130a66..2b16d911981 100644 --- a/src/core/lib/json/json_reader.h +++ b/src/core/util/json/json_reader.h @@ -14,15 +14,15 @@ // limitations under the License. // -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_READER_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_READER_H +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_READER_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_READER_H + +#include #include "absl/status/statusor.h" #include "absl/strings/string_view.h" -#include - -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" namespace grpc_core { @@ -31,4 +31,4 @@ absl::StatusOr JsonParse(absl::string_view json_str); } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_READER_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_READER_H diff --git a/src/core/lib/json/json_util.cc b/src/core/util/json/json_util.cc similarity index 96% rename from src/core/lib/json/json_util.cc rename to src/core/util/json/json_util.cc index ca6541a1c1e..8faa7cd8f25 100644 --- a/src/core/lib/json/json_util.cc +++ b/src/core/util/json/json_util.cc @@ -16,14 +16,14 @@ // // -#include "src/core/lib/json/json_util.h" - #include +#include "src/core/util/json/json_util.h" + #include "src/core/lib/gprpp/no_destruct.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/lib/json/json_util.h b/src/core/util/json/json_util.h similarity index 97% rename from src/core/lib/json/json_util.h rename to src/core/util/json/json_util.h index da98a2b67fd..da45b74b3c3 100644 --- a/src/core/lib/json/json_util.h +++ b/src/core/util/json/json_util.h @@ -16,8 +16,10 @@ // // -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_UTIL_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_UTIL_H +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_UTIL_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_UTIL_H + +#include #include #include @@ -30,11 +32,9 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include - #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" namespace grpc_core { @@ -161,4 +161,4 @@ bool ParseJsonObjectFieldAsDuration(const Json::Object& object, } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_UTIL_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_UTIL_H diff --git a/src/core/lib/json/json_writer.cc b/src/core/util/json/json_writer.cc similarity index 99% rename from src/core/lib/json/json_writer.cc rename to src/core/util/json/json_writer.cc index fb9a49d72a6..009b31a4afc 100644 --- a/src/core/lib/json/json_writer.cc +++ b/src/core/util/json/json_writer.cc @@ -16,6 +16,8 @@ // // +#include + #include #include @@ -26,9 +28,7 @@ #include "absl/strings/string_view.h" -#include - -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/core/lib/json/json_writer.h b/src/core/util/json/json_writer.h similarity index 81% rename from src/core/lib/json/json_writer.h rename to src/core/util/json/json_writer.h index bae701ea023..e2093a53dc7 100644 --- a/src/core/lib/json/json_writer.h +++ b/src/core/util/json/json_writer.h @@ -14,14 +14,14 @@ // limitations under the License. // -#ifndef GRPC_SRC_CORE_LIB_JSON_JSON_WRITER_H -#define GRPC_SRC_CORE_LIB_JSON_JSON_WRITER_H - -#include +#ifndef GRPC_SRC_CORE_UTIL_JSON_JSON_WRITER_H +#define GRPC_SRC_CORE_UTIL_JSON_JSON_WRITER_H #include -#include "src/core/lib/json/json.h" +#include + +#include "src/core/util/json/json.h" namespace grpc_core { @@ -30,4 +30,4 @@ std::string JsonDump(const Json& json, int indent = 0); } // namespace grpc_core -#endif // GRPC_SRC_CORE_LIB_JSON_JSON_WRITER_H +#endif // GRPC_SRC_CORE_UTIL_JSON_JSON_WRITER_H diff --git a/src/core/xds/grpc/certificate_provider_store.h b/src/core/xds/grpc/certificate_provider_store.h index ffee3b0efba..f2a3b944c94 100644 --- a/src/core/xds/grpc/certificate_provider_store.h +++ b/src/core/xds/grpc/certificate_provider_store.h @@ -34,12 +34,12 @@ #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/unique_type_name.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/security/certificate_provider/certificate_provider_factory.h" #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h" #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "src/core/util/useful.h" namespace grpc_core { diff --git a/src/core/xds/grpc/file_watcher_certificate_provider_factory.h b/src/core/xds/grpc/file_watcher_certificate_provider_factory.h index 06f680148d2..0306dbe4370 100644 --- a/src/core/xds/grpc/file_watcher_certificate_provider_factory.h +++ b/src/core/xds/grpc/file_watcher_certificate_provider_factory.h @@ -29,10 +29,10 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/security/certificate_provider/certificate_provider_factory.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc_core { diff --git a/src/core/xds/grpc/xds_audit_logger_registry.h b/src/core/xds/grpc/xds_audit_logger_registry.h index ba9ad888fec..5e8ec0a2e5e 100644 --- a/src/core/xds/grpc/xds_audit_logger_registry.h +++ b/src/core/xds/grpc/xds_audit_logger_registry.h @@ -26,7 +26,7 @@ #include #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #include "src/core/xds/xds_client/xds_resource_type.h" namespace grpc_core { diff --git a/src/core/xds/grpc/xds_bootstrap_grpc.cc b/src/core/xds/grpc/xds_bootstrap_grpc.cc index e6f97cdbfeb..9ab26b38238 100644 --- a/src/core/xds/grpc/xds_bootstrap_grpc.cc +++ b/src/core/xds/grpc/xds_bootstrap_grpc.cc @@ -39,11 +39,11 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/credentials/channel_creds_registry.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" #include "src/core/util/string.h" namespace grpc_core { diff --git a/src/core/xds/grpc/xds_bootstrap_grpc.h b/src/core/xds/grpc/xds_bootstrap_grpc.h index a4a41b4e50e..00c08f9e2e2 100644 --- a/src/core/xds/grpc/xds_bootstrap_grpc.h +++ b/src/core/xds/grpc/xds_bootstrap_grpc.h @@ -31,10 +31,10 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/security/credentials/channel_creds_registry.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "src/core/xds/grpc/certificate_provider_store.h" #include "src/core/xds/grpc/xds_audit_logger_registry.h" #include "src/core/xds/grpc/xds_cluster_specifier_plugin.h" diff --git a/src/core/xds/grpc/xds_cluster.cc b/src/core/xds/grpc/xds_cluster.cc index b136ffa16c7..d7ad16ae66c 100644 --- a/src/core/xds/grpc/xds_cluster.cc +++ b/src/core/xds/grpc/xds_cluster.cc @@ -63,9 +63,9 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/matchers/matchers.h" #include "src/core/load_balancing/lb_policy_registry.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/grpc/xds_lb_policy_registry.h" diff --git a/src/core/xds/grpc/xds_cluster.h b/src/core/xds/grpc/xds_cluster.h index d680dbdb43e..5eb7fca6aa9 100644 --- a/src/core/xds/grpc/xds_cluster.h +++ b/src/core/xds/grpc/xds_cluster.h @@ -35,8 +35,8 @@ #include #include -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/outlier_detection/outlier_detection.h" +#include "src/core/util/json/json.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/grpc/xds_health_status.h" diff --git a/src/core/xds/grpc/xds_cluster_specifier_plugin.cc b/src/core/xds/grpc/xds_cluster_specifier_plugin.cc index 9b6dfb5ca7d..11a707a0d63 100644 --- a/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +++ b/src/core/xds/grpc/xds_cluster_specifier_plugin.cc @@ -33,8 +33,8 @@ #include #include -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" #include "src/proto/grpc/lookup/v1/rls_config.upb.h" #include "src/proto/grpc/lookup/v1/rls_config.upbdefs.h" diff --git a/src/core/xds/grpc/xds_cluster_specifier_plugin.h b/src/core/xds/grpc/xds_cluster_specifier_plugin.h index 0d54b6f39e4..8aa245fa125 100644 --- a/src/core/xds/grpc/xds_cluster_specifier_plugin.h +++ b/src/core/xds/grpc/xds_cluster_specifier_plugin.h @@ -28,7 +28,7 @@ #include #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #include "src/core/xds/grpc/xds_common_types.h" namespace grpc_core { diff --git a/src/core/xds/grpc/xds_common_types.cc b/src/core/xds/grpc/xds_common_types.cc index b20cf73d746..ff0a630a992 100644 --- a/src/core/xds/grpc/xds_common_types.cc +++ b/src/core/xds/grpc/xds_common_types.cc @@ -44,7 +44,7 @@ #include #include -#include "src/core/lib/json/json_reader.h" +#include "src/core/util/json/json_reader.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/xds_client/xds_client.h" diff --git a/src/core/xds/grpc/xds_common_types.h b/src/core/xds/grpc/xds_common_types.h index 1a93e166208..1285e08f936 100644 --- a/src/core/xds/grpc/xds_common_types.h +++ b/src/core/xds/grpc/xds_common_types.h @@ -31,8 +31,8 @@ #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/matchers/matchers.h" +#include "src/core/util/json/json.h" #include "src/core/xds/xds_client/xds_resource_type.h" namespace grpc_core { diff --git a/src/core/xds/grpc/xds_http_fault_filter.cc b/src/core/xds/grpc/xds_http_fault_filter.cc index d6aabcefb6d..48156bd8cc3 100644 --- a/src/core/xds/grpc/xds_http_fault_filter.cc +++ b/src/core/xds/grpc/xds_http_fault_filter.cc @@ -41,9 +41,9 @@ #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/transport/status_conversion.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/grpc/xds_http_filters.h" diff --git a/src/core/xds/grpc/xds_http_filters.h b/src/core/xds/grpc/xds_http_filters.h index 46f9c0dc968..b61690fd74d 100644 --- a/src/core/xds/grpc/xds_http_filters.h +++ b/src/core/xds/grpc/xds_http_filters.h @@ -35,8 +35,8 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/xds_client/xds_resource_type.h" diff --git a/src/core/xds/grpc/xds_http_rbac_filter.cc b/src/core/xds/grpc/xds_http_rbac_filter.cc index 05055448a7d..ee81008bd90 100644 --- a/src/core/xds/grpc/xds_http_rbac_filter.cc +++ b/src/core/xds/grpc/xds_http_rbac_filter.cc @@ -47,8 +47,8 @@ #include "src/core/ext/filters/rbac/rbac_service_config_parser.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/env.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/util/string.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_audit_logger_registry.h" diff --git a/src/core/xds/grpc/xds_http_stateful_session_filter.cc b/src/core/xds/grpc/xds_http_stateful_session_filter.cc index 279129342a8..698e1776361 100644 --- a/src/core/xds/grpc/xds_http_stateful_session_filter.cc +++ b/src/core/xds/grpc/xds_http_stateful_session_filter.cc @@ -37,8 +37,8 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/grpc/xds_http_filters.h" diff --git a/src/core/xds/grpc/xds_lb_policy_registry.h b/src/core/xds/grpc/xds_lb_policy_registry.h index 54fbf825eb3..f184b20a3d9 100644 --- a/src/core/xds/grpc/xds_lb_policy_registry.h +++ b/src/core/xds/grpc/xds_lb_policy_registry.h @@ -26,7 +26,7 @@ #include #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #include "src/core/xds/xds_client/xds_resource_type.h" namespace grpc_core { diff --git a/src/core/xds/grpc/xds_route_config.cc b/src/core/xds/grpc/xds_route_config.cc index f0c8de69739..c3ab477ac88 100644 --- a/src/core/xds/grpc/xds_route_config.cc +++ b/src/core/xds/grpc/xds_route_config.cc @@ -65,10 +65,10 @@ #include "src/core/lib/gprpp/match.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/matchers/matchers.h" #include "src/core/load_balancing/lb_policy_registry.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/util/string.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_cluster_specifier_plugin.h" diff --git a/src/core/xds/xds_client/xds_api.cc b/src/core/xds/xds_client/xds_api.cc index 15bd601d753..5c1b9418a60 100644 --- a/src/core/xds/xds_client/xds_api.cc +++ b/src/core/xds/xds_client/xds_api.cc @@ -47,7 +47,7 @@ #include #include -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/xds_client/xds_client.h" diff --git a/src/core/xds/xds_client/xds_bootstrap.h b/src/core/xds/xds_client/xds_bootstrap.h index 2d94961ec9b..cd802bbfa63 100644 --- a/src/core/xds/xds_client/xds_bootstrap.h +++ b/src/core/xds/xds_client/xds_bootstrap.h @@ -21,7 +21,7 @@ #include -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" namespace grpc_core { diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index dabe0ce79ad..b41f307daba 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -49,9 +49,9 @@ #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/load_file.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/util/json_util.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" #include "src/cpp/common/secure_auth_context.h" #include "src/cpp/server/thread_pool_interface.h" diff --git a/src/cpp/ext/csm/metadata_exchange.cc b/src/cpp/ext/csm/metadata_exchange.cc index 96b26482ae2..21abe5029eb 100644 --- a/src/cpp/ext/csm/metadata_exchange.cc +++ b/src/cpp/ext/csm/metadata_exchange.cc @@ -42,11 +42,11 @@ #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/load_file.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/telemetry/call_tracer.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_reader.h" #include "src/cpp/ext/otel/key_value_iterable.h" namespace grpc { diff --git a/src/cpp/ext/gcp/observability_config.cc b/src/cpp/ext/gcp/observability_config.cc index 2bbac8d4b47..977ced0671f 100644 --- a/src/cpp/ext/gcp/observability_config.cc +++ b/src/cpp/ext/gcp/observability_config.cc @@ -37,10 +37,10 @@ #include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/gprpp/validation_errors.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/transport/error_utils.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" namespace grpc { namespace internal { diff --git a/src/cpp/ext/gcp/observability_config.h b/src/cpp/ext/gcp/observability_config.h index 97c0b5230fe..8854f860c95 100644 --- a/src/cpp/ext/gcp/observability_config.h +++ b/src/cpp/ext/gcp/observability_config.h @@ -30,9 +30,9 @@ #include #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc { namespace internal { diff --git a/src/cpp/ext/gcp/observability_logging_sink.cc b/src/cpp/ext/gcp/observability_logging_sink.cc index e7f71d4f0e8..27cbdb78c7d 100644 --- a/src/cpp/ext/gcp/observability_logging_sink.cc +++ b/src/cpp/ext/gcp/observability_logging_sink.cc @@ -46,7 +46,7 @@ #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/uuid_v4.h" -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #include "src/cpp/ext/filters/census/open_census_call_tracer.h" // IWYU pragma: no_include "google/protobuf/struct.pb.h" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index d79b4c9f96c..6db04ed62fe 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -592,10 +592,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/iomgr/wakeup_fd_nospecial.cc', 'src/core/lib/iomgr/wakeup_fd_pipe.cc', 'src/core/lib/iomgr/wakeup_fd_posix.cc', - 'src/core/lib/json/json_object_loader.cc', - 'src/core/lib/json/json_reader.cc', - 'src/core/lib/json/json_util.cc', - 'src/core/lib/json/json_writer.cc', 'src/core/lib/matchers/matchers.cc', 'src/core/lib/promise/activity.cc', 'src/core/lib/promise/party.cc', @@ -812,6 +808,10 @@ CORE_SOURCE_FILES = [ 'src/core/util/android/log.cc', 'src/core/util/atm.cc', 'src/core/util/iphone/cpu.cc', + 'src/core/util/json/json_object_loader.cc', + 'src/core/util/json/json_reader.cc', + 'src/core/util/json/json_util.cc', + 'src/core/util/json/json_writer.cc', 'src/core/util/linux/cpu.cc', 'src/core/util/linux/log.cc', 'src/core/util/log.cc', diff --git a/test/core/channelz/channel_trace_test.cc b/test/core/channelz/channel_trace_test.cc index 6f99e22b38c..e3fab992eb8 100644 --- a/test/core/channelz/channel_trace_test.cc +++ b/test/core/channelz/channel_trace_test.cc @@ -36,8 +36,8 @@ #include "src/core/channelz/channelz.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/exec_ctx.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "test/core/test_util/test_config.h" #include "test/cpp/util/channel_trace_proto_helper.h" diff --git a/test/core/channelz/channelz_test.cc b/test/core/channelz/channelz_test.cc index 7c591711c6b..06d11c08b73 100644 --- a/test/core/channelz/channelz_test.cc +++ b/test/core/channelz/channelz_test.cc @@ -44,10 +44,10 @@ #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/notification.h" #include "src/core/lib/iomgr/exec_ctx.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/surface/channel.h" #include "src/core/server/server.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" #include "src/core/util/useful.h" #include "test/core/event_engine/event_engine_test_utils.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/end2end/tests/retry_lb_drop.cc b/test/core/end2end/tests/retry_lb_drop.cc index 498df65c2de..6a9e4b413b0 100644 --- a/test/core/end2end/tests/retry_lb_drop.cc +++ b/test/core/end2end/tests/retry_lb_drop.cc @@ -35,9 +35,9 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy_factory.h" +#include "src/core/util/json/json.h" #include "test/core/end2end/end2end_tests.h" #include "test/core/test_util/test_lb_policies.h" diff --git a/test/core/ext/filters/rbac/rbac_service_config_parser_test.cc b/test/core/ext/filters/rbac/rbac_service_config_parser_test.cc index 61ceeeb5382..0d5868881ec 100644 --- a/test/core/ext/filters/rbac/rbac_service_config_parser_test.cc +++ b/test/core/ext/filters/rbac/rbac_service_config_parser_test.cc @@ -29,10 +29,10 @@ #include #include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/authorization/audit_logging.h" #include "src/core/service_config/service_config.h" #include "src/core/service_config/service_config_impl.h" +#include "src/core/util/json/json_writer.h" #include "test/core/test_util/test_config.h" namespace grpc_core { diff --git a/test/core/json/fuzzer.cc b/test/core/json/fuzzer.cc index 557073d5744..1ae8ad25429 100644 --- a/test/core/json/fuzzer.cc +++ b/test/core/json/fuzzer.cc @@ -26,8 +26,8 @@ #include #include -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" bool squelch = true; bool leak_check = true; diff --git a/test/core/json/json_object_loader_test.cc b/test/core/json/json_object_loader_test.cc index 0f3c864a689..6ea9b7b0598 100644 --- a/test/core/json/json_object_loader_test.cc +++ b/test/core/json/json_object_loader_test.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "src/core/lib/json/json_object_loader.h" +#include "src/core/util/json/json_object_loader.h" #include @@ -24,8 +24,8 @@ #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" namespace grpc_core { namespace { diff --git a/test/core/json/json_test.cc b/test/core/json/json_test.cc index c076ff751ed..9cd1264c079 100644 --- a/test/core/json/json_test.cc +++ b/test/core/json/json_test.cc @@ -14,7 +14,7 @@ // limitations under the License. // -#include "src/core/lib/json/json.h" +#include "src/core/util/json/json.h" #include @@ -31,8 +31,8 @@ #include -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" #include "test/core/test_util/test_config.h" namespace grpc_core { diff --git a/test/core/load_balancing/lb_policy_test_lib.h b/test/core/load_balancing/lb_policy_test_lib.h index 46e0e7d4fec..aa7ea8c9ae8 100644 --- a/test/core/load_balancing/lb_policy_test_lib.h +++ b/test/core/load_balancing/lb_policy_test_lib.h @@ -72,7 +72,6 @@ #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" #include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/uri/uri_parser.h" @@ -85,6 +84,7 @@ #include "src/core/load_balancing/subchannel_interface.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/service_config/service_config_call_data.h" +#include "src/core/util/json/json.h" #include "test/core/event_engine/event_engine_test_utils.h" #include "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.h" #include "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.pb.h" diff --git a/test/core/load_balancing/outlier_detection_test.cc b/test/core/load_balancing/outlier_detection_test.cc index db425e666fa..2a809d485f7 100644 --- a/test/core/load_balancing/outlier_detection_test.cc +++ b/test/core/load_balancing/outlier_detection_test.cc @@ -38,10 +38,10 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/backend_metric_data.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" #include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/load_balancing/pick_first_test.cc b/test/core/load_balancing/pick_first_test.cc index 469af9c261e..413c58be6ff 100644 --- a/test/core/load_balancing/pick_first_test.cc +++ b/test/core/load_balancing/pick_first_test.cc @@ -44,10 +44,10 @@ #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/iomgr/exec_ctx.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/telemetry/metrics.h" +#include "src/core/util/json/json.h" #include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/test_util/fake_stats_plugin.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/load_balancing/ring_hash_test.cc b/test/core/load_balancing/ring_hash_test.cc index 5391537908a..9420834d51f 100644 --- a/test/core/load_balancing/ring_hash_test.cc +++ b/test/core/load_balancing/ring_hash_test.cc @@ -36,9 +36,9 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/xxhash_inline.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" #include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/load_balancing/weighted_round_robin_test.cc b/test/core/load_balancing/weighted_round_robin_test.cc index 58a3be1fa14..d680a1c3e37 100644 --- a/test/core/load_balancing/weighted_round_robin_test.cc +++ b/test/core/load_balancing/weighted_round_robin_test.cc @@ -44,12 +44,12 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/load_balancing/backend_metric_data.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/weighted_target/weighted_target.h" #include "src/core/resolver/endpoint_addresses.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/test_util/fake_stats_plugin.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/load_balancing/xds_override_host_test.cc b/test/core/load_balancing/xds_override_host_test.cc index e75581f720e..989545290a6 100644 --- a/test/core/load_balancing/xds_override_host_test.cc +++ b/test/core/load_balancing/xds_override_host_test.cc @@ -41,10 +41,10 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" -#include "src/core/lib/json/json.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/xds/xds_dependency_manager.h" +#include "src/core/util/json/json.h" #include "src/core/xds/grpc/xds_health_status.h" #include "test/core/load_balancing/lb_policy_test_lib.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index d6eb7c74d0f..85ef1c9ee22 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -51,7 +51,6 @@ #include "src/core/lib/http/httpcli.h" #include "src/core/lib/http/httpcli_ssl_credentials.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/promise/exec_ctx_wakeup_scheduler.h" #include "src/core/lib/promise/promise.h" #include "src/core/lib/promise/seq.h" @@ -71,6 +70,7 @@ #include "src/core/lib/security/transport/auth_filters.h" #include "src/core/lib/transport/error_utils.h" #include "src/core/lib/uri/uri_parser.h" +#include "src/core/util/json/json_reader.h" #include "src/core/util/string.h" #include "src/core/util/tmpfile.h" #include "test/core/test_util/test_config.h" diff --git a/test/core/security/grpc_audit_logging_test.cc b/test/core/security/grpc_audit_logging_test.cc index 2df0a12b3b9..415a6089fa9 100644 --- a/test/core/security/grpc_audit_logging_test.cc +++ b/test/core/security/grpc_audit_logging_test.cc @@ -31,10 +31,10 @@ #include #include -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/authorization/audit_logging.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" #include "test/core/test_util/test_config.h" #include "test/core/test_util/tls_utils.h" diff --git a/test/core/security/grpc_authorization_engine_test.cc b/test/core/security/grpc_authorization_engine_test.cc index 25d3402f4cf..03f6b7d6a0d 100644 --- a/test/core/security/grpc_authorization_engine_test.cc +++ b/test/core/security/grpc_authorization_engine_test.cc @@ -23,8 +23,8 @@ #include #include -#include "src/core/lib/json/json.h" #include "src/core/lib/security/authorization/audit_logging.h" +#include "src/core/util/json/json.h" #include "test/core/test_util/audit_logging_utils.h" #include "test/core/test_util/evaluate_args_test_util.h" diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc index a5269885891..44bade31338 100644 --- a/test/core/security/json_token_test.cc +++ b/test/core/security/json_token_test.cc @@ -32,10 +32,10 @@ #include #include "src/core/lib/gprpp/crash.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" #include "test/core/test_util/test_config.h" using grpc_core::Json; diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index 738667f34d7..5387edf9451 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -32,8 +32,8 @@ #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/http/httpcli.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/credentials/jwt/json_token.h" +#include "src/core/util/json/json_reader.h" #include "test/core/test_util/test_config.h" using grpc_core::Json; diff --git a/test/core/security/rbac_translator_test.cc b/test/core/security/rbac_translator_test.cc index ba6a11e9a1c..49e9c21a10a 100644 --- a/test/core/security/rbac_translator_test.cc +++ b/test/core/security/rbac_translator_test.cc @@ -25,9 +25,9 @@ #include #include "src/core/lib/gprpp/crash.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/authorization/audit_logging.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "test/core/test_util/test_config.h" namespace grpc_core { diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc index 1d7e8596a0e..5a322f39fa8 100644 --- a/test/core/security/verify_jwt.cc +++ b/test/core/security/verify_jwt.cc @@ -31,8 +31,8 @@ #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/credentials/jwt/jwt_verifier.h" +#include "src/core/util/json/json_writer.h" #include "test/core/test_util/cmdline.h" typedef struct { diff --git a/test/core/service_config/service_config_test.cc b/test/core/service_config/service_config_test.cc index 515adebe2fa..d20b92ae55c 100644 --- a/test/core/service_config/service_config_test.cc +++ b/test/core/service_config/service_config_test.cc @@ -34,11 +34,11 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/service_config/service_config_impl.h" #include "src/core/service_config/service_config_parser.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" #include "test/core/test_util/test_config.h" namespace grpc_core { diff --git a/test/core/test_util/audit_logging_utils.cc b/test/core/test_util/audit_logging_utils.cc index e6c3f94292a..492cbb3312d 100644 --- a/test/core/test_util/audit_logging_utils.cc +++ b/test/core/test_util/audit_logging_utils.cc @@ -28,7 +28,7 @@ #include #include -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json_writer.h" namespace grpc_core { namespace testing { diff --git a/test/core/test_util/test_lb_policies.cc b/test/core/test_util/test_lb_policies.cc index 36e968cfc2e..c21301ad08b 100644 --- a/test/core/test_util/test_lb_policies.cc +++ b/test/core/test_util/test_lb_policies.cc @@ -40,8 +40,6 @@ #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolved_address.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_util.h" #include "src/core/lib/uri/uri_parser.h" #include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/lb_policy.h" @@ -49,6 +47,8 @@ #include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/oob_backend_metric.h" #include "src/core/load_balancing/subchannel_interface.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_util.h" namespace grpc_core { diff --git a/test/core/xds/file_watcher_certificate_provider_factory_test.cc b/test/core/xds/file_watcher_certificate_provider_factory_test.cc index 609c43015b9..f0eda5d3f55 100644 --- a/test/core/xds/file_watcher_certificate_provider_factory_test.cc +++ b/test/core/xds/file_watcher_certificate_provider_factory_test.cc @@ -27,7 +27,7 @@ #include -#include "src/core/lib/json/json_reader.h" +#include "src/core/util/json/json_reader.h" #include "test/core/test_util/test_config.h" namespace grpc_core { diff --git a/test/core/xds/xds_audit_logger_registry_test.cc b/test/core/xds/xds_audit_logger_registry_test.cc index 071e9c11ecc..15089f371ac 100644 --- a/test/core/xds/xds_audit_logger_registry_test.cc +++ b/test/core/xds/xds_audit_logger_registry_test.cc @@ -37,9 +37,9 @@ #include #include "src/core/lib/gprpp/crash.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/security/authorization/audit_logging.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/proto/grpc/testing/xds/v3/audit_logger_stream.pb.h" #include "src/proto/grpc/testing/xds/v3/extension.pb.h" diff --git a/test/core/xds/xds_bootstrap_test.cc b/test/core/xds/xds_bootstrap_test.cc index 295da0298fb..529bcbeef1e 100644 --- a/test/core/xds/xds_bootstrap_test.cc +++ b/test/core/xds/xds_bootstrap_test.cc @@ -39,13 +39,13 @@ #include "src/core/lib/gprpp/env.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_reader.h" #include "src/core/lib/security/certificate_provider/certificate_provider_factory.h" #include "src/core/lib/security/credentials/channel_creds_registry.h" #include "src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_reader.h" #include "src/core/util/tmpfile.h" #include "src/core/xds/grpc/certificate_provider_store.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" diff --git a/test/core/xds/xds_client_test.cc b/test/core/xds/xds_client_test.cc index 033b00e8a3f..f0e0022988e 100644 --- a/test/core/xds/xds_client_test.cc +++ b/test/core/xds/xds_client_test.cc @@ -51,11 +51,11 @@ #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/match.h" #include "src/core/lib/gprpp/sync.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/xds_client/xds_bootstrap.h" #include "src/core/xds/xds_client/xds_resource_type_impl.h" #include "src/proto/grpc/testing/xds/v3/base.pb.h" diff --git a/test/core/xds/xds_cluster_resource_type_test.cc b/test/core/xds/xds_cluster_resource_type_test.cc index e8959c173b7..34fce7801cf 100644 --- a/test/core/xds/xds_cluster_resource_type_test.cc +++ b/test/core/xds/xds_cluster_resource_type_test.cc @@ -40,9 +40,9 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/load_balancing/outlier_detection/outlier_detection.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_cluster.h" #include "src/core/xds/grpc/xds_common_types.h" diff --git a/test/core/xds/xds_common_types_test.cc b/test/core/xds/xds_common_types_test.cc index 3453143f69c..a83514a89a7 100644 --- a/test/core/xds/xds_common_types_test.cc +++ b/test/core/xds/xds_common_types_test.cc @@ -43,8 +43,8 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/matchers/matchers.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/upb_utils.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/xds_client/xds_bootstrap.h" diff --git a/test/core/xds/xds_http_filters_test.cc b/test/core/xds/xds_http_filters_test.cc index 0a8bb43e41f..dd3dc0943bd 100644 --- a/test/core/xds/xds_http_filters_test.cc +++ b/test/core/xds/xds_http_filters_test.cc @@ -48,7 +48,7 @@ #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/xds_client/xds_client.h" #include "src/proto/grpc/testing/xds/v3/address.pb.h" diff --git a/test/core/xds/xds_lb_policy_registry_test.cc b/test/core/xds/xds_lb_policy_registry_test.cc index 9f95574947e..54053afe0de 100644 --- a/test/core/xds/xds_lb_policy_registry_test.cc +++ b/test/core/xds/xds_lb_policy_registry_test.cc @@ -39,9 +39,9 @@ #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/validation_errors.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy_factory.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/proto/grpc/testing/xds/v3/client_side_weighted_round_robin.pb.h" #include "src/proto/grpc/testing/xds/v3/cluster.pb.h" diff --git a/test/core/xds/xds_listener_resource_type_test.cc b/test/core/xds/xds_listener_resource_type_test.cc index e48328284fd..6db6680c8ae 100644 --- a/test/core/xds/xds_listener_resource_type_test.cc +++ b/test/core/xds/xds_listener_resource_type_test.cc @@ -44,8 +44,8 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_common_types.h" #include "src/core/xds/grpc/xds_listener.h" diff --git a/test/core/xds/xds_route_config_resource_type_test.cc b/test/core/xds/xds_route_config_resource_type_test.cc index 0585c5798e6..d28889e61bb 100644 --- a/test/core/xds/xds_route_config_resource_type_test.cc +++ b/test/core/xds/xds_route_config_resource_type_test.cc @@ -49,8 +49,8 @@ #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json_writer.h" #include "src/core/lib/matchers/matchers.h" +#include "src/core/util/json/json_writer.h" #include "src/core/xds/grpc/xds_bootstrap_grpc.h" #include "src/core/xds/grpc/xds_route_config.h" #include "src/core/xds/xds_client/xds_bootstrap.h" diff --git a/test/cpp/ext/gcp/observability_config_test.cc b/test/cpp/ext/gcp/observability_config_test.cc index 0a1f91abc38..4a586ba2175 100644 --- a/test/cpp/ext/gcp/observability_config_test.cc +++ b/test/cpp/ext/gcp/observability_config_test.cc @@ -23,7 +23,7 @@ #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/gprpp/env.h" -#include "src/core/lib/json/json_reader.h" +#include "src/core/util/json/json_reader.h" #include "src/core/util/tmpfile.h" #include "test/core/test_util/test_config.h" diff --git a/test/cpp/ext/gcp/observability_logging_sink_test.cc b/test/cpp/ext/gcp/observability_logging_sink_test.cc index e088e4d9c6d..2349fe6b60c 100644 --- a/test/cpp/ext/gcp/observability_logging_sink_test.cc +++ b/test/cpp/ext/gcp/observability_logging_sink_test.cc @@ -22,7 +22,7 @@ #include "google/protobuf/text_format.h" #include "gtest/gtest.h" -#include "src/core/lib/json/json_reader.h" +#include "src/core/util/json/json_reader.h" #include "test/core/test_util/test_config.h" namespace grpc { diff --git a/test/cpp/interop/rpc_behavior_lb_policy.cc b/test/cpp/interop/rpc_behavior_lb_policy.cc index 8240000aa63..b065af99ad9 100644 --- a/test/cpp/interop/rpc_behavior_lb_policy.cc +++ b/test/cpp/interop/rpc_behavior_lb_policy.cc @@ -24,9 +24,9 @@ #include #include "src/core/lib/iomgr/pollset_set.h" -#include "src/core/lib/json/json_args.h" -#include "src/core/lib/json/json_object_loader.h" #include "src/core/load_balancing/delegating_helper.h" +#include "src/core/util/json/json_args.h" +#include "src/core/util/json/json_object_loader.h" namespace grpc { namespace testing { diff --git a/test/cpp/util/channel_trace_proto_helper.cc b/test/cpp/util/channel_trace_proto_helper.cc index 37a9898007e..677862fbf12 100644 --- a/test/cpp/util/channel_trace_proto_helper.cc +++ b/test/cpp/util/channel_trace_proto_helper.cc @@ -28,9 +28,9 @@ #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/iomgr/error.h" -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_reader.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_reader.h" +#include "src/core/util/json/json_writer.h" #include "src/proto/grpc/channelz/channelz.pb.h" namespace grpc { diff --git a/test/cpp/util/channelz_sampler.cc b/test/cpp/util/channelz_sampler.cc index 2619a5481d1..d689319f52c 100644 --- a/test/cpp/util/channelz_sampler.cc +++ b/test/cpp/util/channelz_sampler.cc @@ -46,8 +46,8 @@ #include #include -#include "src/core/lib/json/json.h" -#include "src/core/lib/json/json_writer.h" +#include "src/core/util/json/json.h" +#include "src/core/util/json/json_writer.h" #include "src/cpp/server/channelz/channelz_service.h" #include "src/proto/grpc/channelz/channelz.pb.h" #include "test/core/test_util/test_config.h" diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 180bf607854..319f45d8c2b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -2472,17 +2472,6 @@ src/core/lib/iomgr/wakeup_fd_pipe.cc \ src/core/lib/iomgr/wakeup_fd_pipe.h \ src/core/lib/iomgr/wakeup_fd_posix.cc \ src/core/lib/iomgr/wakeup_fd_posix.h \ -src/core/lib/json/json.h \ -src/core/lib/json/json_args.h \ -src/core/lib/json/json_channel_args.h \ -src/core/lib/json/json_object_loader.cc \ -src/core/lib/json/json_object_loader.h \ -src/core/lib/json/json_reader.cc \ -src/core/lib/json/json_reader.h \ -src/core/lib/json/json_util.cc \ -src/core/lib/json/json_util.h \ -src/core/lib/json/json_writer.cc \ -src/core/lib/json/json_writer.h \ src/core/lib/matchers/matchers.cc \ src/core/lib/matchers/matchers.h \ src/core/lib/promise/activity.cc \ @@ -2930,6 +2919,17 @@ 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/json/json.h \ +src/core/util/json/json_args.h \ +src/core/util/json/json_channel_args.h \ +src/core/util/json/json_object_loader.cc \ +src/core/util/json/json_object_loader.h \ +src/core/util/json/json_reader.cc \ +src/core/util/json/json_reader.h \ +src/core/util/json/json_util.cc \ +src/core/util/json/json_util.h \ +src/core/util/json/json_writer.cc \ +src/core/util/json/json_writer.h \ src/core/util/linux/cpu.cc \ src/core/util/linux/log.cc \ src/core/util/log.cc \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 74d2f0c7e17..28cfb2530bf 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -2246,17 +2246,6 @@ src/core/lib/iomgr/wakeup_fd_pipe.cc \ src/core/lib/iomgr/wakeup_fd_pipe.h \ src/core/lib/iomgr/wakeup_fd_posix.cc \ src/core/lib/iomgr/wakeup_fd_posix.h \ -src/core/lib/json/json.h \ -src/core/lib/json/json_args.h \ -src/core/lib/json/json_channel_args.h \ -src/core/lib/json/json_object_loader.cc \ -src/core/lib/json/json_object_loader.h \ -src/core/lib/json/json_reader.cc \ -src/core/lib/json/json_reader.h \ -src/core/lib/json/json_util.cc \ -src/core/lib/json/json_util.h \ -src/core/lib/json/json_writer.cc \ -src/core/lib/json/json_writer.h \ src/core/lib/matchers/matchers.cc \ src/core/lib/matchers/matchers.h \ src/core/lib/promise/activity.cc \ @@ -2712,6 +2701,17 @@ 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/json/json.h \ +src/core/util/json/json_args.h \ +src/core/util/json/json_channel_args.h \ +src/core/util/json/json_object_loader.cc \ +src/core/util/json/json_object_loader.h \ +src/core/util/json/json_reader.cc \ +src/core/util/json/json_reader.h \ +src/core/util/json/json_util.cc \ +src/core/util/json/json_util.h \ +src/core/util/json/json_writer.cc \ +src/core/util/json/json_writer.h \ src/core/util/linux/cpu.cc \ src/core/util/linux/log.cc \ src/core/util/log.cc \ From d1487285885c02798949f44f17925c3467c131d6 Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap Date: Thu, 23 May 2024 20:45:21 -0700 Subject: [PATCH 17/20] Use LOG_IF(FATAL, ...) instead of gpr_assertion_failed() in interop_client.cc gpr_assertion_failed() will be deprecated soon. LOG_IF(FATAL, condition) will terminate if condition is true. PiperOrigin-RevId: 636770885 --- test/cpp/interop/interop_client.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index d6b2118fe25..165e46da54c 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -35,7 +35,6 @@ #include #include -#include #include #include #include @@ -997,9 +996,7 @@ bool InteropClient::DoOrcaPerRpc() { CHECK(report.has_value()); CHECK(report->has_value()); auto comparison_result = OrcaLoadReportsDiff(report->value(), *orca_report); - if (comparison_result.has_value()) { - gpr_assertion_failed(__FILE__, __LINE__, comparison_result->c_str()); - } + LOG_IF(FATAL, comparison_result.has_value()) << comparison_result->c_str(); CHECK(!load_report_tracker_.GetNextLoadReport().has_value()); VLOG(2) << "orca per rpc successfully finished"; return true; From 0ed095093ce10a8a16460f3e4ddc3e679ea38576 Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Thu, 23 May 2024 23:12:17 -0700 Subject: [PATCH 18/20] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36703) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future. We have the following mapping 1. gpr_log(GPR_INFO,...) -> LOG(INFO) 2. gpr_log(GPR_ERROR,...) -> LOG(ERROR) 3. gpr_log(GPR_DEBUG,...) -> VLOG(2) Reviewers need to check : 1. If the above mapping is correct. 2. The content of the log is as before. gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected. Closes #36703 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36703 from tanvi-jagtap:test_core_gpr_log_01 26c4307b087943a0bec5e591964e3f705a7058ad PiperOrigin-RevId: 636801504 --- .../security/alts_security_connector_test.cc | 11 ++- test/core/security/credentials_test.cc | 17 ++-- test/core/security/json_token_test.cc | 5 +- test/core/security/oauth2_utils.cc | 6 +- test/core/slice/percent_encoding_test.cc | 17 ++-- test/core/slice/slice_string_helpers_test.cc | 6 +- test/core/surface/byte_buffer_reader_test.cc | 22 ++--- ...num_external_connectivity_watchers_test.cc | 6 +- .../surface/sequential_connectivity_test.cc | 6 +- test/core/surface/server_test.cc | 4 +- test/core/test_util/cmdline_test.cc | 5 +- test/core/test_util/fake_stats_plugin.h | 94 +++++++++--------- .../core/test_util/fake_udp_and_tcp_server.cc | 97 ++++++++----------- test/core/test_util/fuzzer_corpus_test.cc | 9 +- test/core/test_util/grpc_profiler.cc | 14 ++- test/core/test_util/histogram_test.cc | 15 ++- test/core/test_util/port_server_client.cc | 9 +- test/core/test_util/stack_tracer_test.cc | 5 +- test/core/test_util/test_lb_policies.cc | 11 +-- test/core/test_util/test_tcp_server.cc | 4 +- .../chaotic_good/chaotic_good_server_test.cc | 4 +- .../transport/chaotic_good/frame_fuzzer.cc | 9 +- .../core/transport/chttp2/bin_decoder_test.cc | 6 +- .../core/transport/chttp2/bin_encoder_test.cc | 15 +-- .../core/transport/chttp2/hpack_utils_test.cc | 5 +- ...ak_with_queued_flow_control_update_test.cc | 45 ++++----- test/core/transport/chttp2/varint_test.cc | 5 +- test/core/transport/test_suite/test.h | 9 +- .../fake_handshaker_server_main.cc | 5 +- test/core/tsi/transport_security_test.cc | 4 +- test/core/util/env_test.cc | 9 +- test/core/xds/xds_transport_fake.cc | 7 +- 32 files changed, 217 insertions(+), 269 deletions(-) diff --git a/test/core/security/alts_security_connector_test.cc b/test/core/security/alts_security_connector_test.cc index 65ebefdd6a6..3fa83df1e65 100644 --- a/test/core/security/alts_security_connector_test.cc +++ b/test/core/security/alts_security_connector_test.cc @@ -24,9 +24,10 @@ #include +#include "absl/log/log.h" + #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/context/security_context.h" @@ -144,13 +145,13 @@ static bool test_identity(const grpc_auth_context* ctx, prop = grpc_auth_property_iterator_next(&it); EXPECT_NE(prop, nullptr); if (strcmp(prop->name, expected_property_name) != 0) { - gpr_log(GPR_ERROR, "Expected peer identity property name %s and got %s.", - expected_property_name, prop->name); + LOG(ERROR) << "Expected peer identity property name " + << expected_property_name << " and got " << prop->name; return false; } if (strncmp(prop->value, expected_identity, prop->value_length) != 0) { - gpr_log(GPR_ERROR, "Expected peer identity %s and got %s.", - expected_identity, prop->value); + LOG(ERROR) << "Expected peer identity " << expected_identity << " and got " + << prop->value; return false; } return true; diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 85ef1c9ee22..35e1aad2be8 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -495,9 +494,8 @@ class RequestMetadataState : public RefCounted { }; void CheckRequestMetadata(grpc_error_handle error) { - gpr_log(GPR_INFO, "expected_error: %s", - StatusToString(expected_error_).c_str()); - gpr_log(GPR_INFO, "actual_error: %s", StatusToString(error).c_str()); + LOG(INFO) << "expected_error: " << StatusToString(expected_error_); + LOG(INFO) << "actual_error: " << StatusToString(error); if (expected_error_.ok()) { CHECK_OK(error); } else { @@ -511,8 +509,8 @@ class RequestMetadataState : public RefCounted { } md_.Remove(HttpAuthorityMetadata()); md_.Remove(HttpPathMetadata()); - gpr_log(GPR_INFO, "expected metadata: %s", expected_.c_str()); - gpr_log(GPR_INFO, "actual metadata: %s", md_.DebugString().c_str()); + LOG(INFO) << "expected metadata: " << expected_; + LOG(INFO) << "actual metadata: " << md_.DebugString(); } grpc_error_handle expected_error_; @@ -1011,8 +1009,7 @@ void assert_query_parameters(const URI& uri, absl::string_view expected_key, const auto it = uri.query_parameter_map().find(expected_key); CHECK(it != uri.query_parameter_map().end()); if (it->second != expected_val) { - gpr_log(GPR_ERROR, "%s!=%s", std::string(it->second).c_str(), - std::string(expected_val).c_str()); + LOG(ERROR) << it->second << "!=" << expected_val; } CHECK(it->second == expected_val); } @@ -1028,7 +1025,7 @@ void validate_sts_token_http_request(const grpc_http_request* request, absl::StrFormat("%s?%s", test_sts_endpoint_url, body); absl::StatusOr url = URI::Parse(get_url_equivalent); if (!url.ok()) { - gpr_log(GPR_ERROR, "%s", url.status().ToString().c_str()); + LOG(ERROR) << url.status(); CHECK_OK(url); } assert_query_parameters(*url, "resource", "resource"); @@ -2115,7 +2112,7 @@ void validate_external_account_creds_token_exchage_request( absl::StrFormat("%s?%s", "https://foo.com:5555/token", body); absl::StatusOr uri = URI::Parse(get_url_equivalent); if (!uri.ok()) { - gpr_log(GPR_ERROR, "%s", uri.status().ToString().c_str()); + LOG(ERROR) << uri.status().ToString(); CHECK_OK(uri); } assert_query_parameters(*uri, "audience", "audience"); diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc index 44bade31338..95e01826c57 100644 --- a/test/core/security/json_token_test.cc +++ b/test/core/security/json_token_test.cc @@ -23,13 +23,13 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/escaping.h" #include #include #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h" @@ -220,8 +220,7 @@ static Json parse_json_part_from_jwt(const char* str, size_t len) { EXPECT_FALSE(decoded.empty()); auto json = grpc_core::JsonParse(decoded); if (!json.ok()) { - gpr_log(GPR_ERROR, "JSON parse error: %s", - json.status().ToString().c_str()); + LOG(ERROR) << "JSON parse error: " << json.status().ToString(); return Json(); } return std::move(*json); diff --git a/test/core/security/oauth2_utils.cc b/test/core/security/oauth2_utils.cc index a23c7b4d5a1..9bc6845db86 100644 --- a/test/core/security/oauth2_utils.cc +++ b/test/core/security/oauth2_utils.cc @@ -20,12 +20,13 @@ #include +#include "absl/log/log.h" + #include #include #include #include #include -#include #include #include @@ -74,8 +75,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials( [&is_done, &done, &token, &initial_metadata](absl::Status result) { is_done = true; if (!result.ok()) { - gpr_log(GPR_ERROR, "Fetching token failed: %s", - result.ToString().c_str()); + LOG(ERROR) << "Fetching token failed: " << result; } else { std::string buffer; token = gpr_strdup( diff --git a/test/core/slice/percent_encoding_test.cc b/test/core/slice/percent_encoding_test.cc index 891bfd9cd0d..6d3534e539e 100644 --- a/test/core/slice/percent_encoding_test.cc +++ b/test/core/slice/percent_encoding_test.cc @@ -23,10 +23,10 @@ #include #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include -#include #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/util/string.h" @@ -46,7 +46,7 @@ static void test_vector(const char* raw, size_t raw_length, const char* encoded, char* raw_msg = gpr_dump(raw, raw_length, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* encoded_msg = gpr_dump(encoded, encoded_length, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_DEBUG, "Trial:\nraw = %s\nencoded = %s", raw_msg, encoded_msg); + VLOG(2) << "Trial:\nraw = " << raw_msg << "\nencoded = " << encoded_msg; gpr_free(raw_msg); gpr_free(encoded_msg); @@ -61,10 +61,8 @@ static void test_vector(const char* raw, size_t raw_length, const char* encoded, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* encoded2raw_permissive_msg = grpc_dump_slice( encoded2raw_permissive_slice.c_slice(), GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_DEBUG, - "Result:\nraw2encoded = %s\nencoded2raw_permissive " - "= %s", - raw2encoded_msg, encoded2raw_permissive_msg); + VLOG(2) << "Result:\nraw2encoded = " << raw2encoded_msg + << "\nencoded2raw_permissive = " << encoded2raw_permissive_msg; gpr_free(raw2encoded_msg); gpr_free(encoded2raw_permissive_msg); @@ -81,8 +79,8 @@ static void test_nonconformant_vector(const char* encoded, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* encoded_msg = gpr_dump(encoded, encoded_length, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_DEBUG, "Trial:\nraw = %s\nencoded = %s", permissive_unencoded_msg, - encoded_msg); + VLOG(2) << "Trial:\nraw = " << permissive_unencoded_msg + << "\nencoded = " << encoded_msg; gpr_free(permissive_unencoded_msg); gpr_free(encoded_msg); @@ -95,8 +93,7 @@ static void test_nonconformant_vector(const char* encoded, char* encoded2raw_permissive_msg = grpc_dump_slice( encoded2raw_permissive_slice.c_slice(), GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_DEBUG, "Result:\nencoded2raw_permissive = %s", - encoded2raw_permissive_msg); + VLOG(2) << "Result:\nencoded2raw_permissive = " << encoded2raw_permissive_msg; gpr_free(encoded2raw_permissive_msg); ASSERT_EQ(permissive_unencoded_slice, encoded2raw_permissive_slice); diff --git a/test/core/slice/slice_string_helpers_test.cc b/test/core/slice/slice_string_helpers_test.cc index 587548099f0..a158a382221 100644 --- a/test/core/slice/slice_string_helpers_test.cc +++ b/test/core/slice/slice_string_helpers_test.cc @@ -20,15 +20,13 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include -#include #include "src/core/util/string.h" -#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x) - static void expect_slice_dump(grpc_slice slice, uint32_t flags, const char* result) { char* got = grpc_dump_slice(slice, flags); @@ -46,7 +44,7 @@ TEST(SliceStringHelpersTest, DumpSlice) { "Victory Mansions, though not quickly enough to prevent a swirl of " "gritty dust from entering along with him."; - LOG_TEST_NAME("test_dump_slice"); + LOG(INFO) << "test_dump_slice"; expect_slice_dump(grpc_slice_from_copied_string(text), GPR_DUMP_ASCII, text); expect_slice_dump(grpc_slice_from_copied_string(long_text), GPR_DUMP_ASCII, diff --git a/test/core/surface/byte_buffer_reader_test.cc b/test/core/surface/byte_buffer_reader_test.cc index 7dfc79beb60..0f0ba7cec07 100644 --- a/test/core/surface/byte_buffer_reader_test.cc +++ b/test/core/surface/byte_buffer_reader_test.cc @@ -20,6 +20,7 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include @@ -27,12 +28,9 @@ #include #include #include -#include #include "test/core/test_util/test_config.h" -#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) - TEST(GrpcByteBufferReaderTest, TestReadOneSlice) { grpc_slice slice; grpc_byte_buffer* buffer; @@ -40,7 +38,7 @@ TEST(GrpcByteBufferReaderTest, TestReadOneSlice) { grpc_slice first_slice, second_slice; int first_code, second_code; - LOG_TEST("test_read_one_slice"); + LOG(INFO) << "test_read_one_slice"; slice = grpc_slice_from_copied_string("test"); buffer = grpc_raw_byte_buffer_create(&slice, 1); grpc_slice_unref(slice); @@ -62,7 +60,7 @@ TEST(GrpcByteBufferReaderTest, TestReadOneSliceMalloc) { grpc_slice first_slice, second_slice; int first_code, second_code; - LOG_TEST("test_read_one_slice_malloc"); + LOG(INFO) << "test_read_one_slice_malloc"; slice = grpc_slice_malloc(4); memcpy(GRPC_SLICE_START_PTR(slice), "test", 4); buffer = grpc_raw_byte_buffer_create(&slice, 1); @@ -85,7 +83,7 @@ TEST(GrpcByteBufferReaderTest, TestReadNoneCompressedSlice) { grpc_slice first_slice, second_slice; int first_code, second_code; - LOG_TEST("test_read_none_compressed_slice"); + LOG(INFO) << "test_read_none_compressed_slice"; slice = grpc_slice_from_copied_string("test"); buffer = grpc_raw_byte_buffer_create(&slice, 1); grpc_slice_unref(slice); @@ -108,7 +106,7 @@ TEST(GrpcByteBufferReaderTest, TestPeekOneSlice) { grpc_slice* second_slice; int first_code, second_code; - LOG_TEST("test_peek_one_slice"); + LOG(INFO) << "test_peek_one_slice"; slice = grpc_slice_from_copied_string("test"); buffer = grpc_raw_byte_buffer_create(&slice, 1); grpc_slice_unref(slice); @@ -130,7 +128,7 @@ TEST(GrpcByteBufferReaderTest, TestPeekOneSliceMalloc) { grpc_slice* second_slice; int first_code, second_code; - LOG_TEST("test_peek_one_slice_malloc"); + LOG(INFO) << "test_peek_one_slice_malloc"; slice = grpc_slice_malloc(4); memcpy(GRPC_SLICE_START_PTR(slice), "test", 4); buffer = grpc_raw_byte_buffer_create(&slice, 1); @@ -153,7 +151,7 @@ TEST(GrpcByteBufferReaderTest, TestPeekNoneCompressedSlice) { grpc_slice* second_slice; int first_code, second_code; - LOG_TEST("test_peek_none_compressed_slice"); + LOG(INFO) << "test_peek_none_compressed_slice"; slice = grpc_slice_from_copied_string("test"); buffer = grpc_raw_byte_buffer_create(&slice, 1); grpc_slice_unref(slice); @@ -172,7 +170,7 @@ TEST(GrpcByteBufferReaderTest, TestByteBufferFromReader) { grpc_byte_buffer *buffer, *buffer_from_reader; grpc_byte_buffer_reader reader; - LOG_TEST("test_byte_buffer_from_reader"); + LOG(INFO) << "test_byte_buffer_from_reader"; slice = grpc_slice_malloc(4); memcpy(GRPC_SLICE_START_PTR(slice), "test", 4); buffer = grpc_raw_byte_buffer_create(&slice, 1); @@ -201,7 +199,7 @@ TEST(GrpcByteBufferReaderTest, TestReadall) { grpc_byte_buffer_reader reader; grpc_slice slice_out; - LOG_TEST("test_readall"); + LOG(INFO) << "test_readall"; memset(lotsa_as, 'a', 512 * sizeof(lotsa_as[0])); memset(lotsa_bs, 'b', 1024 * sizeof(lotsa_bs[0])); @@ -235,7 +233,7 @@ TEST(GrpcByteBufferReaderTest, TestByteBufferCopy) { grpc_byte_buffer_reader reader; grpc_slice slice_out; - LOG_TEST("test_byte_buffer_copy"); + LOG(INFO) << "test_byte_buffer_copy"; memset(lotsa_as, 'a', 512 * sizeof(lotsa_as[0])); memset(lotsa_bs, 'b', 1024 * sizeof(lotsa_bs[0])); diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc index 0d5035e171c..d2ebf533b01 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.cc +++ b/test/core/surface/num_external_connectivity_watchers_test.cc @@ -20,6 +20,7 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" @@ -73,7 +73,7 @@ static void channel_idle_poll_for_timeout(grpc_channel* channel, // Test to make sure that "connectivity watcher" structs are free'd just // after, if their corresponding timeouts occur. static void run_timeouts_test(const test_fixture* fixture) { - gpr_log(GPR_INFO, "TEST: %s", fixture->name); + LOG(INFO) << "TEST: " << fixture->name; grpc_init(); std::string addr = @@ -122,7 +122,7 @@ static void run_timeouts_test(const test_fixture* fixture) { // of a polling call. static void run_channel_shutdown_before_timeout_test( const test_fixture* fixture) { - gpr_log(GPR_INFO, "TEST: %s", fixture->name); + LOG(INFO) << "TEST: " << fixture->name; grpc_init(); std::string addr = diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc index 45af18cd698..79accd74c3d 100644 --- a/test/core/surface/sequential_connectivity_test.cc +++ b/test/core/surface/sequential_connectivity_test.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include @@ -29,7 +30,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" @@ -94,8 +94,8 @@ static grpc_channel* create_test_channel(const char* addr, } static void run_test(const test_fixture* fixture, bool share_subchannel) { - gpr_log(GPR_INFO, "TEST: %s sharing subchannel: %d", fixture->name, - share_subchannel); + LOG(INFO) << "TEST: " << fixture->name + << " sharing subchannel: " << share_subchannel; std::string addr = grpc_core::JoinHostPort("localhost", grpc_pick_unused_port_or_die()); diff --git a/test/core/surface/server_test.cc b/test/core/surface/server_test.cc index 49777234a63..958d033cef0 100644 --- a/test/core/surface/server_test.cc +++ b/test/core/surface/server_test.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "gtest/gtest.h" @@ -30,7 +31,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" @@ -111,7 +111,7 @@ void test_bind_server_twice(void) { void test_bind_server_to_addr(const char* host, bool secure) { int port = grpc_pick_unused_port_or_die(); std::string addr = grpc_core::JoinHostPort(host, port); - gpr_log(GPR_INFO, "Test bind to %s", addr.c_str()); + LOG(INFO) << "Test bind to " << addr; grpc_server* server = grpc_server_create(nullptr, nullptr); if (secure) { diff --git a/test/core/test_util/cmdline_test.cc b/test/core/test_util/cmdline_test.cc index 049676da1c8..c292c768fbc 100644 --- a/test/core/test_util/cmdline_test.cc +++ b/test/core/test_util/cmdline_test.cc @@ -20,14 +20,13 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" -#include - #include "src/core/util/useful.h" #include "test/core/test_util/test_config.h" -#define LOG_TEST() gpr_log(GPR_INFO, "test at %s:%d", __FILE__, __LINE__) +#define LOG_TEST() LOG(INFO) << "test at " << __FILE__ << ":" << __LINE__ TEST(CmdlineTest, SimpleInt) { int x = 1; diff --git a/test/core/test_util/fake_stats_plugin.h b/test/core/test_util/fake_stats_plugin.h index 5feeb79cb23..1c26425fe01 100644 --- a/test/core/test_util/fake_stats_plugin.h +++ b/test/core/test_util/fake_stats_plugin.h @@ -22,6 +22,7 @@ #include "absl/container/flat_hash_map.h" #include "absl/functional/any_invocable.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" @@ -215,9 +216,8 @@ class FakeStatsPlugin : public StatsPlugin { descriptor) { if (!use_disabled_by_default_metrics && !descriptor.enable_by_default) { - gpr_log(GPR_INFO, - "FakeStatsPlugin[%p]: skipping disabled metric: %s", this, - std::string(descriptor.name).c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]: skipping disabled metric: " << descriptor.name; return; } switch (descriptor.instrument_type) { @@ -283,13 +283,12 @@ class FakeStatsPlugin : public StatsPlugin { // just ignore it here. This would also prevent us from having to lock the // GlobalInstrumentsRegistry everytime a metric is recorded. But this is not // a concern for now. - gpr_log(GPR_INFO, - "FakeStatsPlugin[%p]::AddCounter(index=%u, value=(uint64)%" PRIu64 - ", " - "label_values={%s}, optional_label_values={%s}", - this, handle.index, value, - absl::StrJoin(label_values, ", ").c_str(), - absl::StrJoin(optional_values, ", ").c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]::AddCounter(index=" << handle.index << ", value=(uint64)" + << value << ", label_values={" + << absl::StrJoin(label_values, ", ") + << "}, optional_label_values={" + << absl::StrJoin(optional_values, ", ") << "}"; MutexLock lock(&mu_); auto iter = uint64_counters_.find(handle.index); if (iter == uint64_counters_.end()) return; @@ -299,12 +298,12 @@ class FakeStatsPlugin : public StatsPlugin { GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, double value, absl::Span label_values, absl::Span optional_values) override { - gpr_log(GPR_INFO, - "FakeStatsPlugin[%p]::AddCounter(index=%u, value(double)=%f, " - "label_values={%s}, optional_label_values={%s}", - this, handle.index, value, - absl::StrJoin(label_values, ", ").c_str(), - absl::StrJoin(optional_values, ", ").c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]::AddCounter(index=" << handle.index + << ", value(double)=" << value << ", label_values={" + << absl::StrJoin(label_values, ", ") + << "}, optional_label_values={" + << absl::StrJoin(optional_values, ", ") << "}"; MutexLock lock(&mu_); auto iter = double_counters_.find(handle.index); if (iter == double_counters_.end()) return; @@ -314,13 +313,12 @@ class FakeStatsPlugin : public StatsPlugin { GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, uint64_t value, absl::Span label_values, absl::Span optional_values) override { - gpr_log( - GPR_INFO, - "FakeStatsPlugin[%p]::RecordHistogram(index=%u, value=(uint64)%" PRIu64 - ", " - "label_values={%s}, optional_label_values={%s}", - this, handle.index, value, absl::StrJoin(label_values, ", ").c_str(), - absl::StrJoin(optional_values, ", ").c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]::RecordHistogram(index=" << handle.index + << ", value=(uint64)" << value << ", label_values={" + << absl::StrJoin(label_values, ", ") + << "}, optional_label_values={" + << absl::StrJoin(optional_values, ", ") << "}"; MutexLock lock(&mu_); auto iter = uint64_histograms_.find(handle.index); if (iter == uint64_histograms_.end()) return; @@ -330,24 +328,25 @@ class FakeStatsPlugin : public StatsPlugin { GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, double value, absl::Span label_values, absl::Span optional_values) override { - gpr_log(GPR_INFO, - "FakeStatsPlugin[%p]::RecordHistogram(index=%u, value=(double)%f, " - "label_values={%s}, optional_label_values={%s}", - this, handle.index, value, - absl::StrJoin(label_values, ", ").c_str(), - absl::StrJoin(optional_values, ", ").c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]::RecordHistogram(index=" << handle.index + << ", value=(double)" << value << ", label_values={" + << absl::StrJoin(label_values, ", ") + << "}, optional_label_values={" + << absl::StrJoin(optional_values, ", ") << "}"; MutexLock lock(&mu_); auto iter = double_histograms_.find(handle.index); if (iter == double_histograms_.end()) return; iter->second.Record(value, label_values, optional_values); } void AddCallback(RegisteredMetricCallback* callback) override { - gpr_log(GPR_INFO, "FakeStatsPlugin[%p]::AddCallback(%p)", this, callback); + LOG(INFO) << "FakeStatsPlugin[" << this << "]::AddCallback(" << callback + << ")"; callbacks_.insert(callback); } void RemoveCallback(RegisteredMetricCallback* callback) override { - gpr_log(GPR_INFO, "FakeStatsPlugin[%p]::RemoveCallback(%p)", this, - callback); + LOG(INFO) << "FakeStatsPlugin[" << this << "]::RemoveCallback(" << callback + << ")"; callbacks_.erase(callback); } @@ -406,12 +405,12 @@ class FakeStatsPlugin : public StatsPlugin { return iter->second.GetValues(label_values, optional_values); } void TriggerCallbacks() { - gpr_log(GPR_INFO, "FakeStatsPlugin[%p]::TriggerCallbacks(): START", this); + LOG(INFO) << "FakeStatsPlugin[" << this << "]::TriggerCallbacks(): START"; Reporter reporter(*this); for (auto* callback : callbacks_) { callback->Run(reporter); } - gpr_log(GPR_INFO, "FakeStatsPlugin[%p]::TriggerCallbacks(): END", this); + LOG(INFO) << "FakeStatsPlugin[" << this << "]::TriggerCallbacks(): END"; } absl::optional GetInt64CallbackGaugeValue( GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, @@ -445,14 +444,12 @@ class FakeStatsPlugin : public StatsPlugin { GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, int64_t value, absl::Span label_values, absl::Span optional_values) override { - gpr_log(GPR_INFO, - "FakeStatsPlugin[%p]::Reporter::Report(index=%u, " - "value=(int64_t)%" PRId64 - ", label_values={%s}, " - "optional_label_values={%s}", - this, handle.index, value, - absl::StrJoin(label_values, ", ").c_str(), - absl::StrJoin(optional_values, ", ").c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]::Reporter::Report(index=" << handle.index + << ", value=(int64_t)" << value << ", label_values={" + << absl::StrJoin(label_values, ", ") + << "}, optional_label_values={" + << absl::StrJoin(optional_values, ", ") << "}"; MutexLock lock(&plugin_.callback_mu_); auto iter = plugin_.int64_callback_gauges_.find(handle.index); if (iter == plugin_.int64_callback_gauges_.end()) return; @@ -463,13 +460,12 @@ class FakeStatsPlugin : public StatsPlugin { GlobalInstrumentsRegistry::GlobalInstrumentHandle handle, double value, absl::Span label_values, absl::Span optional_values) override { - gpr_log(GPR_INFO, - "FakeStatsPlugin[%p]::Reporter::Report(index=%u, " - "value=(double)%f, label_values={%s}, " - "optional_label_values={%s}", - this, handle.index, value, - absl::StrJoin(label_values, ", ").c_str(), - absl::StrJoin(optional_values, ", ").c_str()); + LOG(INFO) << "FakeStatsPlugin[" << this + << "]::Reporter::Report(index=" << handle.index + << ", value=(double)" << value << ", label_values={" + << absl::StrJoin(label_values, ", ") + << "}, optional_label_values={" + << absl::StrJoin(optional_values, ", ") << "}"; MutexLock lock(&plugin_.callback_mu_); auto iter = plugin_.double_callback_gauges_.find(handle.index); if (iter == plugin_.double_callback_gauges_.end()) return; diff --git a/test/core/test_util/fake_udp_and_tcp_server.cc b/test/core/test_util/fake_udp_and_tcp_server.cc index 3395f24501b..68cc354b7a4 100644 --- a/test/core/test_util/fake_udp_and_tcp_server.cc +++ b/test/core/test_util/fake_udp_and_tcp_server.cc @@ -24,10 +24,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" -#include #include #include @@ -78,51 +78,49 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer( port_ = grpc_pick_unused_port_or_die(); udp_socket_ = socket(AF_INET6, SOCK_DGRAM, 0); if (udp_socket_ == BAD_SOCKET_RETURN_VAL) { - gpr_log(GPR_ERROR, "Failed to create UDP ipv6 socket: %d", ERRNO); + LOG(ERROR) << "Failed to create UDP ipv6 socket: " << ERRNO; CHECK(0); } accept_socket_ = socket(AF_INET6, SOCK_STREAM, 0); address_ = absl::StrCat("[::1]:", port_); if (accept_socket_ == BAD_SOCKET_RETURN_VAL) { - gpr_log(GPR_ERROR, "Failed to create TCP IPv6 socket: %d", ERRNO); + LOG(ERROR) << "Failed to create TCP IPv6 socket: " << ERRNO; CHECK(0); } #ifdef GPR_WINDOWS char val = 1; if (setsockopt(accept_socket_, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) == SOCKET_ERROR) { - gpr_log(GPR_ERROR, - "Failed to set SO_REUSEADDR on TCP ipv6 socket to [::1]:%d, " - "errno: %d", - port_, ERRNO); + LOG(ERROR) << "Failed to set SO_REUSEADDR on TCP ipv6 socket to [::1]:" + << port_ << ", errno: " << ERRNO; CHECK(0); } grpc_error_handle set_non_block_error; set_non_block_error = grpc_tcp_set_non_block(udp_socket_); if (!set_non_block_error.ok()) { - gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s", - StatusToString(set_non_block_error).c_str()); + LOG(ERROR) << "Failed to configure non-blocking socket: " + << StatusToString(set_non_block_error); CHECK(0); } set_non_block_error = grpc_tcp_set_non_block(accept_socket_); if (!set_non_block_error.ok()) { - gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s", - StatusToString(set_non_block_error).c_str()); + LOG(ERROR) << "Failed to configure non-blocking socket: " + << StatusToString(set_non_block_error); CHECK(0); } #else int val = 1; if (setsockopt(accept_socket_, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) != 0) { - gpr_log(GPR_ERROR, "Failed to set SO_REUSEADDR on socket [::1]:%d", port_); + LOG(ERROR) << "Failed to set SO_REUSEADDR on socket [::1]:" << port_; CHECK(0); } if (fcntl(udp_socket_, F_SETFL, O_NONBLOCK) != 0) { - gpr_log(GPR_ERROR, "Failed to set O_NONBLOCK on socket: %d", ERRNO); + LOG(ERROR) << "Failed to set O_NONBLOCK on socket: " << ERRNO; CHECK(0); } if (fcntl(accept_socket_, F_SETFL, O_NONBLOCK) != 0) { - gpr_log(GPR_ERROR, "Failed to set O_NONBLOCK on socket: %d", ERRNO); + LOG(ERROR) << "Failed to set O_NONBLOCK on socket: " << ERRNO; CHECK(0); } #endif @@ -135,22 +133,21 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer( memcpy(resolved_addr.addr, &addr, sizeof(addr)); resolved_addr.len = sizeof(addr); std::string addr_str = grpc_sockaddr_to_string(&resolved_addr, false).value(); - gpr_log(GPR_INFO, "Fake UDP and TCP server listening on %s", - addr_str.c_str()); + LOG(INFO) << "Fake UDP and TCP server listening on " << addr_str; if (bind(udp_socket_, reinterpret_cast(&addr), sizeof(addr)) != 0) { - gpr_log(GPR_ERROR, "Failed to bind UDP socket to [::1]:%d", port_); + LOG(ERROR) << "Failed to bind UDP socket to [::1]:" << port_; CHECK(0); } if (bind(accept_socket_, reinterpret_cast(&addr), sizeof(addr)) != 0) { - gpr_log(GPR_ERROR, "Failed to bind TCP socket to [::1]:%d : %d", port_, - ERRNO); + LOG(ERROR) << "Failed to bind TCP socket to [::1]:" << port_ << " : " + << ERRNO; CHECK(0); } if (listen(accept_socket_, 100)) { - gpr_log(GPR_ERROR, "Failed to listen on socket bound to [::1]:%d : %d", - port_, ERRNO); + LOG(ERROR) << "Failed to listen on socket bound to [::1]:" << port_ << " : " + << ERRNO; CHECK(0); } gpr_event_init(&stop_ev_); @@ -159,14 +156,10 @@ FakeUdpAndTcpServer::FakeUdpAndTcpServer( } FakeUdpAndTcpServer::~FakeUdpAndTcpServer() { - gpr_log(GPR_DEBUG, - "FakeUdpAndTcpServer stop and " - "join server thread"); + VLOG(2) << "FakeUdpAndTcpServer stop and join server thread"; gpr_event_set(&stop_ev_, reinterpret_cast(1)); run_server_loop_thd_->join(); - gpr_log(GPR_DEBUG, - "FakeUdpAndTcpServer join server " - "thread complete"); + VLOG(2) << "FakeUdpAndTcpServer join server thread complete"; CLOSE_SOCKET(accept_socket_); CLOSE_SOCKET(udp_socket_); } @@ -175,16 +168,13 @@ FakeUdpAndTcpServer::ProcessReadResult FakeUdpAndTcpServer::CloseSocketUponReceivingBytesFromPeer( int bytes_received_size, int read_error, int s) { if (bytes_received_size < 0 && !ErrorIsRetryable(read_error)) { - gpr_log(GPR_ERROR, "Failed to receive from peer socket: %d. errno: %d", s, - read_error); + LOG(ERROR) << "Failed to receive from peer socket: " << s + << ". errno: " << read_error; CHECK(0); } if (bytes_received_size >= 0) { - gpr_log(GPR_DEBUG, - "Fake TCP server received %d bytes from peer socket: %d. Close " - "the " - "connection.", - bytes_received_size, s); + VLOG(2) << "Fake TCP server received " << bytes_received_size + << " bytes from peer socket: " << s << ". Close the connection."; return FakeUdpAndTcpServer::ProcessReadResult::kCloseSocket; } return FakeUdpAndTcpServer::ProcessReadResult::kContinueReading; @@ -194,17 +184,14 @@ FakeUdpAndTcpServer::ProcessReadResult FakeUdpAndTcpServer::CloseSocketUponCloseFromPeer(int bytes_received_size, int read_error, int s) { if (bytes_received_size < 0 && !ErrorIsRetryable(read_error)) { - gpr_log(GPR_ERROR, "Failed to receive from peer socket: %d. errno: %d", s, - read_error); + LOG(ERROR) << "Failed to receive from peer socket: " << s + << ". errno: " << read_error; CHECK(0); } if (bytes_received_size == 0) { // The peer has shut down the connection. - gpr_log(GPR_DEBUG, - "Fake TCP server received 0 bytes from peer socket: %d. Close " - "the " - "connection.", - s); + VLOG(2) << "Fake TCP server received 0 bytes from peer socket: " << s + << ". Close the connection."; return FakeUdpAndTcpServer::ProcessReadResult::kCloseSocket; } return FakeUdpAndTcpServer::ProcessReadResult::kContinueReading; @@ -214,21 +201,19 @@ FakeUdpAndTcpServer::ProcessReadResult FakeUdpAndTcpServer::SendThreeAllZeroBytes(int bytes_received_size, int read_error, int s) { if (bytes_received_size < 0 && !ErrorIsRetryable(read_error)) { - gpr_log(GPR_ERROR, "Failed to receive from peer socket: %d. errno: %d", s, - read_error); + LOG(ERROR) << "Failed to receive from peer socket: " << s + << ". errno: " << read_error; CHECK(0); } if (bytes_received_size == 0) { // The peer has shut down the connection. - gpr_log(GPR_DEBUG, "Fake TCP server received 0 bytes from peer socket: %d.", - s); + VLOG(2) << "Fake TCP server received 0 bytes from peer socket: " << s; return FakeUdpAndTcpServer::ProcessReadResult::kCloseSocket; } char buf[3] = {0, 0, 0}; int bytes_sent = send(s, buf, sizeof(buf), 0); - gpr_log(GPR_DEBUG, - "Fake TCP server sent %d all-zero bytes on peer socket: %d.", - bytes_sent, s); + VLOG(2) << "Fake TCP server sent " << bytes_sent + << " all-zero bytes on peer socket: " << s; return FakeUdpAndTcpServer::ProcessReadResult::kCloseSocket; } @@ -254,10 +239,8 @@ void FakeUdpAndTcpServer::FakeUdpAndTcpServerPeer:: send(fd_, kEmptyHttp2SettingsFrame.data() + total_bytes_sent_, bytes_to_send, 0); if (bytes_sent < 0 && !ErrorIsRetryable(ERRNO)) { - gpr_log(GPR_ERROR, - "Fake TCP server encountered unexpected error:%d " - "sending %d bytes on fd:%d", - ERRNO, bytes_to_send, fd_); + LOG(ERROR) << "Fake TCP server encountered unexpected error:" << ERRNO + << " sending " << bytes_to_send << " bytes on fd:" << fd_; CHECK(0); } else if (bytes_sent > 0) { total_bytes_sent_ += bytes_sent; @@ -277,19 +260,19 @@ void FakeUdpAndTcpServer::RunServerLoop() { // handle TCP connections int p = accept(accept_socket_, nullptr, nullptr); if (p != BAD_SOCKET_RETURN_VAL) { - gpr_log(GPR_DEBUG, "accepted peer socket: %d", p); + VLOG(2) << "accepted peer socket: " << p; #ifdef GPR_WINDOWS grpc_error_handle set_non_block_error; set_non_block_error = grpc_tcp_set_non_block(p); if (!set_non_block_error.ok()) { - gpr_log(GPR_ERROR, "Failed to configure non-blocking socket: %s", - StatusToString(set_non_block_error).c_str()); + LOG(ERROR) << "Failed to configure non-blocking socket: " + << StatusToString(set_non_block_error); CHECK(0); } #else if (fcntl(p, F_SETFL, O_NONBLOCK) != 0) { - gpr_log(GPR_ERROR, "Failed to configure non-blocking socket, errno: %d", - ERRNO); + LOG(ERROR) << "Failed to configure non-blocking socket, errno: " + << ERRNO; CHECK(0); } #endif diff --git a/test/core/test_util/fuzzer_corpus_test.cc b/test/core/test_util/fuzzer_corpus_test.cc index e85304c1bc2..0bdbf3a8c8f 100644 --- a/test/core/test_util/fuzzer_corpus_test.cc +++ b/test/core/test_util/fuzzer_corpus_test.cc @@ -28,12 +28,12 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/types/optional.h" #include "gtest/gtest.h" #include #include -#include #include "src/core/lib/gprpp/env.h" #include "src/core/lib/iomgr/error.h" @@ -82,14 +82,15 @@ class ExampleGenerator } if (!absl::GetFlag(FLAGS_directory).empty()) { auto test_srcdir = grpc_core::GetEnv("TEST_SRCDIR"); - gpr_log(GPR_DEBUG, "test_srcdir=\"%s\"", - test_srcdir.has_value() ? test_srcdir->c_str() : "(null)"); + VLOG(2) << "test_srcdir=\"" + << (test_srcdir.has_value() ? test_srcdir->c_str() : "(null)") + << "\""; std::string directory = absl::GetFlag(FLAGS_directory); if (test_srcdir.has_value()) { directory = *test_srcdir + std::string("/com_github_grpc_grpc/") + directory; } - gpr_log(GPR_DEBUG, "Using corpus directory: %s", directory.c_str()); + VLOG(2) << "Using corpus directory: " << directory; DIR* dp; struct dirent* ep; dp = opendir(directory.c_str()); diff --git a/test/core/test_util/grpc_profiler.cc b/test/core/test_util/grpc_profiler.cc index b6ae2a02c12..a0018de4b25 100644 --- a/test/core/test_util/grpc_profiler.cc +++ b/test/core/test_util/grpc_profiler.cc @@ -25,18 +25,16 @@ void grpc_profiler_start(const char* filename) { ProfilerStart(filename); } void grpc_profiler_stop() { ProfilerStop(); } #else -#include +#include "absl/log/log.h" void grpc_profiler_start(const char* filename) { static int printed_warning = 0; if (!printed_warning) { - gpr_log(GPR_DEBUG, - "You do not have google-perftools installed, profiling is disabled " - "[for %s]", - filename); - gpr_log(GPR_DEBUG, - "To install on ubuntu: sudo apt-get install google-perftools " - "libgoogle-perftools-dev"); + VLOG(2) << "You do not have google-perftools installed, profiling is " + "disabled [for " + << filename << "]"; + VLOG(2) << "To install on ubuntu: sudo apt-get install google-perftools " + "libgoogle-perftools-dev"; printed_warning = 1; } } diff --git a/test/core/test_util/histogram_test.cc b/test/core/test_util/histogram_test.cc index ac89d62c0f2..5c90ffbb246 100644 --- a/test/core/test_util/histogram_test.cc +++ b/test/core/test_util/histogram_test.cc @@ -20,12 +20,9 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" -#include - -#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x); - TEST(HistogramTest, NoOp) { grpc_histogram_destroy(grpc_histogram_create(0.01, 60e9)); } @@ -33,8 +30,8 @@ TEST(HistogramTest, NoOp) { static void expect_percentile(grpc_histogram* h, double percentile, double min_expect, double max_expect) { double got = grpc_histogram_percentile(h, percentile); - gpr_log(GPR_INFO, "@%f%%, expect %f <= %f <= %f", percentile, min_expect, got, - max_expect); + LOG(INFO) << "@" << percentile << "%%, expect " << min_expect << " <= " << got + << " <= " << max_expect; ASSERT_LE(min_expect, got); ASSERT_LE(got, max_expect); } @@ -42,7 +39,7 @@ static void expect_percentile(grpc_histogram* h, double percentile, TEST(HistogramTest, Simple) { grpc_histogram* h; - LOG_TEST("test_simple"); + LOG(INFO) << "test_simple"; h = grpc_histogram_create(0.01, 60e9); grpc_histogram_add(h, 10000); @@ -62,7 +59,7 @@ TEST(HistogramTest, Percentile) { double i; double cur; - LOG_TEST("test_percentile"); + LOG(INFO) << "test_percentile"; h = grpc_histogram_create(0.05, 1e9); grpc_histogram_add(h, 2.5); @@ -107,7 +104,7 @@ TEST(HistogramTest, Merge) { double i; double cur; - LOG_TEST("test_merge"); + LOG(INFO) << "test_merge"; h1 = grpc_histogram_create(0.05, 1e9); grpc_histogram_add(h1, 2.5); diff --git a/test/core/test_util/port_server_client.cc b/test/core/test_util/port_server_client.cc index 12fdde8bdaa..cbd83fcb046 100644 --- a/test/core/test_util/port_server_client.cc +++ b/test/core/test_util/port_server_client.cc @@ -28,6 +28,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" @@ -35,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -154,12 +154,11 @@ static void got_port_from_server(void* arg, grpc_error_handle error) { if (!error.ok()) { failed = 1; - gpr_log(GPR_DEBUG, "failed port pick from server: retrying [%s]", - grpc_core::StatusToString(error).c_str()); + VLOG(2) << "failed port pick from server: retrying [" + << grpc_core::StatusToString(error) << "]"; } else if (response->status != 200) { failed = 1; - gpr_log(GPR_DEBUG, "failed port pick from server: status=%d", - response->status); + VLOG(2) << "failed port pick from server: status=" << response->status; } if (failed) { diff --git a/test/core/test_util/stack_tracer_test.cc b/test/core/test_util/stack_tracer_test.cc index 5b8eab10a24..701ffaddbfe 100644 --- a/test/core/test_util/stack_tracer_test.cc +++ b/test/core/test_util/stack_tracer_test.cc @@ -20,16 +20,15 @@ #include +#include "absl/log/log.h" #include "absl/strings/match.h" #include "gtest/gtest.h" -#include - #include "test/core/test_util/test_config.h" TEST(StackTracerTest, Basic) { std::string stack_trace = grpc_core::testing::GetCurrentStackTrace(); - gpr_log(GPR_INFO, "stack_trace=%s", stack_trace.c_str()); + LOG(INFO) << "stack_trace=" << stack_trace; #if !defined(NDEBUG) && !defined(GPR_MUSL_LIBC_COMPAT) EXPECT_TRUE(absl::StrContains(stack_trace, "Basic")); #endif diff --git a/test/core/test_util/test_lb_policies.cc b/test/core/test_util/test_lb_policies.cc index c21301ad08b..aea9e919414 100644 --- a/test/core/test_util/test_lb_policies.cc +++ b/test/core/test_util/test_lb_policies.cc @@ -22,13 +22,13 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "absl/types/variant.h" #include #include -#include #include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/channel/channel_args.h" @@ -411,8 +411,8 @@ class FixedAddressLoadBalancingPolicy : public ForwardingLoadBalancingPolicy { absl::Status UpdateLocked(UpdateArgs args) override { auto* config = static_cast(args.config.get()); - gpr_log(GPR_INFO, "%s: update URI: %s", kFixedAddressLbPolicyName, - config->address().c_str()); + LOG(INFO) << kFixedAddressLbPolicyName + << ": update URI: " << config->address(); auto uri = URI::Parse(config->address()); args.config.reset(); EndpointAddressesList addresses; @@ -421,9 +421,8 @@ class FixedAddressLoadBalancingPolicy : public ForwardingLoadBalancingPolicy { CHECK(grpc_parse_uri(*uri, &address)); addresses.emplace_back(address, ChannelArgs()); } else { - gpr_log(GPR_ERROR, - "%s: could not parse URI (%s), using empty address list", - kFixedAddressLbPolicyName, uri.status().ToString().c_str()); + LOG(ERROR) << kFixedAddressLbPolicyName << ": could not parse URI (" + << uri.status().ToString() << "), using empty address list"; args.resolution_note = "no address in fixed_address_lb policy"; } args.addresses = diff --git a/test/core/test_util/test_tcp_server.cc b/test/core/test_util/test_tcp_server.cc index 15d1169a022..41cb382dd46 100644 --- a/test/core/test_util/test_tcp_server.cc +++ b/test/core/test_util/test_tcp_server.cc @@ -24,10 +24,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include -#include #include #include @@ -91,7 +91,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { CHECK(port_added == port); grpc_tcp_server_start(server->tcp_server, &server->pollset); - gpr_log(GPR_INFO, "test tcp server listening on 0.0.0.0:%d", port); + LOG(INFO) << "test tcp server listening on 0.0.0.0:" << port; } void test_tcp_server_poll(test_tcp_server* server, int milliseconds) { diff --git a/test/core/transport/chaotic_good/chaotic_good_server_test.cc b/test/core/transport/chaotic_good/chaotic_good_server_test.cc index 40de0b35cbe..0b9b49a370b 100644 --- a/test/core/transport/chaotic_good/chaotic_good_server_test.cc +++ b/test/core/transport/chaotic_good/chaotic_good_server_test.cc @@ -19,6 +19,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/time/time.h" #include "gmock/gmock.h" @@ -98,8 +99,7 @@ class ChaoticGoodServerTest : public ::testing::Test { protected: static void OnConnectingFinished(void* arg, grpc_error_handle error) { - gpr_log(GPR_ERROR, "OnConnectingFinished: %p %s", arg, - error.ToString().c_str()); + LOG(ERROR) << "OnConnectingFinished: " << arg << " " << error.ToString(); ChaoticGoodServerTest* test = static_cast(arg); test->connecting_successful_ = error.ok(); test->connect_finished_.Notify(); diff --git a/test/core/transport/chaotic_good/frame_fuzzer.cc b/test/core/transport/chaotic_good/frame_fuzzer.cc index ff2a7619922..d8e2e4499fb 100644 --- a/test/core/transport/chaotic_good/frame_fuzzer.cc +++ b/test/core/transport/chaotic_good/frame_fuzzer.cc @@ -19,11 +19,11 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/random/bit_gen_ref.h" #include "absl/status/statusor.h" #include -#include #include "src/core/ext/transport/chaotic_good/frame.h" #include "src/core/ext/transport/chaotic_good/frame_header.h" @@ -63,8 +63,7 @@ void AssertRoundTrips(const T& input, FrameType expected_frame_type) { auto header = FrameHeader::Parse(header_bytes); if (!header.ok()) { if (!squelch) { - gpr_log(GPR_ERROR, "Failed to parse header: %s", - header.status().ToString().c_str()); + LOG(ERROR) << "Failed to parse header: " << header.status().ToString(); } Crash("Failed to parse header"); } @@ -89,7 +88,7 @@ void FinishParseAndChecks(const FrameHeader& header, BufferPair buffers) { absl::BitGenRef(bitgen), GetContext(), std::move(buffers), FuzzerFrameLimits()); if (!deser.ok()) return; - gpr_log(GPR_INFO, "Read frame: %s", parsed.ToString().c_str()); + LOG(INFO) << "Read frame: " << parsed.ToString(); AssertRoundTrips(parsed, header.type); } @@ -101,7 +100,7 @@ void Run(const frame_fuzzer::Test& test) { auto r = FrameHeader::Parse(control_data); if (!r.ok()) return; if (test.data().size() != r->message_length) return; - gpr_log(GPR_INFO, "Read frame header: %s", r->ToString().c_str()); + LOG(INFO) << "Read frame header: " << r->ToString(); control_data += 24; control_size -= 24; MemoryAllocator memory_allocator = MemoryAllocator( diff --git a/test/core/transport/chttp2/bin_decoder_test.cc b/test/core/transport/chttp2/bin_decoder_test.cc index 71f758cf6aa..40f67db8583 100644 --- a/test/core/transport/chttp2/bin_decoder_test.cc +++ b/test/core/transport/chttp2/bin_decoder_test.cc @@ -22,10 +22,10 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include -#include #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/lib/iomgr/exec_ctx.h" @@ -40,8 +40,8 @@ static void expect_slice_eq(grpc_slice expected, grpc_slice slice, if (!grpc_slice_eq(slice, expected)) { char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs, - he); + LOG(ERROR) << "FAILED:" << line << ": " << debug << "\ngot: " << hs + << "\nwant: " << he; gpr_free(hs); gpr_free(he); all_ok = 0; diff --git a/test/core/transport/chttp2/bin_encoder_test.cc b/test/core/transport/chttp2/bin_encoder_test.cc index 47e59745f9f..bb52b4bd766 100644 --- a/test/core/transport/chttp2/bin_encoder_test.cc +++ b/test/core/transport/chttp2/bin_encoder_test.cc @@ -24,9 +24,10 @@ #include +#include "absl/log/log.h" + #include #include -#include #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/util/string.h" @@ -39,8 +40,8 @@ static void expect_slice_eq(grpc_slice expected, grpc_slice slice, if (!grpc_slice_eq(slice, expected)) { char* hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs, - he); + LOG(ERROR) << "FAILED:" << line << ": " << debug << "\ngot: " << hs + << "\nwant: " << he; gpr_free(hs); gpr_free(he); all_ok = 0; @@ -79,8 +80,8 @@ static void expect_combined_equiv(const char* s, size_t len, int line) { char* t = grpc_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* e = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII); char* g = grpc_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot: %s\nwant: %s", line, t, g, - e); + LOG(ERROR) << "FAILED:" << line << ":\ntest: " << t << "\ngot: " << g + << "\nwant: " << e; gpr_free(t); gpr_free(e); gpr_free(g); @@ -97,8 +98,8 @@ static void expect_combined_equiv(const char* s, size_t len, int line) { static void expect_binary_header(const char* hdr, int binary) { if (grpc_is_binary_header(grpc_slice_from_static_string(hdr)) != binary) { - gpr_log(GPR_ERROR, "FAILED: expected header '%s' to be %s", hdr, - binary ? "binary" : "not binary"); + LOG(ERROR) << "FAILED: expected header '" << hdr << "' to be " + << (binary ? "binary" : "not binary"); all_ok = 0; } } diff --git a/test/core/transport/chttp2/hpack_utils_test.cc b/test/core/transport/chttp2/hpack_utils_test.cc index a0ddf0d5b96..cf40ca2b564 100644 --- a/test/core/transport/chttp2/hpack_utils_test.cc +++ b/test/core/transport/chttp2/hpack_utils_test.cc @@ -18,6 +18,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include @@ -68,8 +69,8 @@ class MetadataTest : public ::testing::TestWithParam { TEST_P(MetadataTest, MetadataSize) { const bool intern_key = GetParam().intern_key; const bool intern_value = GetParam().intern_value; - gpr_log(GPR_INFO, "test_mdelem_size: intern_key=%d intern_value=%d", - intern_key, intern_value); + LOG(INFO) << "test_mdelem_size: intern_key=" << intern_key + << " intern_value=" << intern_value; grpc_init(); ExecCtx exec_ctx; diff --git a/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc b/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc index ad406d2411b..0bae088a3aa 100644 --- a/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc +++ b/test/core/transport/chttp2/stream_leak_with_queued_flow_control_update_test.cc @@ -19,6 +19,7 @@ #include "absl/base/thread_annotations.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "gtest/gtest.h" @@ -30,7 +31,6 @@ #include #include #include -#include #include #include @@ -199,19 +199,15 @@ class TransportCounter { grpc_core::MutexLock lock(&mu_); ++num_created_; ++num_live_; - gpr_log(GPR_INFO, - "TransportCounter num_created_=%ld num_live_=%" PRId64 - " InitCallback", - num_created_, num_live_); + LOG(INFO) << "TransportCounter num_created_=" << num_created_ + << " num_live_=" << num_live_ << " InitCallback"; } void DestructCallback() { grpc_core::MutexLock lock(&mu_); --num_live_; - gpr_log(GPR_INFO, - "TransportCounter num_created_=%ld num_live_=%" PRId64 - " DestructCallback", - num_created_, num_live_); + LOG(INFO) << "TransportCounter num_created_=" << num_created_ + << " num_live_=" << num_live_ << " DestructCallback"; } int64_t num_live() { @@ -237,9 +233,8 @@ void CounterInitCallback() { g_transport_counter->InitCallback(); } void CounterDestructCallback() { g_transport_counter->DestructCallback(); } void EnsureConnectionsArentLeaked(grpc_completion_queue* cq) { - gpr_log( - GPR_INFO, - "The channel has been destroyed, wait for it to shut down and close..."); + LOG(INFO) << "The channel has been destroyed, wait for it to shut down and " + "close..."; // Do a quick initial poll to try to exit the test early if things have // already cleaned up. CHECK(grpc_completion_queue_next( @@ -249,30 +244,26 @@ void EnsureConnectionsArentLeaked(grpc_completion_queue* cq) { nullptr) .type == GRPC_QUEUE_TIMEOUT); if (g_transport_counter->num_created() < 2) { - gpr_log(GPR_ERROR, - "g_transport_counter->num_created() == %ld. This means that " - "g_transport_counter isn't working and this test is broken. At " - "least a couple of transport objects should have been created.", - g_transport_counter->num_created()); + LOG(ERROR) << "g_transport_counter->num_created() == " + << g_transport_counter->num_created() + << ". This means that g_transport_counter isn't working and " + "this test is broken. At least a couple of transport objects " + "should have been created."; CHECK(0); } gpr_timespec overall_deadline = grpc_timeout_seconds_to_deadline(120); for (;;) { - // Note: the main goal of this test is to try to repro a chttp2 stream leak, - // which also holds on to transports objects. + // Note: the main goal of this test is to try to repro a chttp2 stream + // leak, which also holds on to transports objects. int64_t live_transports = g_transport_counter->num_live(); if (live_transports == 0) return; if (gpr_time_cmp(gpr_now(GPR_CLOCK_MONOTONIC), overall_deadline) > 0) { - gpr_log(GPR_INFO, - "g_transport_counter->num_live() never returned 0. " - "It's likely this test has triggered a connection leak."); + LOG(INFO) << "g_transport_counter->num_live() never returned 0. " + "It's likely this test has triggered a connection leak."; CHECK(0); } - gpr_log(GPR_INFO, - "g_transport_counter->num_live() returned %" PRId64 - ", keep waiting " - "until it reaches 0", - live_transports); + LOG(INFO) << "g_transport_counter->num_live() returned " << live_transports + << ", keep waiting until it reaches 0"; CHECK(grpc_completion_queue_next( cq, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), diff --git a/test/core/transport/chttp2/varint_test.cc b/test/core/transport/chttp2/varint_test.cc index 10f294ac802..f4848b3167b 100644 --- a/test/core/transport/chttp2/varint_test.cc +++ b/test/core/transport/chttp2/varint_test.cc @@ -20,10 +20,11 @@ #include +#include "absl/log/log.h" +#include "absl/strings/str_format.h" #include "gtest/gtest.h" #include -#include #include "test/core/test_util/test_config.h" @@ -34,7 +35,7 @@ static void test_varint(uint32_t value, uint8_t prefix_or, grpc_slice expect = grpc_slice_from_copied_buffer(expect_bytes, expect_length); grpc_slice slice; - gpr_log(GPR_DEBUG, "Test: 0x%08x", value); + VLOG(2) << absl::StrFormat("Test: 0x%08x", value); ASSERT_EQ(w.length(), expect_length); slice = grpc_slice_malloc(w.length()); w.Write(prefix_or, GRPC_SLICE_START_PTR(slice)); diff --git a/test/core/transport/test_suite/test.h b/test/core/transport/test_suite/test.h index 841b8cedfc8..3ce01212326 100644 --- a/test/core/transport/test_suite/test.h +++ b/test/core/transport/test_suite/test.h @@ -20,6 +20,7 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/log/log.h" #include "absl/random/bit_gen_ref.h" #include "absl/strings/string_view.h" #include "gmock/gmock.h" @@ -88,11 +89,9 @@ class ActionState { State Get() const { return state_; } void Set(State state, SourceLocation whence = {}) { - gpr_log(GPR_INFO, "%s", - absl::StrCat(StateString(state), " ", name(), " [", step(), "] ", - file(), ":", line(), " @ ", whence.file(), ":", - whence.line()) - .c_str()); + LOG(INFO) << StateString(state) << " " << name() << " [" << step() << "] " + << file() << ":" << line() << " @ " << whence.file() << ":" + << whence.line(); state_ = state; } const NameAndLocation& name_and_location() const { diff --git a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc index e0ccd66c461..711ca4206d1 100644 --- a/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc +++ b/test/core/tsi/alts/fake_handshaker/fake_handshaker_server_main.cc @@ -19,8 +19,8 @@ #include "absl/flags/flag.h" #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include @@ -40,8 +40,7 @@ static void RunFakeHandshakerServer(const std::string& server_address, grpc::ServerBuilder builder; builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); builder.RegisterService(service.get()); - gpr_log(GPR_INFO, "Fake handshaker server listening on %s", - server_address.c_str()); + LOG(INFO) << "Fake handshaker server listening on " << server_address; std::unique_ptr server = builder.BuildAndStart(); server->Wait(); } diff --git a/test/core/tsi/transport_security_test.cc b/test/core/tsi/transport_security_test.cc index b541ab12f3f..8d9e1bed6e6 100644 --- a/test/core/tsi/transport_security_test.cc +++ b/test/core/tsi/transport_security_test.cc @@ -25,10 +25,10 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include -#include #include #include "src/core/lib/gprpp/crash.h" @@ -316,7 +316,7 @@ TEST(TransportSecurityTest, TestPeerMatchesName) { tsi_peer peer = peer_from_cert_name_test_entry(entry); int result = tsi_ssl_peer_matches_name(&peer, entry->host_name); if (result != entry->expected) { - gpr_log(GPR_ERROR, "%s", cert_name_test_entry_to_string(entry).c_str()); + LOG(ERROR) << cert_name_test_entry_to_string(entry); ASSERT_TRUE(0); // Unexpected result. } tsi_peer_destruct(&peer); diff --git a/test/core/util/env_test.cc b/test/core/util/env_test.cc index fb425d066bc..b3f09966c07 100644 --- a/test/core/util/env_test.cc +++ b/test/core/util/env_test.cc @@ -18,19 +18,16 @@ #include "src/core/lib/gprpp/env.h" +#include "absl/log/log.h" #include "gtest/gtest.h" -#include - #include "test/core/test_util/test_config.h" -#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x) - TEST(EnvTest, SetenvGetenv) { const char* name = "FOO"; const char* value = "BAR"; - LOG_TEST_NAME("test_setenv_getenv"); + LOG(INFO) << "test_setenv_getenv"; grpc_core::SetEnv(name, value); auto retrieved_value = grpc_core::GetEnv(name); @@ -41,7 +38,7 @@ TEST(EnvTest, Unsetenv) { const char* name = "FOO"; const char* value = "BAR"; - LOG_TEST_NAME("test_unsetenv"); + LOG(INFO) << "test_unsetenv"; grpc_core::SetEnv(name, value); grpc_core::UnsetEnv(name); diff --git a/test/core/xds/xds_transport_fake.cc b/test/core/xds/xds_transport_fake.cc index 2475c07be33..bd6c21730fc 100644 --- a/test/core/xds/xds_transport_fake.cc +++ b/test/core/xds/xds_transport_fake.cc @@ -24,9 +24,9 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include -#include #include #include "src/core/lib/event_engine/default_event_engine.h" @@ -50,9 +50,8 @@ FakeXdsTransportFactory::FakeStreamingCall::~FakeStreamingCall() { MutexLock lock(&mu_); if (transport_->abort_on_undrained_messages()) { for (const auto& message : from_client_messages_) { - gpr_log(GPR_ERROR, "[%s] %p From client message left in queue: %s", - transport_->server()->server_uri().c_str(), this, - message.c_str()); + LOG(ERROR) << "[" << transport_->server()->server_uri() << "] " << this + << " From client message left in queue: " << message; } CHECK(from_client_messages_.empty()); } From 8881bde311d961649fce51d4f835010edd91ea92 Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Fri, 24 May 2024 02:58:58 -0700 Subject: [PATCH 19/20] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36701) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future. We have the following mapping 1. gpr_log(GPR_INFO,...) -> LOG(INFO) 2. gpr_log(GPR_ERROR,...) -> LOG(ERROR) 3. gpr_log(GPR_DEBUG,...) -> VLOG(2) Reviewers need to check : 1. If the above mapping is correct. 2. The content of the log is as before. gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected. Closes #36701 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36701 from tanvi-jagtap:test_core_gpr_log 1d8c69e9c63faf384052621e172232776bb8f986 PiperOrigin-RevId: 636850577 --- .../core/compression/message_compress_test.cc | 12 +++---- .../event_engine/event_engine_test_utils.cc | 13 ++++---- test/core/event_engine/forkable_test.cc | 9 +++--- .../posix/event_poller_posix_test.cc | 10 +++--- .../event_engine/posix/posix_endpoint_test.cc | 3 +- .../posix/posix_engine_listener_utils_test.cc | 13 ++++---- .../posix/posix_engine_test_utils.cc | 5 ++- .../posix/posix_event_engine_connect_test.cc | 4 +-- .../event_engine/posix/timer_manager_test.cc | 6 ++-- .../event_engine/test_suite/tests/dns_test.cc | 6 ++-- .../test_suite/tests/timer_test.cc | 6 ++-- .../test_suite/tools/echo_client.cc | 21 ++++++------ .../event_engine/windows/create_sockpair.cc | 13 +++----- test/core/gprpp/examine_stack_test.cc | 5 ++- test/core/http/httpcli_test.cc | 28 ++++++++-------- test/core/http/httpscli_test.cc | 14 ++++---- test/core/iomgr/error_test.cc | 5 +-- test/core/iomgr/fd_posix_test.cc | 4 +-- test/core/iomgr/resolve_address_test.cc | 14 ++++---- test/core/iomgr/tcp_posix_test.cc | 32 +++++++++---------- test/core/json/json_test.cc | 7 ++-- test/core/memory_usage/client.cc | 8 ++--- test/core/promise/sleep_test.cc | 9 +++--- test/core/resolver/binder_resolver_test.cc | 11 ++++--- .../resolver/dns_resolver_cooldown_test.cc | 27 ++++++++-------- test/core/resolver/dns_resolver_test.cc | 11 +++---- test/core/resolver/sockaddr_resolver_test.cc | 15 ++++----- .../memory_quota_stress_test.cc | 11 +++---- 28 files changed, 151 insertions(+), 171 deletions(-) diff --git a/test/core/compression/message_compress_test.cc b/test/core/compression/message_compress_test.cc index 9110456d054..e8aac4237a6 100644 --- a/test/core/compression/message_compress_test.cc +++ b/test/core/compression/message_compress_test.cc @@ -24,6 +24,7 @@ #include +#include "absl/log/log.h" #include "gtest/gtest.h" #include @@ -56,12 +57,11 @@ static void assert_passthrough(grpc_slice value, const char* algorithm_name; ASSERT_NE(grpc_compression_algorithm_name(algorithm, &algorithm_name), 0); - gpr_log(GPR_INFO, - "assert_passthrough: value_length=%" PRIuPTR - " algorithm='%s' uncompressed_split='%s' compressed_split='%s'", - GRPC_SLICE_LENGTH(value), algorithm_name, - grpc_slice_split_mode_name(uncompressed_split_mode), - grpc_slice_split_mode_name(compressed_split_mode)); + LOG(INFO) << "assert_passthrough: value_length=" << GRPC_SLICE_LENGTH(value) + << " algorithm='" << algorithm_name << "' uncompressed_split='" + << grpc_slice_split_mode_name(uncompressed_split_mode) + << "' compressed_split='" + << grpc_slice_split_mode_name(compressed_split_mode) << "'"; grpc_slice_buffer_init(&input); grpc_slice_buffer_init(&compressed_raw); diff --git a/test/core/event_engine/event_engine_test_utils.cc b/test/core/event_engine/event_engine_test_utils.cc index 32ab6ac5276..d026f50d0b9 100644 --- a/test/core/event_engine/event_engine_test_utils.cc +++ b/test/core/event_engine/event_engine_test_utils.cc @@ -23,6 +23,7 @@ #include #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" @@ -34,7 +35,6 @@ #include #include #include -#include #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/event_engine/tcp_socket_utils.h" @@ -159,8 +159,8 @@ absl::Status SendValidatePayload(absl::string_view data, // Check if data written == data read std::string data_read = ExtractSliceBufferIntoString(&read_store_buf); if (data != data_read) { - gpr_log(GPR_INFO, "Data written = %s", data.data()); - gpr_log(GPR_INFO, "Data read = %s", data_read.c_str()); + LOG(INFO) << "Data written = " << data; + LOG(INFO) << "Data read = " << data_read; return absl::CancelledError("Data read != Data written"); } return absl::OkStatus(); @@ -201,8 +201,8 @@ absl::Status ConnectionManager::BindAndStartListener( for (auto& addr : addrs) { auto bind_status = listener->Bind(*URIToResolvedAddress(addr)); if (!bind_status.ok()) { - gpr_log(GPR_ERROR, "Binding listener failed: %s", - bind_status.status().ToString().c_str()); + LOG(ERROR) << "Binding listener failed: " + << bind_status.status().ToString(); return bind_status.status(); } } @@ -230,8 +230,7 @@ ConnectionManager::CreateConnection(std::string target_addr, event_engine->Connect( [this](absl::StatusOr> status) { if (!status.ok()) { - gpr_log(GPR_ERROR, "Connect failed: %s", - status.status().ToString().c_str()); + LOG(ERROR) << "Connect failed: " << status.status().ToString(); last_in_progress_connection_.SetClientEndpoint(nullptr); } else { last_in_progress_connection_.SetClientEndpoint(std::move(*status)); diff --git a/test/core/event_engine/forkable_test.cc b/test/core/event_engine/forkable_test.cc index 9c7fdf69405..c15c3d76494 100644 --- a/test/core/event_engine/forkable_test.cc +++ b/test/core/event_engine/forkable_test.cc @@ -25,11 +25,10 @@ #include +#include "absl/log/log.h" #include "absl/types/optional.h" #include "gtest/gtest.h" -#include - #include "src/core/lib/config/config_vars.h" #include "src/core/lib/gprpp/no_destruct.h" @@ -94,14 +93,14 @@ TEST_F(ForkableTest, BasicPthreadAtForkOperations) { int child_pid = fork(); ASSERT_NE(child_pid, -1); if (child_pid == 0) { - gpr_log(GPR_DEBUG, "I am child pid: %d", getpid()); + VLOG(2) << "I am child pid: " << getpid(); forkable->CheckChild(); exit(testing::Test::HasFailure()); } else { - gpr_log(GPR_DEBUG, "I am parent pid: %d", getpid()); + VLOG(2) << "I am parent pid: " << getpid(); forkable->CheckParent(); int status; - gpr_log(GPR_DEBUG, "Waiting for child pid: %d", child_pid); + VLOG(2) << "Waiting for child pid: " << child_pid; do { // retry on EINTR, and fail otherwise if (waitpid(child_pid, &status, 0) != -1) break; diff --git a/test/core/event_engine/posix/event_poller_posix_test.cc b/test/core/event_engine/posix/event_poller_posix_test.cc index b1e142097a1..d6c29bcfc51 100644 --- a/test/core/event_engine/posix/event_poller_posix_test.cc +++ b/test/core/event_engine/posix/event_poller_posix_test.cc @@ -52,10 +52,10 @@ #include #include +#include "absl/log/log.h" #include "absl/status/status.h" #include -#include #include #include "src/core/lib/event_engine/common_closures.h" @@ -235,8 +235,8 @@ void ListenCb(server* sv, absl::Status status) { listen_em_fd->NotifyOnRead(sv->listen_closure); return; } else if (fd < 0) { - gpr_log(GPR_ERROR, "Failed to acceot a connection, returned error: %s", - grpc_core::StrError(errno).c_str()); + LOG(ERROR) << "Failed to acceot a connection, returned error: " + << grpc_core::StrError(errno); } EXPECT_GE(fd, 0); EXPECT_LT(fd, FD_SETSIZE); @@ -349,7 +349,7 @@ void ClientStart(client* cl, int port) { pfd.events = POLLOUT; pfd.revents = 0; if (poll(&pfd, 1, -1) == -1) { - gpr_log(GPR_ERROR, "poll() failed during connect; errno=%d", errno); + LOG(ERROR) << "poll() failed during connect; errno=" << errno; abort(); } } else { @@ -389,7 +389,7 @@ class EventPollerTest : public ::testing::Test { EXPECT_NE(engine_, nullptr); scheduler_->ChangeCurrentEventEngine(engine_.get()); if (g_event_poller != nullptr) { - gpr_log(GPR_INFO, "Using poller: %s", g_event_poller->Name().c_str()); + LOG(INFO) << "Using poller: " << g_event_poller->Name(); } } diff --git a/test/core/event_engine/posix/posix_endpoint_test.cc b/test/core/event_engine/posix/posix_endpoint_test.cc index b88c9f608c9..5effe01234e 100644 --- a/test/core/event_engine/posix/posix_endpoint_test.cc +++ b/test/core/event_engine/posix/posix_endpoint_test.cc @@ -24,6 +24,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_split.h" @@ -203,7 +204,7 @@ class PosixEndpointTest : public ::testing::TestWithParam { EXPECT_NE(posix_ee_, nullptr); scheduler_->ChangeCurrentEventEngine(posix_ee_.get()); if (poller_ != nullptr) { - gpr_log(GPR_INFO, "Using poller: %s", poller_->Name().c_str()); + LOG(INFO) << "Using poller: " << poller_->Name(); } } diff --git a/test/core/event_engine/posix/posix_engine_listener_utils_test.cc b/test/core/event_engine/posix/posix_engine_listener_utils_test.cc index a3f3587a597..319d8098b06 100644 --- a/test/core/event_engine/posix/posix_engine_listener_utils_test.cc +++ b/test/core/event_engine/posix/posix_engine_listener_utils_test.cc @@ -33,7 +33,7 @@ #include -#include +#include "absl/log/log.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" #include "src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h" @@ -108,9 +108,8 @@ TEST(PosixEngineListenerUtils, ListenerContainerAddAllLocalAddressesTest) { struct ifaddrs* ifa_it; if (getifaddrs(&ifa) != 0 || ifa == nullptr) { // No ifaddresses available. - gpr_log(GPR_INFO, - "Skipping ListenerAddAllLocalAddressesTest because the machine " - "does not have interfaces configured for listening."); + LOG(INFO) << "Skipping ListenerAddAllLocalAddressesTest because the " + "machine does not have interfaces configured for listening."; return; } int num_ifaddrs = 0; @@ -123,9 +122,9 @@ TEST(PosixEngineListenerUtils, ListenerContainerAddAllLocalAddressesTest) { if (num_ifaddrs == 0 || !result.ok()) { // Its possible that the machine may not have any Ipv4/Ipv6 interfaces // configured for listening. In that case, dont fail test. - gpr_log(GPR_INFO, - "Skipping ListenerAddAllLocalAddressesTest because the machine " - "does not have Ipv6/Ipv6 interfaces configured for listening."); + LOG(INFO) << "Skipping ListenerAddAllLocalAddressesTest because the " + "machine does not have Ipv6/Ipv6 interfaces configured for " + "listening."; return; } // Some sockets have been created and bound to interfaces on the machiene. diff --git a/test/core/event_engine/posix/posix_engine_test_utils.cc b/test/core/event_engine/posix/posix_engine_test_utils.cc index fabceaf167c..6f35b9065b9 100644 --- a/test/core/event_engine/posix/posix_engine_test_utils.cc +++ b/test/core/event_engine/posix/posix_engine_test_utils.cc @@ -20,10 +20,9 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_format.h" -#include - #include "src/core/lib/gprpp/crash.h" namespace grpc_event_engine { @@ -53,7 +52,7 @@ int ConnectToServerOrDie(const ResolvedAddress& server_address) { pfd.events = POLLOUT; pfd.revents = 0; if (poll(&pfd, 1, -1) == -1) { - gpr_log(GPR_ERROR, "poll() failed during connect; errno=%d", errno); + LOG(ERROR) << "poll() failed during connect; errno=" << errno; abort(); } } else { diff --git a/test/core/event_engine/posix/posix_event_engine_connect_test.cc b/test/core/event_engine/posix/posix_event_engine_connect_test.cc index 294c7731742..bf89dafc3fb 100644 --- a/test/core/event_engine/posix/posix_event_engine_connect_test.cc +++ b/test/core/event_engine/posix/posix_event_engine_connect_test.cc @@ -27,6 +27,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/memory/memory.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -37,7 +38,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/event_engine/channel_args_endpoint_config.h" @@ -121,7 +121,7 @@ std::vector CreateConnectedSockets( pfd.revents = 0; int ret = poll(&pfd, 1, 1000); if (ret == -1) { - gpr_log(GPR_ERROR, "poll() failed during connect; errno=%d", errno); + LOG(ERROR) << "poll() failed during connect; errno=" << errno; abort(); } else if (ret == 0) { // current connection attempt timed out. It indicates that the diff --git a/test/core/event_engine/posix/timer_manager_test.cc b/test/core/event_engine/posix/timer_manager_test.cc index fc2698a35a4..1cfe58a2d80 100644 --- a/test/core/event_engine/posix/timer_manager_test.cc +++ b/test/core/event_engine/posix/timer_manager_test.cc @@ -19,12 +19,12 @@ #include #include "absl/functional/any_invocable.h" +#include "absl/log/log.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "gtest/gtest.h" #include -#include #include "src/core/lib/event_engine/common_closures.h" #include "src/core/lib/event_engine/posix_engine/timer.h" @@ -66,8 +66,8 @@ TEST(TimerManagerTest, StressTest) { << called.load(std::memory_order_relaxed) << "/" << kTimerCount << " callbacks executed"; } - gpr_log(GPR_DEBUG, "Processed %d/%d callbacks", - called.load(std::memory_order_relaxed), kTimerCount); + VLOG(2) << "Processed " << called.load(std::memory_order_relaxed) << "/" + << kTimerCount << " callbacks"; absl::SleepFor(absl::Milliseconds(333)); } } diff --git a/test/core/event_engine/test_suite/tests/dns_test.cc b/test/core/event_engine/test_suite/tests/dns_test.cc index 5f305ee0e16..6243bbdb49f 100644 --- a/test/core/event_engine/test_suite/tests/dns_test.cc +++ b/test/core/event_engine/test_suite/tests/dns_test.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" @@ -128,9 +129,8 @@ class EventEngineDNSTest : public EventEngineTest { // an indication whether the test is running on RBE or not. Find a better way of // doing this. #ifndef GRPC_PORT_ISOLATED_RUNTIME - gpr_log(GPR_ERROR, - "You are invoking the test locally with Bazel, you may need to " - "invoke Bazel with --enable_runfiles=yes."); + LOG(ERROR) << "You are invoking the test locally with Bazel, you may " + "need to invoke Bazel with --enable_runfiles=yes."; #endif // GRPC_PORT_ISOLATED_RUNTIME test_records_path = grpc::testing::NormalizeFilePath(test_records_path); dns_server_path = diff --git a/test/core/event_engine/test_suite/tests/timer_test.cc b/test/core/event_engine/test_suite/tests/timer_test.cc index e4b6f2986e6..543f5c97d2c 100644 --- a/test/core/event_engine/test_suite/tests/timer_test.cc +++ b/test/core/event_engine/test_suite/tests/timer_test.cc @@ -26,13 +26,13 @@ #include "absl/functional/any_invocable.h" #include "absl/functional/bind_front.h" #include "absl/functional/function_ref.h" +#include "absl/log/log.h" #include "absl/time/clock.h" #include "absl/time/time.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include -#include #include "src/core/lib/event_engine/time_util.h" #include "src/core/lib/gprpp/sync.h" @@ -197,8 +197,8 @@ TEST_F(EventEngineTimerTest, StressTestTimersNotCalledBeforeScheduled) { cv_.Wait(&mu_); } if (failed_call_count.load() != 0) { - gpr_log(GPR_DEBUG, "failed timer count: %d of %d", failed_call_count.load(), - thread_count * call_count); + VLOG(2) << "failed timer count: " << failed_call_count.load() << " of " + << (thread_count * call_count); } ASSERT_EQ(0, failed_call_count.load()); } diff --git a/test/core/event_engine/test_suite/tools/echo_client.cc b/test/core/event_engine/test_suite/tools/echo_client.cc index 2ab12b61801..afc109e78ed 100644 --- a/test/core/event_engine/test_suite/tools/echo_client.cc +++ b/test/core/event_engine/test_suite/tools/echo_client.cc @@ -39,6 +39,7 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" #include "absl/functional/any_invocable.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" @@ -46,7 +47,6 @@ #include #include #include -#include #include "src/core/lib/channel/channel_args_preconditioning.h" #include "src/core/lib/config/core_configuration.h" @@ -93,14 +93,12 @@ void ReceiveAndEchoMessage(EventEngine::Endpoint* endpoint, int message_id) { endpoint->Read( [&](absl::Status status) { if (!status.ok()) { - gpr_log(GPR_ERROR, "Error reading from endpoint: %s", - status.ToString().c_str()); + LOG(ERROR) << "Error reading from endpoint: " << status; exit(1); } Slice received = buf.TakeFirst(); - gpr_log(GPR_ERROR, "Received message %d: %.*s", message_id, - static_cast(received.as_string_view().length()), - received.as_string_view().data()); + LOG(ERROR) << "Received message " << message_id << ": " + << received.as_string_view(); read_done.Notify(); }, &buf, nullptr); @@ -124,8 +122,7 @@ void RunUntilInterrupted() { engine->Connect( [&](absl::StatusOr> ep) { if (!ep.ok()) { - gpr_log(GPR_ERROR, "Error connecting: %s", - ep.status().ToString().c_str()); + LOG(ERROR) << "Error connecting: " << ep.status().ToString(); exit(1); } endpoint = std::move(*ep); @@ -134,10 +131,10 @@ void RunUntilInterrupted() { *addr, config, memory_quota->CreateMemoryAllocator("client"), 2h); connected.WaitForNotification(); CHECK_NE(endpoint.get(), nullptr); - gpr_log(GPR_DEBUG, "peer addr: %s", - ResolvedAddressToString(endpoint->GetPeerAddress())->c_str()); - gpr_log(GPR_DEBUG, "local addr: %s", - ResolvedAddressToString(endpoint->GetLocalAddress())->c_str()); + VLOG(2) << "peer addr: " + << ResolvedAddressToString(endpoint->GetPeerAddress()); + VLOG(2) << "local addr: " + << ResolvedAddressToString(endpoint->GetLocalAddress()); int message_id = 0; while (true) { SendMessage(endpoint.get(), message_id++); diff --git a/test/core/event_engine/windows/create_sockpair.cc b/test/core/event_engine/windows/create_sockpair.cc index 85d5a20b5ee..3817f98ac6f 100644 --- a/test/core/event_engine/windows/create_sockpair.cc +++ b/test/core/event_engine/windows/create_sockpair.cc @@ -18,6 +18,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/status.h" #include "src/core/lib/event_engine/windows/win_socket.h" @@ -55,10 +56,8 @@ void CreateSockpair(SOCKET sockpair[2], DWORD flags) { auto result = WSAConnect(cli_sock, (sockaddr*)&addr, addr_len, NULL, NULL, NULL, NULL); if (result != 0) { - gpr_log(GPR_DEBUG, "%s", - GRPC_WSA_ERROR(WSAGetLastError(), "Failed in WSAConnect") - .ToString() - .c_str()); + VLOG(2) + << GRPC_WSA_ERROR(WSAGetLastError(), "Failed in WSAConnect").ToString(); abort(); } svr_sock = accept(lst_sock, (sockaddr*)&addr, &addr_len); @@ -72,13 +71,11 @@ void CreateSockpair(SOCKET sockpair[2], DWORD flags) { // logged status. WSAEINVAL is expected. auto status = PrepareSocket(cli_sock); // if (!status.ok()) { - // gpr_log(GPR_DEBUG, "Error preparing client socket: %s", - // status.ToString().c_str()); + // VLOG(2) << "Error preparing client socket: " << status.ToString(); // } status = PrepareSocket(svr_sock); // if (!status.ok()) { - // gpr_log(GPR_DEBUG, "Error preparing server socket: %s", - // status.ToString().c_str()); + // VLOG(2) << "Error preparing server socket: " << status.ToString(); // } sockpair[0] = svr_sock; diff --git a/test/core/gprpp/examine_stack_test.cc b/test/core/gprpp/examine_stack_test.cc index bb3f7f37298..f9384842c7d 100644 --- a/test/core/gprpp/examine_stack_test.cc +++ b/test/core/gprpp/examine_stack_test.cc @@ -20,11 +20,10 @@ #include "absl/debugging/stacktrace.h" #include "absl/debugging/symbolize.h" +#include "absl/log/log.h" #include "gmock/gmock.h" #include "gtest/gtest.h" -#include - namespace { std::string SimpleCurrentStackTraceProvider() { return "stacktrace"; } @@ -67,7 +66,7 @@ TEST(ExamineStackTest, AbseilStackProvider) { const absl::optional stack_trace = grpc_core::GetCurrentStackTrace(); EXPECT_NE(stack_trace, absl::nullopt); - gpr_log(GPR_INFO, "stack_trace=%s", stack_trace->c_str()); + LOG(INFO) << "stack_trace=" << *stack_trace; #if !defined(NDEBUG) && !defined(GPR_MUSL_LIBC_COMPAT) // Expect to see some gtest signature on the stack (this used to be // GetCurrentStackTrace, but some operating systems have trouble with the leaf diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc index 2c7d7ee2aa2..773ee18ed08 100644 --- a/test/core/http/httpcli_test.cc +++ b/test/core/http/httpcli_test.cc @@ -30,6 +30,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/time/clock.h" @@ -39,7 +40,6 @@ #include #include #include -#include #include #include @@ -163,8 +163,8 @@ void OnFinish(void* arg, grpc_error_handle error) { "Hello world!" "

This is a test

"; grpc_http_response response = request_state->response; - gpr_log(GPR_INFO, "response status=%d error=%s", response.status, - grpc_core::StatusToString(error).c_str()); + LOG(INFO) << "response status=" << response.status + << " error=" << grpc_core::StatusToString(error); CHECK(error.ok()); CHECK_EQ(response.status, 200); CHECK(response.body_length == strlen(expect)); @@ -182,8 +182,8 @@ void OnFinishExpectFailure(void* arg, grpc_error_handle error) { grpc_pollset_set_destroy(request_state->pollset_set_to_destroy_eagerly); } grpc_http_response response = request_state->response; - gpr_log(GPR_INFO, "response status=%d error=%s", response.status, - grpc_core::StatusToString(error).c_str()); + LOG(INFO) << "response status=" << response.status + << " error=" << grpc_core::StatusToString(error); CHECK(!error.ok()); request_state->test->RunAndKick( [request_state]() { request_state->done = true; }); @@ -194,7 +194,7 @@ TEST_F(HttpRequestTest, Get) { grpc_http_request req; grpc_core::ExecCtx exec_ctx; std::string host = absl::StrFormat("localhost:%d", g_server_port); - gpr_log(GPR_INFO, "requesting from %s", host.c_str()); + LOG(INFO) << "requesting from " << host; memset(&req, 0, sizeof(req)); auto uri = grpc_core::URI::Create("http", host, "/get", {} /* query params */, "" /* fragment */); @@ -218,7 +218,7 @@ TEST_F(HttpRequestTest, Post) { grpc_http_request req; grpc_core::ExecCtx exec_ctx; std::string host = absl::StrFormat("localhost:%d", g_server_port); - gpr_log(GPR_INFO, "posting to %s", host.c_str()); + LOG(INFO) << "posting to " << host; memset(&req, 0, sizeof(req)); req.body = const_cast("hello"); req.body_length = 5; @@ -242,9 +242,8 @@ TEST_F(HttpRequestTest, Post) { int g_fake_non_responsive_dns_server_port; void InjectNonResponsiveDNSServer(ares_channel* channel) { - gpr_log(GPR_DEBUG, - "Injecting broken nameserver list. Bad server address:|[::1]:%d|.", - g_fake_non_responsive_dns_server_port); + VLOG(2) << "Injecting broken nameserver list. Bad server address:|[::1]:" + << g_fake_non_responsive_dns_server_port << "|."; // Configure a non-responsive DNS server at the front of c-ares's nameserver // list. struct ares_addr_port_node dns_server_addrs[1]; @@ -492,10 +491,9 @@ TEST_F(HttpRequestTest, CallerPollentsAreNotReferencedAfterCallbackIsRan) { } void CancelRequest(grpc_core::HttpRequest* req) { - gpr_log( - GPR_INFO, - "test only HttpRequest::OnHandshakeDone intercept orphaning request: %p", - req); + LOG(INFO) << "test only HttpRequest::OnHandshakeDone intercept orphaning " + "request: " + << req; req->Orphan(); } @@ -511,7 +509,7 @@ TEST_F(HttpRequestTest, grpc_http_request req; grpc_core::ExecCtx exec_ctx; std::string host = absl::StrFormat("localhost:%d", g_server_port); - gpr_log(GPR_INFO, "requesting from %s", host.c_str()); + LOG(INFO) << "requesting from " << host; memset(&req, 0, sizeof(req)); auto uri = grpc_core::URI::Create("http", host, "/get", {} /* query params */, "" /* fragment */); diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc index 55a559240b4..8bdf220bee2 100644 --- a/test/core/http/httpscli_test.cc +++ b/test/core/http/httpscli_test.cc @@ -29,6 +29,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/status/statusor.h" #include "absl/strings/str_format.h" #include "absl/time/clock.h" @@ -37,7 +38,6 @@ #include #include #include -#include #include #include @@ -163,8 +163,8 @@ void OnFinish(void* arg, grpc_error_handle error) { "Hello world!" "

This is a test

"; grpc_http_response response = request_state->response; - gpr_log(GPR_INFO, "response status=%d error=%s", response.status, - grpc_core::StatusToString(error).c_str()); + LOG(INFO) << "response status=" << response.status + << " error=" << grpc_core::StatusToString(error); CHECK(error.ok()); CHECK_EQ(response.status, 200); CHECK(response.body_length == strlen(expect)); @@ -176,8 +176,8 @@ void OnFinish(void* arg, grpc_error_handle error) { void OnFinishExpectFailure(void* arg, grpc_error_handle error) { RequestState* request_state = static_cast(arg); grpc_http_response response = request_state->response; - gpr_log(GPR_INFO, "response status=%d error=%s", response.status, - grpc_core::StatusToString(error).c_str()); + LOG(INFO) << "response status=" << response.status + << " error=" << grpc_core::StatusToString(error); CHECK(!error.ok()); request_state->test->RunAndKick( [request_state]() { request_state->done = true; }); @@ -188,7 +188,7 @@ TEST_F(HttpsCliTest, Get) { grpc_http_request req; grpc_core::ExecCtx exec_ctx; std::string host = absl::StrFormat("localhost:%d", g_server_port); - gpr_log(GPR_INFO, "requesting from %s", host.c_str()); + LOG(INFO) << "requesting from " << host; memset(&req, 0, sizeof(req)); grpc_arg ssl_override_arg = grpc_channel_arg_string_create( const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), @@ -214,7 +214,7 @@ TEST_F(HttpsCliTest, Post) { grpc_http_request req; grpc_core::ExecCtx exec_ctx; std::string host = absl::StrFormat("localhost:%d", g_server_port); - gpr_log(GPR_INFO, "posting to %s", host.c_str()); + LOG(INFO) << "posting to " << host; memset(&req, 0, sizeof(req)); req.body = const_cast("hello"); req.body_length = 5; diff --git a/test/core/iomgr/error_test.cc b/test/core/iomgr/error_test.cc index 1abe1eca76e..165158b06b9 100644 --- a/test/core/iomgr/error_test.cc +++ b/test/core/iomgr/error_test.cc @@ -22,9 +22,10 @@ #include +#include "absl/log/log.h" + #include #include -#include #include "src/core/lib/gprpp/crash.h" #include "test/core/test_util/test_config.h" @@ -148,7 +149,7 @@ TEST(ErrorTest, PrintErrorString) { error = grpc_error_set_int(error, grpc_core::StatusIntProperty::kSize, 666); error = grpc_error_set_str(error, grpc_core::StatusStrProperty::kGrpcMessage, "message"); - // gpr_log(GPR_DEBUG, "%s", grpc_core::StatusToString(error).c_str()); + // VLOG(2) << grpc_core::StatusToString(error); } TEST(ErrorTest, PrintErrorStringReference) { diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index 22c24827104..8497b62591a 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -36,11 +36,11 @@ #include #include +#include "absl/log/log.h" #include "absl/strings/str_format.h" #include #include -#include #include #include @@ -396,7 +396,7 @@ static void test_grpc_fd(void) { client_wait_and_shutdown(&cl); server_wait_and_shutdown(&sv); ASSERT_EQ(sv.read_bytes_total, cl.write_bytes_total); - gpr_log(GPR_INFO, "Total read bytes %" PRIdPTR, sv.read_bytes_total); + LOG(INFO) << "Total read bytes " << sv.read_bytes_total; } typedef struct fd_change_data { diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index 8dc158ddf9d..ec5834646dc 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -26,11 +26,11 @@ #include "absl/functional/bind_front.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/match.h" #include #include -#include #include #include @@ -102,8 +102,7 @@ class ResolveAddressTest : public ::testing::Test { break; } grpc_core::Duration time_left = deadline - grpc_core::Timestamp::Now(); - gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64, done_, - time_left.millis()); + VLOG(2) << "done=" << done_ << ", time_left=" << time_left.millis(); ASSERT_GE(time_left, grpc_core::Duration::Zero()); grpc_pollset_worker* worker = nullptr; GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(pollset_, &worker, @@ -392,9 +391,8 @@ namespace { int g_fake_non_responsive_dns_server_port; void InjectNonResponsiveDNSServer(ares_channel* channel) { - gpr_log(GPR_DEBUG, - "Injecting broken nameserver list. Bad server address:|[::1]:%d|.", - g_fake_non_responsive_dns_server_port); + VLOG(2) << "Injecting broken nameserver list. Bad server address:|[::1]:" + << g_fake_non_responsive_dns_server_port << "|."; // Configure a non-responsive DNS server at the front of c-ares's nameserver // list. struct ares_addr_port_node dns_server_addrs[1]; @@ -450,7 +448,7 @@ class PollsetSetWrapper { grpc_core::ExecCtx::Get()->Flush(); grpc_pollset_destroy(ps_); gpr_free(ps_); - gpr_log(GPR_DEBUG, "PollsetSetWrapper:%p deleted", this); + VLOG(2) << "PollsetSetWrapper:" << this << " deleted"; } grpc_pollset_set* pollset_set() { return pss_; } @@ -461,7 +459,7 @@ class PollsetSetWrapper { grpc_pollset_init(ps_, &mu_); pss_ = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(pss_, ps_); - gpr_log(GPR_DEBUG, "PollsetSetWrapper:%p created", this); + VLOG(2) << "PollsetSetWrapper:" << this << " created"; } gpr_mu* mu_; diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc index 9f50defcc42..6117be2beb1 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -37,10 +37,10 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include -#include #include #include "src/core/lib/event_engine/channel_args_endpoint_config.h" @@ -171,8 +171,8 @@ static void read_cb(void* user_data, grpc_error_handle error) { read_bytes = count_slices(state->incoming.slices, state->incoming.count, ¤t_data); state->read_bytes += read_bytes; - gpr_log(GPR_INFO, "Read %" PRIuPTR " bytes of %" PRIuPTR, read_bytes, - state->target_read_bytes); + LOG(INFO) << "Read " << read_bytes << " bytes of " + << state->target_read_bytes; if (state->read_bytes >= state->target_read_bytes) { CHECK(GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(g_pollset, nullptr))); gpr_mu_unlock(g_mu); @@ -195,8 +195,8 @@ static void read_test(size_t num_bytes, size_t slice_size, grpc_timeout_milliseconds_to_deadline(kDeadlineMillis)); grpc_core::ExecCtx exec_ctx; - gpr_log(GPR_INFO, "Read test of size %" PRIuPTR ", slice size %" PRIuPTR, - num_bytes, slice_size); + LOG(INFO) << "Read test of size " << num_bytes << ", slice size " + << slice_size; create_sockets(sv); @@ -218,7 +218,7 @@ static void read_test(size_t num_bytes, size_t slice_size, grpc_endpoint_add_to_pollset(ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); - gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes); + LOG(INFO) << "Wrote " << written_bytes << " bytes"; state.ep = ep; state.read_bytes = 0; @@ -260,7 +260,7 @@ static void large_read_test(size_t slice_size, int min_progress_size) { grpc_timeout_milliseconds_to_deadline(kDeadlineMillis)); grpc_core::ExecCtx exec_ctx; - gpr_log(GPR_INFO, "Start large read test, slice size %" PRIuPTR, slice_size); + LOG(INFO) << "Start large read test, slice size " << slice_size; create_sockets(sv); @@ -282,7 +282,7 @@ static void large_read_test(size_t slice_size, int min_progress_size) { grpc_endpoint_add_to_pollset(ep, g_pollset); written_bytes = fill_socket(sv[0]); - gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes); + LOG(INFO) << "Wrote " << written_bytes << " bytes"; state.ep = ep; state.read_bytes = 0; @@ -411,9 +411,8 @@ static void write_test(size_t num_bytes, size_t slice_size) { grpc_timeout_milliseconds_to_deadline(kDeadlineMillis)); grpc_core::ExecCtx exec_ctx; - gpr_log(GPR_INFO, - "Start write test with %" PRIuPTR " bytes, slice size %" PRIuPTR, - num_bytes, slice_size); + LOG(INFO) << "Start write test with " << num_bytes << " bytes, slice size " + << slice_size; create_sockets(sv); @@ -496,9 +495,8 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { GRPC_CLOSURE_INIT(&fd_released_cb, &on_fd_released, &rel_fd, grpc_schedule_on_exec_ctx); - gpr_log(GPR_INFO, - "Release fd read_test of size %" PRIuPTR ", slice size %" PRIuPTR, - num_bytes, slice_size); + LOG(INFO) << "Release fd read_test of size " << num_bytes << ", slice size " + << slice_size; create_sockets(sv); @@ -538,7 +536,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { grpc_endpoint_add_to_pollset(ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); - gpr_log(GPR_INFO, "Wrote %" PRIuPTR " bytes", written_bytes); + LOG(INFO) << "Wrote " << written_bytes << " bytes"; state.ep = ep; state.read_bytes = 0; @@ -555,8 +553,8 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { grpc_pollset_worker* worker = nullptr; CHECK(GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(g_pollset, &worker, deadline))); - gpr_log(GPR_DEBUG, "wakeup: read=%" PRIdPTR " target=%" PRIdPTR, - state.read_bytes, state.target_read_bytes); + VLOG(2) << "wakeup: read=" << state.read_bytes + << " target=" << state.target_read_bytes; gpr_mu_unlock(g_mu); grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); diff --git a/test/core/json/json_test.cc b/test/core/json/json_test.cc index 9cd1264c079..cf9f68cf212 100644 --- a/test/core/json/json_test.cc +++ b/test/core/json/json_test.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/match.h" @@ -29,8 +30,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include - #include "src/core/util/json/json_reader.h" #include "src/core/util/json/json_writer.h" #include "test/core/test_util/test_config.h" @@ -79,7 +78,7 @@ void ValidateValue(const Json& actual, const Json& expected) { void RunSuccessTest(const char* input, const Json& expected, const char* expected_output) { - gpr_log(GPR_INFO, "parsing string \"%s\" - should succeed", input); + LOG(INFO) << "parsing string \"" << input << "\" - should succeed"; auto json = JsonParse(input); ASSERT_TRUE(json.ok()) << json.status(); ValidateValue(*json, expected); @@ -200,7 +199,7 @@ TEST(Json, Keywords) { } void RunParseFailureTest(const char* input) { - gpr_log(GPR_INFO, "parsing string \"%s\" - should fail", input); + LOG(INFO) << "parsing string \"" << input << "\" - should fail"; auto json = JsonParse(input); EXPECT_FALSE(json.ok()) << "input: \"" << input << "\""; } diff --git a/test/core/memory_usage/client.cc b/test/core/memory_usage/client.cc index 3ba5ac650da..0730d977224 100644 --- a/test/core/memory_usage/client.cc +++ b/test/core/memory_usage/client.cc @@ -28,6 +28,7 @@ #include "absl/flags/flag.h" #include "absl/flags/parse.h" #include "absl/log/check.h" +#include "absl/log/log.h" #include "absl/strings/match.h" #include @@ -39,7 +40,6 @@ #include #include #include -#include #include #include "src/core/lib/channel/channel_args.h" @@ -161,9 +161,9 @@ static MemStats send_snapshot_request(int call_idx, grpc_slice call_type) { (void*)nullptr, nullptr)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); - gpr_log(GPR_INFO, "Call %d status %d (%s)", call_idx, calls[call_idx].status, - std::string(grpc_core::StringViewFromSlice(calls[call_idx].details)) - .c_str()); + LOG(INFO) << "Call " << call_idx << " status " << calls[call_idx].status + << " (" << grpc_core::StringViewFromSlice(calls[call_idx].details) + << ")"; CHECK_NE(response_payload_recv, nullptr); grpc_byte_buffer_reader reader; diff --git a/test/core/promise/sleep_test.cc b/test/core/promise/sleep_test.cc index 371a7c08fa8..0d83460f0b8 100644 --- a/test/core/promise/sleep_test.cc +++ b/test/core/promise/sleep_test.cc @@ -20,11 +20,11 @@ #include #include +#include "absl/log/log.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include -#include #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/notification.h" @@ -156,7 +156,7 @@ TEST(Sleep, StressTest) { std::vector> notifications; std::vector activities; auto engine = GetDefaultEventEngine(); - gpr_log(GPR_INFO, "Starting %d sleeps for 1sec", kNumActivities); + LOG(INFO) << "Starting " << kNumActivities << " sleeps for 1sec"; for (int i = 0; i < kNumActivities; i++) { auto notification = std::make_shared(); auto activity = MakeActivity( @@ -167,9 +167,8 @@ TEST(Sleep, StressTest) { notifications.push_back(std::move(notification)); activities.push_back(std::move(activity)); } - gpr_log(GPR_INFO, - "Waiting for the first %d sleeps, whilst cancelling the other half", - kNumActivities / 2); + LOG(INFO) << "Waiting for the first " << (kNumActivities / 2) + << " sleeps, whilst cancelling the other half"; for (size_t i = 0; i < kNumActivities / 2; i++) { notifications[i]->WaitForNotification(); activities[i].reset(); diff --git a/test/core/resolver/binder_resolver_test.cc b/test/core/resolver/binder_resolver_test.cc index b4558ccbe4d..9fad73a6704 100644 --- a/test/core/resolver/binder_resolver_test.cc +++ b/test/core/resolver/binder_resolver_test.cc @@ -43,8 +43,9 @@ #include #endif // GPR_WINDOWS +#include "absl/log/log.h" + #include -#include #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/resolver/resolver_registry.h" @@ -120,8 +121,8 @@ class BinderResolverTest : public ::testing::Test { }; void TestSucceeds(const char* string, const std::string& expected_path) { - gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string, - std::string(factory_->scheme()).c_str()); + VLOG(2) << "test: '" << string << "' should be valid for '" + << factory_->scheme(); grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(string); ASSERT_TRUE(uri.ok()) << uri.status().ToString(); @@ -136,8 +137,8 @@ class BinderResolverTest : public ::testing::Test { } void TestFails(const char* string) { - gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string, - std::string(factory_->scheme()).c_str()); + VLOG(2) << "test: '" << string << "' should be invalid for '" + << factory_->scheme(); grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(string); ASSERT_TRUE(uri.ok()) << uri.status().ToString(); diff --git a/test/core/resolver/dns_resolver_cooldown_test.cc b/test/core/resolver/dns_resolver_cooldown_test.cc index 71127572aad..0bc27e4b3c0 100644 --- a/test/core/resolver/dns_resolver_cooldown_test.cc +++ b/test/core/resolver/dns_resolver_cooldown_test.cc @@ -24,6 +24,7 @@ #include #include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" @@ -34,7 +35,6 @@ #include #include #include -#include #include #include @@ -188,11 +188,10 @@ static grpc_ares_request* test_dns_lookup_ares( static auto last_resolution_time = grpc_core::Timestamp::ProcessEpoch(); auto now = grpc_core::Timestamp::FromTimespecRoundUp(gpr_now(GPR_CLOCK_MONOTONIC)); - gpr_log(GPR_DEBUG, - "last_resolution_time:%" PRId64 " now:%" PRId64 - " min_time_between:%d", - last_resolution_time.milliseconds_after_process_epoch(), - now.milliseconds_after_process_epoch(), kMinResolutionPeriodMs); + VLOG(2) << "last_resolution_time:" + << last_resolution_time.milliseconds_after_process_epoch() + << " now:" << now.milliseconds_after_process_epoch() + << " min_time_between:" << kMinResolutionPeriodMs; if (last_resolution_time != grpc_core::Timestamp::ProcessEpoch()) { EXPECT_GE(now - last_resolution_time, grpc_core::Duration::Milliseconds(kMinResolutionPeriodMs)); @@ -253,7 +252,7 @@ static void poll_pollset_until_request_done(iomgr_args* args) { break; } grpc_core::Duration time_left = deadline - grpc_core::Timestamp::Now(); - gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64, done, time_left.millis()); + VLOG(2) << "done=" << done << ", time_left=" << time_left.millis(); ASSERT_GE(time_left, grpc_core::Duration::Zero()); grpc_pollset_worker* worker = nullptr; gpr_mu_lock(args->mu); @@ -311,7 +310,7 @@ static grpc_core::NoDestruct g_all_callbacks_invoked; // from "Now()". Thus the more rounds ran, the more highlighted the // difference is between absolute and relative times values. static void on_fourth_resolution(OnResolutionCallbackArg* cb_arg) { - gpr_log(GPR_INFO, "4th: g_resolution_count: %d", g_resolution_count); + LOG(INFO) << "4th: g_resolution_count: " << g_resolution_count; ASSERT_EQ(g_resolution_count, 4); cb_arg->resolver.reset(); gpr_atm_rel_store(&g_iomgr_args.done_atm, 1); @@ -324,7 +323,7 @@ static void on_fourth_resolution(OnResolutionCallbackArg* cb_arg) { } static void on_third_resolution(OnResolutionCallbackArg* cb_arg) { - gpr_log(GPR_INFO, "3rd: g_resolution_count: %d", g_resolution_count); + LOG(INFO) << "3rd: g_resolution_count: " << g_resolution_count; ASSERT_EQ(g_resolution_count, 3); cb_arg->result_handler->SetCallback(on_fourth_resolution, cb_arg); cb_arg->resolver->RequestReresolutionLocked(); @@ -335,7 +334,7 @@ static void on_third_resolution(OnResolutionCallbackArg* cb_arg) { } static void on_second_resolution(OnResolutionCallbackArg* cb_arg) { - gpr_log(GPR_INFO, "2nd: g_resolution_count: %d", g_resolution_count); + LOG(INFO) << "2nd: g_resolution_count: " << g_resolution_count; // The resolution callback was not invoked until new data was // available, which was delayed until after the cooldown period. ASSERT_EQ(g_resolution_count, 2); @@ -348,7 +347,7 @@ static void on_second_resolution(OnResolutionCallbackArg* cb_arg) { } static void on_first_resolution(OnResolutionCallbackArg* cb_arg) { - gpr_log(GPR_INFO, "1st: g_resolution_count: %d", g_resolution_count); + LOG(INFO) << "1st: g_resolution_count: " << g_resolution_count; // There's one initial system-level resolution and one invocation of a // notification callback (the current function). ASSERT_EQ(g_resolution_count, 1); @@ -369,10 +368,10 @@ static void start_test_under_work_serializer(void* arg) { .LookupResolverFactory("dns"); absl::StatusOr uri = grpc_core::URI::Parse(res_cb_arg->uri_str); - gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", res_cb_arg->uri_str, - std::string(factory->scheme()).c_str()); + VLOG(2) << "test: '" << res_cb_arg->uri_str << "' should be valid for '" + << factory->scheme() << "'"; if (!uri.ok()) { - gpr_log(GPR_ERROR, "%s", uri.status().ToString().c_str()); + LOG(ERROR) << uri.status(); ASSERT_TRUE(uri.ok()); } grpc_core::ResolverArgs args; diff --git a/test/core/resolver/dns_resolver_test.cc b/test/core/resolver/dns_resolver_test.cc index e3650b05df0..14bb534ed43 100644 --- a/test/core/resolver/dns_resolver_test.cc +++ b/test/core/resolver/dns_resolver_test.cc @@ -20,13 +20,12 @@ #include #include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/string_view.h" #include "gtest/gtest.h" -#include - #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/config_vars.h" #include "src/core/lib/config/core_configuration.h" @@ -50,8 +49,8 @@ class TestResultHandler : public grpc_core::Resolver::ResultHandler { static void test_succeeds(grpc_core::ResolverFactory* factory, const char* string) { - gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string, - std::string(factory->scheme()).c_str()); + VLOG(2) << "test: '" << string << "' should be valid for '" + << factory->scheme() << "'"; grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(string); if (!uri.ok()) { @@ -69,8 +68,8 @@ static void test_succeeds(grpc_core::ResolverFactory* factory, static void test_fails(grpc_core::ResolverFactory* factory, const char* string) { - gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string, - std::string(factory->scheme()).c_str()); + VLOG(2) << "test: '" << string << "' should be invalid for '" + << factory->scheme() << "'"; grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(string); if (!uri.ok()) { diff --git a/test/core/resolver/sockaddr_resolver_test.cc b/test/core/resolver/sockaddr_resolver_test.cc index 08bdab66f44..a4aa4bc068d 100644 --- a/test/core/resolver/sockaddr_resolver_test.cc +++ b/test/core/resolver/sockaddr_resolver_test.cc @@ -20,12 +20,11 @@ #include #include +#include "absl/log/log.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "gtest/gtest.h" -#include - #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/event_engine/default_event_engine.h" #include "src/core/lib/gprpp/orphanable.h" @@ -47,12 +46,12 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler { static void test_succeeds(grpc_core::ResolverFactory* factory, const char* string) { - gpr_log(GPR_DEBUG, "test: '%s' should be valid for '%s'", string, - std::string(factory->scheme()).c_str()); + VLOG(2) << "test: '" << string << "' should be valid for '" + << factory->scheme() << "'"; grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(string); if (!uri.ok()) { - gpr_log(GPR_ERROR, "%s", uri.status().ToString().c_str()); + LOG(ERROR) << uri.status().ToString(); ASSERT_TRUE(uri.ok()); } grpc_core::ResolverArgs args; @@ -70,12 +69,12 @@ static void test_succeeds(grpc_core::ResolverFactory* factory, static void test_fails(grpc_core::ResolverFactory* factory, const char* string) { - gpr_log(GPR_DEBUG, "test: '%s' should be invalid for '%s'", string, - std::string(factory->scheme()).c_str()); + VLOG(2) << "test: '" << string << "' should be invalid for '" + << factory->scheme() << "'"; grpc_core::ExecCtx exec_ctx; absl::StatusOr uri = grpc_core::URI::Parse(string); if (!uri.ok()) { - gpr_log(GPR_ERROR, "%s", uri.status().ToString().c_str()); + LOG(ERROR) << uri.status().ToString(); ASSERT_TRUE(uri.ok()); } grpc_core::ResolverArgs args; diff --git a/test/core/resource_quota/memory_quota_stress_test.cc b/test/core/resource_quota/memory_quota_stress_test.cc index e756040ec5c..ab1634c3775 100644 --- a/test/core/resource_quota/memory_quota_stress_test.cc +++ b/test/core/resource_quota/memory_quota_stress_test.cc @@ -25,13 +25,13 @@ #include #include "absl/base/thread_annotations.h" +#include "absl/log/log.h" #include "absl/strings/str_cat.h" #include "absl/types/optional.h" #include "gtest/gtest.h" #include #include -#include #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/exec_ctx.h" @@ -229,11 +229,10 @@ class StressTest { TEST(MemoryQuotaStressTest, MainTest) { if (sizeof(void*) != 8) { - gpr_log( - GPR_ERROR, - "This test assumes 64-bit processors in the values it uses for sizes. " - "Since this test is mostly aimed at TSAN coverage, and that's mostly " - "platform independent, we simply skip this test in 32-bit builds."); + LOG(ERROR) << "This test assumes 64-bit processors in the values it uses " + "for sizes. Since this test is mostly aimed at TSAN " + "coverage, and that's mostly platform independent, we simply " + "skip this test in 32-bit builds."; GTEST_SKIP(); } grpc_core::StressTest(16, 20).Run(8); From 3df8e0787f1170c088d3fc7470415af8f8b4de6a Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Fri, 24 May 2024 03:32:12 -0700 Subject: [PATCH 20/20] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36711) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future. We have the following mapping 1. gpr_log(GPR_INFO,...) -> LOG(INFO) 2. gpr_log(GPR_ERROR,...) -> LOG(ERROR) 3. gpr_log(GPR_DEBUG,...) -> VLOG(2) Reviewers need to check : 1. If the above mapping is correct. 2. The content of the log is as before. gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected. Closes #36711 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36711 from tanvi-jagtap:trash e208603d6895e4a6e747d2c0418d6bff7ed8624c PiperOrigin-RevId: 636858250 --- .../external_connection_acceptor_impl.cc | 8 +- .../health/default_health_check_service.cc | 40 +++++----- .../server/load_reporter/load_data_store.cc | 51 ++++++------ src/cpp/server/load_reporter/load_reporter.cc | 40 +++++----- .../load_reporter_async_service_impl.cc | 78 +++++++++---------- .../tests/CronetTests/CronetUnitTests.mm | 3 +- 6 files changed, 103 insertions(+), 117 deletions(-) diff --git a/src/cpp/server/external_connection_acceptor_impl.cc b/src/cpp/server/external_connection_acceptor_impl.cc index 2237ac88131..208ac0a37f2 100644 --- a/src/cpp/server/external_connection_acceptor_impl.cc +++ b/src/cpp/server/external_connection_acceptor_impl.cc @@ -22,8 +22,8 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include #include @@ -69,10 +69,8 @@ void ExternalConnectionAcceptorImpl::HandleNewConnection( grpc_core::MutexLock lock(&mu_); if (shutdown_ || !started_) { // TODO(yangg) clean up. - gpr_log( - GPR_ERROR, - "NOT handling external connection with fd %d, started %d, shutdown %d", - p->fd, started_, shutdown_); + LOG(ERROR) << "NOT handling external connection with fd " << p->fd + << ", started " << started_ << ", shutdown " << shutdown_; return; } if (handler_) { diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc index fc0b59c5299..179bdf7a2ed 100644 --- a/src/cpp/server/health/default_health_check_service.cc +++ b/src/cpp/server/health/default_health_check_service.cc @@ -24,11 +24,11 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "upb/base/string_view.h" #include "upb/mem/arena.hpp" #include -#include #include #include #include @@ -259,8 +259,8 @@ DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor::WatchReactor( ++service_->num_watches_; } bool success = DecodeRequest(*request, &service_name_); - gpr_log(GPR_DEBUG, "[HCS %p] watcher %p \"%s\": watch call started", service_, - this, service_name_.c_str()); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": watch call started"; if (!success) { MaybeFinishLocked(Status(StatusCode::INTERNAL, "could not parse request")); return; @@ -271,15 +271,14 @@ DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor::WatchReactor( void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor:: SendHealth(ServingStatus status) { - gpr_log(GPR_DEBUG, - "[HCS %p] watcher %p \"%s\": SendHealth() for ServingStatus %d", - service_, this, service_name_.c_str(), status); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": SendHealth() for ServingStatus " << status; grpc::internal::MutexLock lock(&mu_); // If there's already a send in flight, cache the new status, and // we'll start a new send for it when the one in flight completes. if (write_pending_) { - gpr_log(GPR_DEBUG, "[HCS %p] watcher %p \"%s\": queuing write", service_, - this, service_name_.c_str()); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": queuing write"; pending_status_ = status; return; } @@ -307,17 +306,16 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor:: Status(StatusCode::INTERNAL, "could not encode response")); return; } - gpr_log(GPR_DEBUG, - "[HCS %p] watcher %p \"%s\": starting write for ServingStatus %d", - service_, this, service_name_.c_str(), status); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": starting write for ServingStatus " << status; write_pending_ = true; StartWrite(&response_); } void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor:: OnWriteDone(bool ok) { - gpr_log(GPR_DEBUG, "[HCS %p] watcher %p \"%s\": OnWriteDone(): ok=%d", - service_, this, service_name_.c_str(), ok); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": OnWriteDone(): ok=" << ok; response_.Clear(); grpc::internal::MutexLock lock(&mu_); if (!ok) { @@ -341,8 +339,8 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor:: } void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor::OnDone() { - gpr_log(GPR_DEBUG, "[HCS %p] watcher %p \"%s\": OnDone()", service_, this, - service_name_.c_str()); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": OnDone()"; service_->database_->UnregisterWatch(service_name_, this); { grpc::internal::MutexLock lock(&service_->mu_); @@ -356,13 +354,13 @@ void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor::OnDone() { void DefaultHealthCheckService::HealthCheckServiceImpl::WatchReactor:: MaybeFinishLocked(Status status) { - gpr_log(GPR_DEBUG, - "[HCS %p] watcher %p \"%s\": MaybeFinishLocked() with code=%d msg=%s", - service_, this, service_name_.c_str(), status.error_code(), - status.error_message().c_str()); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ + << "\": MaybeFinishLocked() with code=" << status.error_code() + << " msg=" << status.error_message(); if (!finish_called_) { - gpr_log(GPR_DEBUG, "[HCS %p] watcher %p \"%s\": actually calling Finish()", - service_, this, service_name_.c_str()); + VLOG(2) << "[HCS " << service_ << "] watcher " << this << " \"" + << service_name_ << "\": actually calling Finish()"; finish_called_ = true; Finish(status); } diff --git a/src/cpp/server/load_reporter/load_data_store.cc b/src/cpp/server/load_reporter/load_data_store.cc index 0f7acfbded9..649c073efe1 100644 --- a/src/cpp/server/load_reporter/load_data_store.cc +++ b/src/cpp/server/load_reporter/load_data_store.cc @@ -27,8 +27,8 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" -#include #include #include "src/core/lib/iomgr/socket_utils.h" @@ -111,9 +111,8 @@ std::string LoadRecordKey::GetClientIpBytes() const { } else if (client_ip_hex_.size() == kIpv4AddressLength) { uint32_t ip_bytes; if (sscanf(client_ip_hex_.c_str(), "%x", &ip_bytes) != 1) { - gpr_log(GPR_ERROR, - "Can't parse client IP (%s) from a hex string to an integer.", - client_ip_hex_.c_str()); + LOG(ERROR) << "Can't parse client IP (" << client_ip_hex_ + << ") from a hex string to an integer."; return ""; } ip_bytes = grpc_htonl(ip_bytes); @@ -124,10 +123,9 @@ std::string LoadRecordKey::GetClientIpBytes() const { for (size_t i = 0; i < 4; ++i) { if (sscanf(client_ip_hex_.substr(i * 8, (i + 1) * 8).c_str(), "%x", ip_bytes + i) != 1) { - gpr_log( - GPR_ERROR, - "Can't parse client IP part (%s) from a hex string to an integer.", - client_ip_hex_.substr(i * 8, (i + 1) * 8).c_str()); + LOG(ERROR) << "Can't parse client IP part (" + << client_ip_hex_.substr(i * 8, (i + 1) * 8) + << ") from a hex string to an integer."; return ""; } ip_bytes[i] = grpc_htonl(ip_bytes[i]); @@ -150,13 +148,13 @@ void PerBalancerStore::MergeRow(const LoadRecordKey& key, // During suspension, the load data received will be dropped. if (!suspended_) { load_record_map_[key].MergeFrom(value); - gpr_log(GPR_DEBUG, - "[PerBalancerStore %p] Load data merged (Key: %s, Value: %s).", - this, key.ToString().c_str(), value.ToString().c_str()); + VLOG(2) << "[PerBalancerStore " << this + << "] Load data merged (Key: " << key.ToString() + << ", Value: " << value.ToString() << ")."; } else { - gpr_log(GPR_DEBUG, - "[PerBalancerStore %p] Load data dropped (Key: %s, Value: %s).", - this, key.ToString().c_str(), value.ToString().c_str()); + VLOG(2) << "[PerBalancerStore " << this + << "] Load data dropped (Key: " << key.ToString() + << ", Value: " << value.ToString() << ")."; } // We always keep track of num_calls_in_progress_, so that when this // store is resumed, we still have a correct value of @@ -170,12 +168,12 @@ void PerBalancerStore::MergeRow(const LoadRecordKey& key, void PerBalancerStore::Suspend() { suspended_ = true; load_record_map_.clear(); - gpr_log(GPR_DEBUG, "[PerBalancerStore %p] Suspended.", this); + VLOG(2) << "[PerBalancerStore " << this << "] Suspended."; } void PerBalancerStore::Resume() { suspended_ = false; - gpr_log(GPR_DEBUG, "[PerBalancerStore %p] Resumed.", this); + VLOG(2) << "[PerBalancerStore " << this << "] Resumed."; } uint64_t PerBalancerStore::GetNumCallsInProgressForReport() { @@ -260,11 +258,9 @@ void PerHostStore::AssignOrphanedStore(PerBalancerStore* orphaned_store, auto it = assigned_stores_.find(new_receiver); CHECK(it != assigned_stores_.end()); it->second.insert(orphaned_store); - gpr_log(GPR_INFO, - "[PerHostStore %p] Re-assigned orphaned store (%p) with original LB" - " ID of %s to new receiver %s", - this, orphaned_store, orphaned_store->lb_id().c_str(), - new_receiver.c_str()); + LOG(INFO) << "[PerHostStore " << this << "] Re-assigned orphaned store (" + << orphaned_store << ") with original LB ID of " + << orphaned_store->lb_id() << " to new receiver " << new_receiver; } void PerHostStore::SetUpForNewLbId(const std::string& lb_id, @@ -306,17 +302,16 @@ void LoadDataStore::MergeRow(const std::string& hostname, if (in_progress_delta != 0) { auto it_tracker = unknown_balancer_id_trackers_.find(key.lb_id()); if (it_tracker == unknown_balancer_id_trackers_.end()) { - gpr_log( - GPR_DEBUG, - "[LoadDataStore %p] Start tracking unknown balancer (lb_id_: %s).", - this, key.lb_id().c_str()); + VLOG(2) << "[LoadDataStore " << this + << "] Start tracking unknown balancer (lb_id_: " << key.lb_id() + << ")."; unknown_balancer_id_trackers_.insert( {key.lb_id(), static_cast(in_progress_delta)}); } else if ((it_tracker->second += in_progress_delta) == 0) { unknown_balancer_id_trackers_.erase(it_tracker); - gpr_log(GPR_DEBUG, - "[LoadDataStore %p] Stop tracking unknown balancer (lb_id_: %s).", - this, key.lb_id().c_str()); + VLOG(2) << "[LoadDataStore " << this + << "] Stop tracking unknown balancer (lb_id_: " << key.lb_id() + << ")."; } } } diff --git a/src/cpp/server/load_reporter/load_reporter.cc b/src/cpp/server/load_reporter/load_reporter.cc index 9a0e2a875e9..6af88e8ba7f 100644 --- a/src/cpp/server/load_reporter/load_reporter.cc +++ b/src/cpp/server/load_reporter/load_reporter.cc @@ -28,9 +28,9 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include "opencensus/tags/tag_key.h" -#include #include #include "src/cpp/server/load_reporter/constants.h" @@ -201,20 +201,19 @@ CensusViewProviderDefaultImpl::CensusViewProviderDefaultImpl() { } CensusViewProvider::ViewDataMap CensusViewProviderDefaultImpl::FetchViewData() { - gpr_log(GPR_DEBUG, "[CVP %p] Starts fetching Census view data.", this); + VLOG(2) << "[CVP " << this << "] Starts fetching Census view data."; ViewDataMap view_data_map; for (auto& p : view_map_) { const std::string& view_name = p.first; ::opencensus::stats::View& view = p.second; if (view.IsValid()) { view_data_map.emplace(view_name, view.GetData()); - gpr_log(GPR_DEBUG, "[CVP %p] Fetched view data (view: %s).", this, - view_name.c_str()); + VLOG(2) << "[CVP " << this << "] Fetched view data (view: " << view_name + << ")."; } else { - gpr_log( - GPR_DEBUG, - "[CVP %p] Can't fetch view data because view is invalid (view: %s).", - this, view_name.c_str()); + VLOG(2) << "[CVP " << this + << "] Can't fetch view data because view is invalid (view: " + << view_name << ")."; } } return view_data_map; @@ -223,8 +222,8 @@ CensusViewProvider::ViewDataMap CensusViewProviderDefaultImpl::FetchViewData() { std::string LoadReporter::GenerateLbId() { while (true) { if (next_lb_id_ > UINT32_MAX) { - gpr_log(GPR_ERROR, "[LR %p] The LB ID exceeds the max valid value!", - this); + LOG(ERROR) << "[LR " << this + << "] The LB ID exceeds the max valid value!"; return ""; } int64_t lb_id = next_lb_id_++; @@ -387,17 +386,16 @@ void LoadReporter::ReportStreamCreated(const std::string& hostname, const std::string& load_key) { grpc_core::MutexLock lock(&store_mu_); load_data_store_.ReportStreamCreated(hostname, lb_id, load_key); - gpr_log(GPR_INFO, - "[LR %p] Report stream created (host: %s, LB ID: %s, load key: %s).", - this, hostname.c_str(), lb_id.c_str(), load_key.c_str()); + LOG(INFO) << "[LR " << this << "] Report stream created (host: " << hostname + << ", LB ID: " << lb_id << ", load key: " << load_key << ")."; } void LoadReporter::ReportStreamClosed(const std::string& hostname, const std::string& lb_id) { grpc_core::MutexLock lock(&store_mu_); load_data_store_.ReportStreamClosed(hostname, lb_id); - gpr_log(GPR_INFO, "[LR %p] Report stream closed (host: %s, LB ID: %s).", this, - hostname.c_str(), lb_id.c_str()); + LOG(INFO) << "[LR " << this << "] Report stream closed (host: " << hostname + << ", LB ID: " << lb_id << ")."; } void LoadReporter::ProcessViewDataCallStart( @@ -437,9 +435,8 @@ void LoadReporter::ProcessViewDataCallEnd( // implementation. // TODO(juanlishen): Check whether this situation happens in OSS C++. if (client_ip_and_token.empty()) { - gpr_log(GPR_DEBUG, - "Skipping processing Opencensus record with empty " - "client_ip_and_token tag."); + VLOG(2) << "Skipping processing Opencensus record with empty " + "client_ip_and_token tag."; continue; } LoadRecordKey key(client_ip_and_token, user_id); @@ -500,10 +497,9 @@ void LoadReporter::ProcessViewDataOtherCallMetrics( } void LoadReporter::FetchAndSample() { - gpr_log(GPR_DEBUG, - "[LR %p] Starts fetching Census view data and sampling LB feedback " - "record.", - this); + VLOG(2) << "[LR " << this + << "] Starts fetching Census view data and sampling LB feedback " + "record."; CensusViewProvider::ViewDataMap view_data_map = census_view_provider_->FetchViewData(); ProcessViewDataCallStart(view_data_map); diff --git a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc index f4d20b13768..fc452fc8ced 100644 --- a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc +++ b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc @@ -23,6 +23,7 @@ #include #include "absl/log/check.h" +#include "absl/log/log.h" #include #include @@ -83,15 +84,15 @@ void LoadReporterAsyncServiceImpl::ScheduleNextFetchAndSample() { next_fetch_and_sample_alarm_->Set(cq_.get(), next_fetch_and_sample_time, this); } - gpr_log(GPR_DEBUG, "[LRS %p] Next fetch-and-sample scheduled.", this); + VLOG(2) << "[LRS " << this << "] Next fetch-and-sample scheduled."; } void LoadReporterAsyncServiceImpl::FetchAndSample(bool ok) { if (!ok) { - gpr_log(GPR_INFO, "[LRS %p] Fetch-and-sample is stopped.", this); + LOG(INFO) << "[LRS " << this << "] Fetch-and-sample is stopped."; return; } - gpr_log(GPR_DEBUG, "[LRS %p] Starting a fetch-and-sample...", this); + VLOG(2) << "[LRS " << this << "] Starting a fetch-and-sample..."; load_reporter_->FetchAndSample(); ScheduleNextFetchAndSample(); } @@ -191,10 +192,10 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnRequestDelivered( } // LB ID is unique for each load reporting stream. lb_id_ = load_reporter_->GenerateLbId(); - gpr_log(GPR_INFO, - "[LRS %p] Call request delivered (lb_id_: %s, handler: %p). " - "Start reading the initial request...", - service_, lb_id_.c_str(), this); + LOG(INFO) << "[LRS " << service_ + << "] Call request delivered (lb_id_: " << lb_id_ + << ", handler: " << this + << "). Start reading the initial request..."; } void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnReadDone( @@ -202,11 +203,12 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnReadDone( if (!ok || shutdown_) { if (!ok && call_status_ < INITIAL_REQUEST_RECEIVED) { // The client may have half-closed the stream or the stream is broken. - gpr_log(GPR_INFO, - "[LRS %p] Failed reading the initial request from the stream " - "(lb_id_: %s, handler: %p, done_notified: %d, is_cancelled: %d).", - service_, lb_id_.c_str(), this, static_cast(done_notified_), - static_cast(is_cancelled_)); + LOG(INFO) << "[LRS " << service_ + << "] Failed reading the initial request from the stream " + "(lb_id_: " + << lb_id_ << ", handler: " << this + << ", done_notified: " << done_notified_ + << ", is_cancelled: " << is_cancelled_ << ")."; } Shutdown(std::move(self), "OnReadDone"); return; @@ -226,12 +228,12 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnReadDone( load_report_interval_ms_ = static_cast(load_report_interval.seconds() * 1000 + load_report_interval.nanos() / 1000); - gpr_log(GPR_INFO, - "[LRS %p] Initial request received. Start load reporting (load " - "balanced host: %s, interval: %" PRIu64 - " ms, lb_id_: %s, handler: %p)...", - service_, load_balanced_hostname_.c_str(), - load_report_interval_ms_, lb_id_.c_str(), this); + LOG(INFO) << "[LRS " << service_ + << "] Initial request received. Start load reporting (load " + "balanced host: " + << load_balanced_hostname_ + << ", interval: " << load_report_interval_ms_ + << " ms, lb_id_: " << lb_id_ << ", handler: " << this << ")..."; SendReport(self, true /* ok */); // Expect this read to fail. { @@ -250,9 +252,9 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnReadDone( } } else { // Another request received! This violates the spec. - gpr_log(GPR_ERROR, - "[LRS %p] Another request received (lb_id_: %s, handler: %p).", - service_, lb_id_.c_str(), this); + LOG(ERROR) << "[LRS " << service_ + << "] Another request received (lb_id_: " << lb_id_ + << ", handler: " << this << ")."; Shutdown(std::move(self), "OnReadDone+second_request"); } } @@ -282,9 +284,9 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::ScheduleNextReport( next_report_alarm_ = std::make_unique(); next_report_alarm_->Set(cq_, next_report_time, &next_outbound_); } - gpr_log(GPR_DEBUG, - "[LRS %p] Next load report scheduled (lb_id_: %s, handler: %p).", - service_, lb_id_.c_str(), this); + VLOG(2) << "[LRS " << service_ + << "] Next load report scheduled (lb_id_: " << lb_id_ + << ", handler: " << this << ")."; } void LoadReporterAsyncServiceImpl::ReportLoadHandler::SendReport( @@ -318,10 +320,10 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::SendReport( std::placeholders::_1, std::placeholders::_2), std::move(self)); stream_.Write(response, &next_outbound_); - gpr_log(GPR_INFO, - "[LRS %p] Sending load report (lb_id_: %s, handler: %p, loads " - "count: %d)...", - service_, lb_id_.c_str(), this, response.load().size()); + LOG(INFO) << "[LRS " << service_ + << "] Sending load report (lb_id_: " << lb_id_ + << ", handler: " << this + << ", loads count: " << response.load().size() << ")..."; } } @@ -332,20 +334,18 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnDoneNotified( if (ctx_.IsCancelled()) { is_cancelled_ = true; } - gpr_log(GPR_INFO, - "[LRS %p] Load reporting call is notified done (handler: %p, " - "is_cancelled: %d).", - service_, this, static_cast(is_cancelled_)); + LOG(INFO) << "[LRS " << service_ + << "] Load reporting call is notified done (handler: " << this + << ", is_cancelled: " << is_cancelled_ << ")."; Shutdown(std::move(self), "OnDoneNotified"); } void LoadReporterAsyncServiceImpl::ReportLoadHandler::Shutdown( std::shared_ptr self, const char* reason) { if (!shutdown_) { - gpr_log(GPR_INFO, - "[LRS %p] Shutting down the handler (lb_id_: %s, handler: %p, " - "reason: %s).", - service_, lb_id_.c_str(), this, reason); + LOG(INFO) << "[LRS " << service_ + << "] Shutting down the handler (lb_id_: " << lb_id_ + << ", handler: " << this << ", reason: " << reason << ")."; shutdown_ = true; if (call_status_ >= INITIAL_REQUEST_RECEIVED) { load_reporter_->ReportStreamClosed(load_balanced_hostname_, lb_id_); @@ -374,9 +374,9 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnFinishDone( // NOLINTNEXTLINE(performance-unnecessary-value-param) std::shared_ptr /*self*/, bool ok) { if (ok) { - gpr_log(GPR_INFO, - "[LRS %p] Load reporting finished (lb_id_: %s, handler: %p).", - service_, lb_id_.c_str(), this); + LOG(INFO) << "[LRS " << service_ + << "] Load reporting finished (lb_id_: " << lb_id_ + << ", handler: " << this << ")."; } } diff --git a/src/objective-c/tests/CronetTests/CronetUnitTests.mm b/src/objective-c/tests/CronetTests/CronetUnitTests.mm index e09a06e821a..ba913160525 100644 --- a/src/objective-c/tests/CronetTests/CronetUnitTests.mm +++ b/src/objective-c/tests/CronetTests/CronetUnitTests.mm @@ -29,7 +29,6 @@ #import "test/core/test_util/port.h" #import -#import #import "src/core/lib/channel/channel_args.h" #import "src/core/lib/gprpp/env.h" @@ -322,7 +321,7 @@ unsigned int parse_h2_length(const char *field) { long len; BOOL coalesced = NO; while ((len = SSL_read(ssl, buf, sizeof(buf))) > 0) { - gpr_log(GPR_DEBUG, "Read len: %ld", len); + VLOG(2) << "Read len: " << len; // Analyze the HTTP/2 frames in the same TLS PDU to identify if // coalescing is successful