Compare commits

...

17 Commits

Author SHA1 Message Date
AJ Heller 9a5fdfc3d3
[backport][log] Use ABSL_ prefixed version of LOG/CHECK macros in theinclude/ tree (#36819) (#36872)
We should separately add a lint to ensure no new usage slips in.

Backport of #36819

Co-authored-by: Craig Tiller <ctiller@google.com>
2024-06-11 12:28:51 -07:00
Yash Tibrewal 4795c5e69b
[Release] Bump version to 1.64.2 (on v1.64.x branch) (#36854)
Change was created by the release automation script. See go/grpc-release
2024-06-07 11:23:36 -07:00
Eugene Ostroukhov be555ce069
[xds] Do not crash when XdsLocalityName is null (#36841) (#36851) 2024-06-07 10:36:51 -07:00
Yash Tibrewal 6fc4a3bf4c
[Build] Fix for gcc-9 (#36839)
1.64.x doesn't build with gcc-9. This PR "fixes" it crashing at the
offending site. This is fine since this code is not used yet.

This is a strange one since we have CI tests with gcc-7 and gcc-12, but
gcc-9 has thrown errors. We are considering add builds for intermediate
versions, but we do not have infinite testing resources either, so it's
a bit of a balancing act.

```
Step #2: external/com_github_grpc_grpc/src/core/lib/surface/call.cc: In constructor 'grpc_core::{anonymous}::MaybeOpImpl<SetupFn>::MaybeOpImpl(grpc_core::{anonymous}::MaybeOpImpl<SetupFn>&&) [with SetupFn = grpc_core::ServerCallSpine::CommitBatch(const grpc_op*, size_t, void*, bool)::<lambda(const grpc_op&)>]':
Step #2: external/com_github_grpc_grpc/src/core/lib/surface/call.cc:3736:55: internal compiler error: in assign_temp, at function.c:982
Step #2:  3736 |       : state_(MoveState(other.state_)), op_(other.op_) {}
Step #2:       |                              
```
2024-06-07 10:14:24 -07:00
Yash Tibrewal d79949179d
[Release] Bump version to 1.64.1 (on v1.64.x branch) (#36748)
Change was created by the release automation script. See go/grpc-release
2024-05-29 16:42:24 -07:00
AJ Heller 74eedccda1
[backport][build] Update Gazelle bazel dependency (#36745) (#36746) 2024-05-28 17:59:20 -07:00
Yash Tibrewal c0216b4a9f
[OTel] Generate pkg-config file for grpcpp_otel_plugin (#36686) (#36722)
Backport #36686 to 1.64.x

Public Changes -
* Add a pkgconfig installer for `grpcpp_otel_plugin`

Example Changes -
* Add example of how to use the pkgconfig for `grpcpp_otel_plugin` with
the existing OpenTelemetry example.
* Add another OpenTelemetry example that uses OTel's OStream exporter.
This makes it easier to test the pkgconfig file for `grpcpp_otel_plugin`
since the OStream exporter does not require any additional dependencies,
as opposed to the Prometheus exporter.

Test changes -
* Modify `run_distrib_test_cmake_pkgconfig.sh` test to install
opentelemetry and build the example with the OStream exporter.
2024-05-24 16:52:06 -07:00
Yash Tibrewal 192c054360
[OTel] Add latency view to example (#36601) (#36720)
Backport #36601 to v1.64.x

Needed to backport #36686
2024-05-24 12:03:19 -07:00
Xuan Wang f740f35614
[Python Server] Remove abstractmethod notation for add_registered_method_handlers (v1.64.x backport) (#36696)
Backport of #36684 to v1.64.x.
---
Remove `@abc.abstractmethod` so we don't break backward compatibility.

Fix: https://github.com/grpc/grpc/issues/36683

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2024-05-23 11:59:52 -07:00
Yash Tibrewal c64a23db32
[OTel] Add find_package call for OTel dependency in installed gRPC configuration (#36674) (#36688)
Backport https://github.com/grpc/grpc/pull/36674 to 1.64.x
2024-05-22 15:56:33 -07:00
Yash Tibrewal fbd6f95903
C++20 compat: use invoke_result_t for C++17 and up (#36016) (#36690)
Backport https://github.com/grpc/grpc/pull/36016 to v1.64.x

Co-authored-by: Ryan Prichard <rprichard@google.com>
2024-05-21 23:18:34 -07:00
Yash Tibrewal 979afe0924
[StatsPlugin] Fix use-after-free issue (#36664) (#36670)
Backport #36664 to 1.64.x
2024-05-21 10:22:29 -07:00
Yash Tibrewal b8a04acbbf
[Release] Bump version to 1.64.0 (on v1.64.x branch) (#36633)
Change was created by the release automation script. See go/grpc-release
2024-05-15 18:01:03 -07:00
Yash Tibrewal acd8b33b60
[Release] Bump version to 1.64.0-pre2 (on v1.64.x branch) (#36573)
Change was created by the release automation script. See go/grpc-release
2024-05-09 16:02:10 -07:00
Yash Tibrewal 9cd019a84d
Revert "[transport] Centralize ref-counting between transports (#36460)" (#36566)
This reverts commit 03e2bf22c5.

I don't know why but this causes issues when building gcc7 -

https://github.com/googleapis/google-cloud-cpp/pull/14153/checks?check_run_id=24734699214
2024-05-09 14:16:40 -07:00
Yash Tibrewal 03e6617356
[Gpr_To_Absl_Logging] Disable absl logging (#36546) 2024-05-07 00:13:23 -07:00
Yash Tibrewal 7062f29e70
[Release] Bump version to 1.64.0-pre1 (on v1.64.x branch) (#36545)
Change was created by the release automation script. See go/grpc-release
2024-05-06 15:17:34 -07:00
100 changed files with 1254 additions and 448 deletions

16
BUILD
View File

@ -246,7 +246,7 @@ g_stands_for = "grateful" # @unused
core_version = "41.0.0" # @unused
version = "1.64.0-dev" # @unused
version = "1.64.2" # @unused
GPR_PUBLIC_HDRS = [
"include/grpc/support/alloc.h",
@ -904,6 +904,9 @@ grpc_cc_library(
hdrs = GRPCXX_PUBLIC_HDRS,
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/log:absl_check",
"absl/log:absl_log",
"absl/strings:cord",
"absl/synchronization",
"protobuf_headers",
@ -934,6 +937,9 @@ grpc_cc_library(
],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/log:absl_check",
"absl/log:absl_log",
"absl/strings:cord",
],
language = "c++",
@ -1247,6 +1253,9 @@ grpc_cc_library(
],
external_deps = [
"absl/log:check",
"absl/log:log",
"absl/log:absl_check",
"absl/log:absl_log",
"absl/strings",
"absl/synchronization",
],
@ -2452,6 +2461,9 @@ grpc_cc_library(
"absl/base:core_headers",
"absl/functional:any_invocable",
"absl/log:check",
"absl/log:log",
"absl/log:absl_check",
"absl/log:absl_log",
"absl/status",
"absl/status:statusor",
"absl/strings",
@ -2539,6 +2551,8 @@ grpc_cc_library(
"absl/status:statusor",
"absl/strings",
"absl/synchronization",
"absl/log:absl_check",
"absl/log:absl_log",
"absl/types:optional",
"absl/memory",
"@com_google_protobuf//upb:base",

43
CMakeLists.txt generated
View File

@ -25,10 +25,10 @@
cmake_minimum_required(VERSION 3.13)
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.64.0-dev")
set(PACKAGE_VERSION "1.64.2")
set(gRPC_CORE_VERSION "41.0.0")
set(gRPC_CORE_SOVERSION "41")
set(gRPC_CPP_VERSION "1.64.0-dev")
set(gRPC_CPP_VERSION "1.64.2")
set(gRPC_CPP_SOVERSION "1.64")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
@ -97,6 +97,8 @@ set(gRPC_ABSL_PROVIDER "module" CACHE STRING "Provider of absl library")
set_property(CACHE gRPC_ABSL_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_ABSL_USED_TARGETS
absl_absl_check
absl_absl_log
absl_absl_vlog_is_on
absl_algorithm
absl_algorithm_container
@ -4147,6 +4149,8 @@ target_include_directories(grpc++
)
target_link_libraries(grpc++
${_gRPC_ALLTARGETS_LIBRARIES}
absl::absl_check
absl::absl_log
grpc
${_gRPC_PROTOBUF_LIBRARIES}
)
@ -4888,6 +4892,8 @@ target_include_directories(grpc++_unsecure
)
target_link_libraries(grpc++_unsecure
${_gRPC_ALLTARGETS_LIBRARIES}
absl::absl_check
absl::absl_log
grpc_unsecure
${_gRPC_PROTOBUF_LIBRARIES}
)
@ -8249,6 +8255,8 @@ target_include_directories(binder_transport_test
target_link_libraries(binder_transport_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -12763,6 +12771,8 @@ target_include_directories(endpoint_binder_pool_test
target_link_libraries(endpoint_binder_pool_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -13621,6 +13631,8 @@ target_include_directories(fake_binder_test
target_link_libraries(fake_binder_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -31757,6 +31769,8 @@ target_include_directories(transport_stream_receiver_test
target_link_libraries(transport_stream_receiver_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -32592,6 +32606,8 @@ target_include_directories(wire_reader_test
target_link_libraries(wire_reader_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -32700,6 +32716,8 @@ target_include_directories(wire_writer_test
target_link_libraries(wire_writer_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -33243,6 +33261,8 @@ target_include_directories(xds_client_test
target_link_libraries(xds_client_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -33535,6 +33555,8 @@ target_include_directories(xds_cluster_resource_type_test
target_link_libraries(xds_cluster_resource_type_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -34529,6 +34551,8 @@ target_include_directories(xds_endpoint_resource_type_test
target_link_libraries(xds_endpoint_resource_type_test
${_gRPC_ALLTARGETS_LIBRARIES}
gtest
absl::absl_check
absl::absl_log
${_gRPC_PROTOBUF_LIBRARIES}
grpc_test_util
)
@ -36953,7 +36977,7 @@ generate_pkgconfig(
"gRPC++"
"C++ wrapper for gRPC"
"${gRPC_CPP_VERSION}"
"absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc"
"absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc"
"libcares openssl re2 zlib"
"-lgrpc++"
"-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
@ -36964,8 +36988,19 @@ generate_pkgconfig(
"gRPC++ unsecure"
"C++ wrapper for gRPC without SSL"
"${gRPC_CPP_VERSION}"
"absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure"
"absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc_unsecure"
"libcares zlib"
"-lgrpc++_unsecure"
"-laddress_sorting -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
"grpc++_unsecure.pc")
# grpcpp_otel_plugin .pc file
generate_pkgconfig(
"gRPC++ OpenTelemetry Plugin"
"OpenTelemetry Plugin for gRPC C++"
"${gRPC_CPP_VERSION}"
"absl_absl_check absl_absl_log absl_algorithm_container absl_any_invocable absl_base absl_bind_front absl_check absl_cleanup absl_config absl_cord absl_core_headers absl_flags absl_flags_marshalling absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_inlined_vector absl_log absl_log_globals absl_log_severity absl_memory absl_no_destructor absl_optional absl_random_bit_gen_ref absl_random_distributions absl_random_random absl_span absl_status absl_statusor absl_str_format absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant gpr grpc grpc++ opentelemetry_api"
"libcares openssl re2 zlib"
"-lgrpcpp_otel_plugin"
"-laddress_sorting -lupb_textformat_lib -lupb_json_lib -lupb_message_lib -lupb_mem_lib -lupb_base_lib -lutf8_range_lib"
"grpcpp_otel_plugin.pc")

2
Makefile generated
View File

@ -368,7 +368,7 @@ Q = @
endif
CORE_VERSION = 41.0.0
CPP_VERSION = 1.64.0-dev
CPP_VERSION = 1.64.2
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/_metadata.py.template`!!!
__version__ = """1.64.0.dev0"""
__version__ = """1.64.2"""

1
bazel/experiments.bzl generated
View File

@ -146,7 +146,6 @@ EXPERIMENTS = {
},
"off": {
"core_end2end_test": [
"chaotic_good",
"event_engine_client",
"promise_based_client_call",
"promise_based_server_call",

View File

@ -406,10 +406,10 @@ def grpc_deps():
if "bazel_gazelle" not in native.existing_rules():
http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
sha256 = "d76bf7a60fd8b050444090dfa2837a4eaf9829e1165618ee35dceca5cbdf58d5",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.37.0/bazel-gazelle-v0.37.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.37.0/bazel-gazelle-v0.37.0.tar.gz",
],
)

View File

@ -52,7 +52,7 @@ def grpc_extra_deps(ignore_version_differences = False):
api_dependencies()
go_rules_dependencies()
go_register_toolchains(version = "1.18")
go_register_toolchains(version = "1.20")
gazelle_dependencies()
# Pull-in the go 3rd party dependencies for protoc_gen_validate, which is

View File

@ -3931,6 +3931,8 @@ libs:
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
deps:
- absl/log:absl_check
- absl/log:absl_log
- grpc
- protobuf
baselib: true
@ -4303,6 +4305,8 @@ libs:
- src/cpp/util/string_ref.cc
- src/cpp/util/time_cc.cc
deps:
- absl/log:absl_check
- absl/log:absl_log
- grpc_unsecure
- protobuf
baselib: true
@ -6213,6 +6217,8 @@ targets:
- test/core/transport/binder/mock_objects.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -8894,6 +8900,8 @@ targets:
- test/core/transport/binder/mock_objects.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -9384,6 +9392,8 @@ targets:
- test/core/transport/binder/end2end/fake_binder_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -20123,6 +20133,8 @@ targets:
- test/core/transport/binder/transport_stream_receiver_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -20501,6 +20513,8 @@ targets:
- test/core/transport/binder/wire_reader_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -20610,6 +20624,8 @@ targets:
- test/core/transport/binder/wire_writer_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -20894,6 +20910,8 @@ targets:
- test/core/xds/xds_transport_fake.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -20987,6 +21005,8 @@ targets:
- test/core/xds/xds_cluster_resource_type_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false
@ -21331,6 +21351,8 @@ targets:
- test/core/xds/xds_endpoint_resource_type_test.cc
deps:
- gtest
- absl/log:absl_check
- absl/log:absl_log
- protobuf
- grpc_test_util
uses_polling: false

View File

@ -16,7 +16,7 @@ settings:
csharp_major_version: 2
g_stands_for: grateful
protobuf_version: 3.26.1
version: 1.64.0-dev
version: 1.64.2
configs:
asan:
CC: clang

View File

@ -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)

2
config.m4 generated
View File

@ -1383,7 +1383,7 @@ if test "$PHP_GRPC" != "no"; then
-D_HAS_EXCEPTIONS=0 -DNOMINMAX -DGRPC_ARES=0 \
-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1 \
-DGRPC_XDS_USER_AGENT_NAME_SUFFIX='"\"PHP\""' \
-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX='"\"1.64.0dev\""')
-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX='"\"1.64.2\""')
PHP_ADD_BUILD_DIR($ext_builddir/src/core/channelz)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/client_channel)

View File

@ -63,4 +63,4 @@
- 1.61 'g' stands for ['grand'](https://github.com/grpc/grpc/tree/v1.61.x)
- 1.62 'g' stands for ['guardian'](https://github.com/grpc/grpc/tree/v1.62.x)
- 1.63 'g' stands for ['giggle'](https://github.com/grpc/grpc/tree/v1.63.x)
- 1.64 'g' stands for ['grateful'](https://github.com/grpc/grpc/tree/master)
- 1.64 'g' stands for ['grateful'](https://github.com/grpc/grpc/tree/v1.64.x)

View File

@ -14,14 +14,31 @@
licenses(["notice"])
package(
default_visibility = ["//examples/cpp/otel:__subpackages__"],
)
cc_library(
name = "util",
srcs = ["util.cc"],
hdrs = ["util.h"],
defines = ["BAZEL_BUILD"],
deps = [
"//:grpc++",
"//:grpc++_reflection",
"//examples/protos:helloworld_cc_grpc",
"@io_opentelemetry_cpp//sdk/src/metrics",
],
)
cc_binary(
name = "greeter_callback_client",
srcs = ["greeter_callback_client.cc"],
defines = ["BAZEL_BUILD"],
deps = [
"util",
"//:grpc++",
"//:grpcpp_otel_plugin",
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@io_opentelemetry_cpp//exporters/prometheus:prometheus_exporter",
@ -34,10 +51,9 @@ cc_binary(
srcs = ["greeter_callback_server.cc"],
defines = ["BAZEL_BUILD"],
deps = [
"util",
"//:grpc++",
"//:grpc++_reflection",
"//:grpcpp_otel_plugin",
"//examples/protos:helloworld_cc_grpc",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/strings:str_format",

View File

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

124
examples/cpp/otel/Makefile generated Normal file
View File

@ -0,0 +1,124 @@
#
# 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.
#
# TODO(jtattermusch): Remove the hack to workaround protobuf bug. See https://github.com/protocolbuffers/protobuf/issues/12439
# Hack: protobuf currently doesn't declare it's absl dependencies when protobuf.pc pkgconfig file is used.
PROTOBUF_ABSL_DEPS = absl_absl_check absl_absl_log absl_algorithm absl_base absl_bind_front absl_bits absl_btree absl_cleanup absl_cord absl_core_headers absl_debugging absl_die_if_null absl_dynamic_annotations absl_flags absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_layout absl_log_initialize absl_log_severity absl_memory absl_node_hash_map absl_node_hash_set absl_optional absl_span absl_status absl_statusor absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant
# TODO(jtattermusch): Remove the hack to workaround protobuf/utf8_range bug. See https://github.com/protocolbuffers/utf8_range/issues/20
# Hack: utf8_range (which is protobuf's dependency) currently doesn't have a pkgconfig file, so we need to explicitly
# tweak the list of libraries to link against to fix the build.
PROTOBUF_UTF8_RANGE_LINK_LIBS = -lutf8_validity
OPENTELEMETRY_LINK_LIBS = -lopentelemetry_metrics -lopentelemetry_exporter_prometheus -lopentelemetry_common -lopentelemetry_resources -lprometheus-cpp-pull -lprometheus-cpp-core
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++
CPPFLAGS += `pkg-config --cflags protobuf grpc absl_flags absl_flags_parse`
ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ grpcpp_otel_plugin absl_flags absl_flags_parse $(PROTOBUF_ABSL_DEPS)` \
$(PROTOBUF_UTF8_RANGE_LINK_LIBS) \
$(OPENTELEMETRY_LINK_LIBS) \
-pthread \
-lgrpc++_reflection \
-ldl
else
LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ grpcpp_otel_plugin absl_flags absl_flags_parse $(PROTOBUF_ABSL_DEPS)` \
$(PROTOBUF_UTF8_RANGE_LINK_LIBS) \
$(OPENTELEMETRY_LINK_LIBS) \
-pthread \
-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \
-ldl
endif
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
PROTOS_PATH = ../../protos
vpath %.proto $(PROTOS_PATH)
all: system-check greeter_callback_client greeter_callback_server
greeter_callback_client: util.o helloworld.pb.o helloworld.grpc.pb.o greeter_callback_client.o
$(CXX) $^ $(LDFLAGS) -o $@
greeter_callback_server: util.o helloworld.pb.o helloworld.grpc.pb.o greeter_callback_server.o
$(CXX) $^ $(LDFLAGS) -o $@
.PRECIOUS: %.grpc.pb.cc
%.grpc.pb.cc: %.proto
$(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
.PRECIOUS: %.pb.cc
%.pb.cc: %.proto
$(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
clean:
rm -f *.o *.pb.cc *.pb.h greeter_callback_client greeter_callback_server
# The following is to test your system and ensure a smoother experience.
# They are by no means necessary to actually compile a grpc-enabled software.
PROTOC_CMD = which $(PROTOC)
PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q 'libprotoc.3\|libprotoc [0-9][0-9]\.'
PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN)
HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
ifeq ($(HAS_PROTOC),true)
HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
endif
HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false)
SYSTEM_OK = false
ifeq ($(HAS_VALID_PROTOC),true)
ifeq ($(HAS_PLUGIN),true)
SYSTEM_OK = true
endif
endif
system-check:
ifneq ($(HAS_VALID_PROTOC),true)
@echo " DEPENDENCY ERROR"
@echo
@echo "You don't have protoc 3.0.0 or newer installed in your path."
@echo "Please install an up-to-date version of Google protocol buffers."
@echo "You can find it here:"
@echo
@echo " https://github.com/protocolbuffers/protobuf/releases"
@echo
@echo "Here is what I get when trying to evaluate your version of protoc:"
@echo
-$(PROTOC) --version
@echo
@echo
endif
ifneq ($(HAS_PLUGIN),true)
@echo " DEPENDENCY ERROR"
@echo
@echo "You don't have the grpc c++ protobuf plugin installed in your path."
@echo "Please install grpc. You can find it here:"
@echo
@echo " https://github.com/grpc/grpc"
@echo
@echo "Here is what I get when trying to detect if you have the plugin:"
@echo
-which $(GRPC_CPP_PLUGIN)
@echo
@echo
endif
ifneq ($(SYSTEM_OK),true)
@false
endif

View File

@ -16,12 +16,14 @@
*
*/
#include <condition_variable>
#include <iostream>
#include <memory>
#include <mutex>
// Explicitly define HAVE_ABSEIL to avoid conflict with OTel's Abseil
// version. Refer
// https://github.com/open-telemetry/opentelemetry-cpp/issues/1042.
#ifndef HAVE_ABSEIL
#define HAVE_ABSEIL
#endif
#include <string>
#include <thread>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
@ -30,76 +32,17 @@
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include <grpcpp/ext/otel_plugin.h>
#include <grpcpp/grpcpp.h>
#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#include "examples/cpp/otel/util.h"
#else
#include "helloworld.grpc.pb.h"
#include "util.h"
#endif
ABSL_FLAG(std::string, target, "localhost:50051", "Server address");
ABSL_FLAG(std::string, prometheus_endpoint, "localhost:9465",
"Prometheus exporter endpoint");
using grpc::Channel;
using grpc::ClientContext;
using grpc::Status;
using helloworld::Greeter;
using helloworld::HelloReply;
using helloworld::HelloRequest;
class GreeterClient {
public:
GreeterClient(std::shared_ptr<Channel> channel)
: stub_(Greeter::NewStub(channel)) {}
// Assembles the client's payload, sends it and presents the response back
// from the server.
std::string SayHello(const std::string& user) {
// Data we are sending to the server.
HelloRequest request;
request.set_name(user);
// Container for the data we expect from the server.
HelloReply reply;
// Context for the client. It could be used to convey extra information to
// the server and/or tweak certain RPC behaviors.
ClientContext context;
// The actual RPC.
std::mutex mu;
std::condition_variable cv;
bool done = false;
Status status;
stub_->async()->SayHello(&context, &request, &reply,
[&mu, &cv, &done, &status](Status s) {
status = std::move(s);
std::lock_guard<std::mutex> lock(mu);
done = true;
cv.notify_one();
});
std::unique_lock<std::mutex> lock(mu);
while (!done) {
cv.wait(lock);
}
// Act upon its status.
if (status.ok()) {
return reply.message();
} else {
std::cout << status.error_code() << ": " << status.error_message()
<< std::endl;
return "RPC failed";
}
}
private:
std::unique_ptr<Greeter::Stub> stub_;
};
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
// Register a global gRPC OpenTelemetry plugin configured with a prometheus
@ -110,6 +53,10 @@ int main(int argc, char** argv) {
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
// The default histogram boundaries are not granular enough for RPCs. Override
// the "grpc.client.attempt.duration" view as recommended by
// https://github.com/grpc/proposal/blob/master/A66-otel-stats.md.
AddLatencyView(meter_provider.get(), "grpc.client.attempt.duration", "s");
meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto status = grpc::OpenTelemetryPluginBuilder()
.SetMeterProvider(std::move(meter_provider))
@ -119,20 +66,9 @@ int main(int argc, char** argv) {
<< status.ToString() << std::endl;
return static_cast<int>(status.code());
}
// Instantiate the client. It requires a channel, out of which the actual RPCs
// are created. This channel models a connection to an endpoint specified by
// the argument "--target=" which is the only expected argument.
std::string target_str = absl::GetFlag(FLAGS_target);
grpc::ChannelArguments args;
// Continuously send RPCs every second.
while (true) {
GreeterClient greeter(grpc::CreateCustomChannel(
target_str, grpc::InsecureChannelCredentials(), args));
std::string user("world");
std::string reply = greeter.SayHello(user);
std::cout << "Greeter received: " << reply << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
RunClient(absl::GetFlag(FLAGS_target));
return 0;
}

View File

@ -16,6 +16,13 @@
*
*/
// Explicitly define HAVE_ABSEIL to avoid conflict with OTel's Abseil
// version. Refer
// https://github.com/open-telemetry/opentelemetry-cpp/issues/1042.
#ifndef HAVE_ABSEIL
#define HAVE_ABSEIL
#endif
#include <iostream>
#include <memory>
#include <string>
@ -28,64 +35,17 @@
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include <grpcpp/ext/otel_plugin.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#ifdef BAZEL_BUILD
#include "examples/protos/helloworld.grpc.pb.h"
#include "examples/cpp/otel/util.h"
#else
#include "helloworld.grpc.pb.h"
#include "util.h"
#endif
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
ABSL_FLAG(std::string, prometheus_endpoint, "localhost:9464",
"Prometheus exporter endpoint");
using grpc::CallbackServerContext;
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerUnaryReactor;
using grpc::Status;
using helloworld::Greeter;
using helloworld::HelloReply;
using helloworld::HelloRequest;
// Logic and data behind the server's behavior.
class GreeterServiceImpl final : public Greeter::CallbackService {
ServerUnaryReactor* SayHello(CallbackServerContext* context,
const HelloRequest* request,
HelloReply* reply) override {
std::string prefix("Hello ");
reply->set_message(prefix + request->name());
ServerUnaryReactor* reactor = context->DefaultReactor();
reactor->Finish(Status::OK);
return reactor;
}
};
void RunServer(uint16_t port) {
std::string server_address = absl::StrFormat("0.0.0.0:%d", port);
GreeterServiceImpl service;
grpc::EnableDefaultHealthCheckService(true);
grpc::reflection::InitProtoReflectionServerBuilderPlugin();
ServerBuilder builder;
// Listen on the given address without any authentication mechanism.
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
// Register "service" as the instance through which we'll communicate with
// clients. In this case it corresponds to an *synchronous* service.
builder.RegisterService(&service);
// Finally assemble the server.
std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl;
// Wait for the server to shutdown. Note that some other thread must be
// responsible for shutting down the server for this call to ever return.
server->Wait();
}
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
// Register a global gRPC OpenTelemetry plugin configured with a prometheus
@ -96,6 +56,10 @@ int main(int argc, char** argv) {
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
// The default histogram boundaries are not granular enough for RPCs. Override
// the "grpc.server.call.duration" view as recommended by
// https://github.com/grpc/proposal/blob/master/A66-otel-stats.md.
AddLatencyView(meter_provider.get(), "grpc.server.call.duration", "s");
meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto status = grpc::OpenTelemetryPluginBuilder()
.SetMeterProvider(std::move(meter_provider))

View File

@ -0,0 +1,44 @@
# Copyright 2023 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.
licenses(["notice"])
cc_binary(
name = "greeter_callback_client",
srcs = ["greeter_callback_client.cc"],
defines = ["BAZEL_BUILD"],
deps = [
"//:grpcpp_otel_plugin",
"//examples/cpp/otel:util",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@io_opentelemetry_cpp//exporters/ostream:ostream_metric_exporter",
"@io_opentelemetry_cpp//sdk/src/metrics",
],
)
cc_binary(
name = "greeter_callback_server",
srcs = ["greeter_callback_server.cc"],
defines = ["BAZEL_BUILD"],
deps = [
"//:grpcpp_otel_plugin",
"//examples/cpp/otel:util",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/flags:parse",
"@com_google_absl//absl/strings:str_format",
"@io_opentelemetry_cpp//exporters/ostream:ostream_metric_exporter",
"@io_opentelemetry_cpp//sdk/src/metrics",
],
)

85
examples/cpp/otel/ostream/CMakeLists.txt generated Normal file
View File

@ -0,0 +1,85 @@
# Copyright 2018 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.
#
# cmake build file for C++ gRPC OpenTelemetry example.
# Assumes absl, protobuf, prometheus-cpp, opentelemetry-cpp and gRPC (with -DgRPC_BUILD_OPENTELEMETRY_PLUGIN=ON) have been installed using cmake.
# See cmake_externalproject/CMakeLists.txt for all-in-one cmake build
# that automatically builds all the dependencies before building helloworld.
cmake_minimum_required(VERSION 3.13)
project(grpc_opentelemetry_example C CXX)
include(../../cmake/common.cmake)
# Find opentelemetry-cpp package
find_package(opentelemetry-cpp CONFIG REQUIRED)
# Proto file
get_filename_component(hw_proto "../../../protos/helloworld.proto" ABSOLUTE)
get_filename_component(hw_proto_path "${hw_proto}" PATH)
# Generated sources
set(hw_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.cc")
set(hw_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.pb.h")
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h")
add_custom_command(
OUTPUT "${hw_proto_srcs}" "${hw_proto_hdrs}" "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${hw_proto_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${hw_proto}"
DEPENDS "${hw_proto}")
# Include generated *.pb.h files
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
include_directories("${CMAKE_SOURCE_DIR}")
# hw_grpc_proto
add_library(hw_grpc_proto
${hw_grpc_srcs}
${hw_grpc_hdrs}
${hw_proto_srcs}
${hw_proto_hdrs})
target_link_libraries(hw_grpc_proto
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF})
# util
add_library(util
"../util.cc")
target_link_libraries(util
hw_grpc_proto
opentelemetry-cpp::metrics
${_GRPC_GRPCPP}
${_REFLECTION}
${_PROTOBUF_LIBPROTOBUF})
# Targets greeter_callback_(client|server)
foreach(_target
greeter_callback_client greeter_callback_server)
add_executable(${_target} "${_target}.cc")
target_link_libraries(${_target}
absl::flags
absl::flags_parse
opentelemetry-cpp::metrics
opentelemetry-cpp::ostream_metrics_exporter
gRPC::grpcpp_otel_plugin
util
${_PROTOBUF_LIBPROTOBUF})
endforeach()

127
examples/cpp/otel/ostream/Makefile generated Normal file
View File

@ -0,0 +1,127 @@
#
# 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.
#
# TODO(jtattermusch): Remove the hack to workaround protobuf bug. See https://github.com/protocolbuffers/protobuf/issues/12439
# Hack: protobuf currently doesn't declare it's absl dependencies when protobuf.pc pkgconfig file is used.
PROTOBUF_ABSL_DEPS = absl_absl_check absl_absl_log absl_algorithm absl_base absl_bind_front absl_bits absl_btree absl_cleanup absl_cord absl_core_headers absl_debugging absl_die_if_null absl_dynamic_annotations absl_flags absl_flat_hash_map absl_flat_hash_set absl_function_ref absl_hash absl_layout absl_log_initialize absl_log_severity absl_memory absl_node_hash_map absl_node_hash_set absl_optional absl_span absl_status absl_statusor absl_strings absl_synchronization absl_time absl_type_traits absl_utility absl_variant
# TODO(jtattermusch): Remove the hack to workaround protobuf/utf8_range bug. See https://github.com/protocolbuffers/utf8_range/issues/20
# Hack: utf8_range (which is protobuf's dependency) currently doesn't have a pkgconfig file, so we need to explicitly
# tweak the list of libraries to link against to fix the build.
PROTOBUF_UTF8_RANGE_LINK_LIBS = -lutf8_validity
OPENTELEMETRY_LINK_LIBS = -lopentelemetry_metrics -lopentelemetry_exporter_ostream_metrics -lopentelemetry_resources -lopentelemetry_common
HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
SYSTEM ?= $(HOST_SYSTEM)
CXX = g++
CPPFLAGS += `pkg-config --cflags protobuf grpc absl_flags absl_flags_parse`
ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ grpcpp_otel_plugin absl_flags absl_flags_parse $(PROTOBUF_ABSL_DEPS)` \
$(PROTOBUF_UTF8_RANGE_LINK_LIBS) \
$(OPENTELEMETRY_LINK_LIBS) \
-pthread \
-lgrpc++_reflection \
-ldl
else
LDFLAGS += -L/usr/local/lib `pkg-config --libs --static protobuf grpc++ grpcpp_otel_plugin absl_flags absl_flags_parse $(PROTOBUF_ABSL_DEPS)` \
$(PROTOBUF_UTF8_RANGE_LINK_LIBS) \
$(OPENTELEMETRY_LINK_LIBS) \
-pthread \
-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed \
-ldl
endif
PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= `which $(GRPC_CPP_PLUGIN)`
PROTOS_PATH = ../../../protos
vpath %.proto $(PROTOS_PATH)
all: system-check greeter_callback_client greeter_callback_server
greeter_callback_client: util.o helloworld.pb.o helloworld.grpc.pb.o greeter_callback_client.o
$(CXX) $^ $(LDFLAGS) -o $@
greeter_callback_server: util.o helloworld.pb.o helloworld.grpc.pb.o greeter_callback_server.o
$(CXX) $^ $(LDFLAGS) -o $@
.PRECIOUS: %.grpc.pb.cc
%.grpc.pb.cc: %.proto
$(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen-grpc=$(GRPC_CPP_PLUGIN_PATH) $<
.PRECIOUS: %.pb.cc
%.pb.cc: %.proto
$(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<
util.o: ../util.cc
$(CXX) $^ -I . -I $(CPPFLAGS) -c -o $@
clean:
rm -f *.o *.pb.cc *.pb.h greeter_callback_client greeter_callback_server
# The following is to test your system and ensure a smoother experience.
# They are by no means necessary to actually compile a grpc-enabled software.
PROTOC_CMD = which $(PROTOC)
PROTOC_CHECK_CMD = $(PROTOC) --version | grep -q 'libprotoc.3\|libprotoc [0-9][0-9]\.'
PLUGIN_CHECK_CMD = which $(GRPC_CPP_PLUGIN)
HAS_PROTOC = $(shell $(PROTOC_CMD) > /dev/null && echo true || echo false)
ifeq ($(HAS_PROTOC),true)
HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
endif
HAS_PLUGIN = $(shell $(PLUGIN_CHECK_CMD) > /dev/null && echo true || echo false)
SYSTEM_OK = false
ifeq ($(HAS_VALID_PROTOC),true)
ifeq ($(HAS_PLUGIN),true)
SYSTEM_OK = true
endif
endif
system-check:
ifneq ($(HAS_VALID_PROTOC),true)
@echo " DEPENDENCY ERROR"
@echo
@echo "You don't have protoc 3.0.0 or newer installed in your path."
@echo "Please install an up-to-date version of Google protocol buffers."
@echo "You can find it here:"
@echo
@echo " https://github.com/protocolbuffers/protobuf/releases"
@echo
@echo "Here is what I get when trying to evaluate your version of protoc:"
@echo
-$(PROTOC) --version
@echo
@echo
endif
ifneq ($(HAS_PLUGIN),true)
@echo " DEPENDENCY ERROR"
@echo
@echo "You don't have the grpc c++ protobuf plugin installed in your path."
@echo "Please install grpc. You can find it here:"
@echo
@echo " https://github.com/grpc/grpc"
@echo
@echo "Here is what I get when trying to detect if you have the plugin:"
@echo
-which $(GRPC_CPP_PLUGIN)
@echo
@echo
endif
ifneq ($(SYSTEM_OK),true)
@false
endif

View File

@ -0,0 +1,79 @@
/*
*
* Copyright 2021 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.
*
*/
// Explicitly define HAVE_ABSEIL to avoid conflict with OTel's Abseil
// version. Refer
// https://github.com/open-telemetry/opentelemetry-cpp/issues/1042.
#ifndef HAVE_ABSEIL
#define HAVE_ABSEIL
#endif
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "opentelemetry/exporters/ostream/metric_exporter.h"
#include "opentelemetry/exporters/ostream/metric_exporter_factory.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader_factory.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include <grpcpp/ext/otel_plugin.h>
#ifdef BAZEL_BUILD
#include "examples/cpp/otel/util.h"
#else
#include "../util.h"
#endif
ABSL_FLAG(std::string, target, "localhost:50051", "Server address");
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
// Register a global gRPC OpenTelemetry plugin configured with an ostream
// exporter.
auto ostream_exporter =
opentelemetry::exporter::metrics::OStreamMetricExporterFactory::Create();
opentelemetry::sdk::metrics::PeriodicExportingMetricReaderOptions
reader_options;
reader_options.export_interval_millis = std::chrono::milliseconds(1000);
reader_options.export_timeout_millis = std::chrono::milliseconds(500);
auto reader =
opentelemetry::sdk::metrics::PeriodicExportingMetricReaderFactory::Create(
std::move(ostream_exporter), reader_options);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
// The default histogram boundaries are not granular enough for RPCs. Override
// the "grpc.client.attempt.duration" view as recommended by
// https://github.com/grpc/proposal/blob/master/A66-otel-stats.md.
AddLatencyView(meter_provider.get(), "grpc.client.attempt.duration", "s");
meter_provider->AddMetricReader(std::move(reader));
auto status = grpc::OpenTelemetryPluginBuilder()
.SetMeterProvider(std::move(meter_provider))
.BuildAndRegisterGlobal();
if (!status.ok()) {
std::cerr << "Failed to register gRPC OpenTelemetry Plugin: "
<< status.ToString() << std::endl;
return static_cast<int>(status.code());
}
// Continuously send RPCs every second.
RunClient(absl::GetFlag(FLAGS_target));
return 0;
}

View File

@ -0,0 +1,78 @@
/*
*
* Copyright 2021 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.
*
*/
// Explicitly define HAVE_ABSEIL to avoid conflict with OTel's Abseil
// version. Refer
// https://github.com/open-telemetry/opentelemetry-cpp/issues/1042.
#ifndef HAVE_ABSEIL
#define HAVE_ABSEIL
#endif
#include <iostream>
#include <memory>
#include <string>
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "opentelemetry/exporters/ostream/metric_exporter.h"
#include "opentelemetry/exporters/ostream/metric_exporter_factory.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader_factory.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include <grpcpp/ext/otel_plugin.h>
#ifdef BAZEL_BUILD
#include "examples/cpp/otel/util.h"
#else
#include "../util.h"
#endif
ABSL_FLAG(uint16_t, port, 50051, "Server port for the service");
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
// Register a global gRPC OpenTelemetry plugin configured with an ostream
// exporter.
auto ostream_exporter =
opentelemetry::exporter::metrics::OStreamMetricExporterFactory::Create();
opentelemetry::sdk::metrics::PeriodicExportingMetricReaderOptions
reader_options;
reader_options.export_interval_millis = std::chrono::milliseconds(1000);
reader_options.export_timeout_millis = std::chrono::milliseconds(500);
auto reader =
opentelemetry::sdk::metrics::PeriodicExportingMetricReaderFactory::Create(
std::move(ostream_exporter), reader_options);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
// The default histogram boundaries are not granular enough for RPCs. Override
// the "grpc.server.call.duration" view as recommended by
// https://github.com/grpc/proposal/blob/master/A66-otel-stats.md.
AddLatencyView(meter_provider.get(), "grpc.server.call.duration", "s");
meter_provider->AddMetricReader(std::move(reader));
auto status = grpc::OpenTelemetryPluginBuilder()
.SetMeterProvider(std::move(meter_provider))
.BuildAndRegisterGlobal();
if (!status.ok()) {
std::cerr << "Failed to register gRPC OpenTelemetry Plugin: "
<< status.ToString() << std::endl;
return static_cast<int>(status.code());
}
RunServer(absl::GetFlag(FLAGS_port));
return 0;
}

181
examples/cpp/otel/util.cc Normal file
View File

@ -0,0 +1,181 @@
//
//
// 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.
//
//
// Explicitly define HAVE_ABSEIL to avoid conflict with OTel's Abseil
// version. Refer
// https://github.com/open-telemetry/opentelemetry-cpp/issues/1042.
#ifndef HAVE_ABSEIL
#define HAVE_ABSEIL
#endif
#include <condition_variable>
#include <mutex>
#include "opentelemetry/sdk/metrics/view/instrument_selector_factory.h"
#include "opentelemetry/sdk/metrics/view/meter_selector_factory.h"
#include "opentelemetry/sdk/metrics/view/view_factory.h"
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/health_check_service_interface.h>
#ifdef BAZEL_BUILD
#include "examples/cpp/otel/util.h"
#include "examples/protos/helloworld.grpc.pb.h"
#else
#include "helloworld.grpc.pb.h"
#include "util.h"
#endif
using grpc::CallbackServerContext;
using grpc::Channel;
using grpc::ClientContext;
using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerUnaryReactor;
using grpc::Status;
using helloworld::Greeter;
using helloworld::HelloReply;
using helloworld::HelloRequest;
void AddLatencyView(opentelemetry::sdk::metrics::MeterProvider* provider,
const std::string& name, const std::string& unit) {
auto histogram_config = std::make_shared<
opentelemetry::sdk::metrics::HistogramAggregationConfig>();
histogram_config->boundaries_ = {
0, 0.00001, 0.00005, 0.0001, 0.0003, 0.0006, 0.0008, 0.001, 0.002,
0.003, 0.004, 0.005, 0.006, 0.008, 0.01, 0.013, 0.016, 0.02,
0.025, 0.03, 0.04, 0.05, 0.065, 0.08, 0.1, 0.13, 0.16,
0.2, 0.25, 0.3, 0.4, 0.5, 0.65, 0.8, 1, 2,
5, 10, 20, 50, 100};
provider->AddView(
opentelemetry::sdk::metrics::InstrumentSelectorFactory::Create(
opentelemetry::sdk::metrics::InstrumentType::kHistogram, name, unit),
opentelemetry::sdk::metrics::MeterSelectorFactory::Create(
"grpc-c++", grpc::Version(), ""),
opentelemetry::sdk::metrics::ViewFactory::Create(
name, "", unit,
opentelemetry::sdk::metrics::AggregationType::kHistogram,
std::move(histogram_config)));
}
namespace {
class GreeterClient {
public:
GreeterClient(std::shared_ptr<Channel> channel)
: stub_(Greeter::NewStub(channel)) {}
// Assembles the client's payload, sends it and presents the response back
// from the server.
std::string SayHello(const std::string& user) {
// Data we are sending to the server.
HelloRequest request;
request.set_name(user);
// Container for the data we expect from the server.
HelloReply reply;
// Context for the client. It could be used to convey extra information to
// the server and/or tweak certain RPC behaviors.
ClientContext context;
// The actual RPC.
std::mutex mu;
std::condition_variable cv;
bool done = false;
Status status;
stub_->async()->SayHello(&context, &request, &reply,
[&mu, &cv, &done, &status](Status s) {
status = std::move(s);
std::lock_guard<std::mutex> lock(mu);
done = true;
cv.notify_one();
});
std::unique_lock<std::mutex> lock(mu);
while (!done) {
cv.wait(lock);
}
// Act upon its status.
if (status.ok()) {
return reply.message();
} else {
std::cout << status.error_code() << ": " << status.error_message()
<< std::endl;
return "RPC failed";
}
}
private:
std::unique_ptr<Greeter::Stub> stub_;
};
// Logic and data behind the server's behavior.
class GreeterServiceImpl final : public Greeter::CallbackService {
ServerUnaryReactor* SayHello(CallbackServerContext* context,
const HelloRequest* request,
HelloReply* reply) override {
std::string prefix("Hello ");
reply->set_message(prefix + request->name());
ServerUnaryReactor* reactor = context->DefaultReactor();
reactor->Finish(Status::OK);
return reactor;
}
};
} // namespace
void RunServer(uint16_t port) {
std::string server_address = absl::StrFormat("0.0.0.0:%d", port);
GreeterServiceImpl service;
grpc::EnableDefaultHealthCheckService(true);
grpc::reflection::InitProtoReflectionServerBuilderPlugin();
ServerBuilder builder;
// Listen on the given address without any authentication mechanism.
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
// Register "service" as the instance through which we'll communicate with
// clients. In this case it corresponds to an *synchronous* service.
builder.RegisterService(&service);
// Finally assemble the server.
std::unique_ptr<Server> server(builder.BuildAndStart());
std::cout << "Server listening on " << server_address << std::endl;
// Wait for the server to shutdown. Note that some other thread must be
// responsible for shutting down the server for this call to ever return.
server->Wait();
}
void RunClient(const std::string& target_str) {
// Instantiate the client. It requires a channel, out of which the actual RPCs
// are created. This channel models a connection to an endpoint specified by
// the argument "--target=" which is the only expected argument.
grpc::ChannelArguments args;
// Continuously send RPCs every second.
while (true) {
GreeterClient greeter(grpc::CreateCustomChannel(
target_str, grpc::InsecureChannelCredentials(), args));
std::string user("world");
std::string reply = greeter.SayHello(user);
std::cout << "Greeter received: " << reply << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}

33
examples/cpp/otel/util.h Normal file
View File

@ -0,0 +1,33 @@
//
//
// Copyright 2024 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
#ifndef GRPCPP_EXAMPLES_CPP_OTEL_UTIL_H
#define GRPCPP_EXAMPLES_CPP_OTEL_UTIL_H
#include <string>
#include "opentelemetry/sdk/metrics/meter_provider.h"
// Helper function that adds view for gRPC latency instrument \a name with unit
// \a unit with bucket boundaries that are more useful for RPCs.
void AddLatencyView(opentelemetry::sdk::metrics::MeterProvider* provider,
const std::string& name, const std::string& unit);
void RunServer(uint16_t port);
void RunClient(const std::string& target_str);
#endif // GRPCPP_EXAMPLES_CPP_OTEL_UTIL_H

4
gRPC-C++.podspec generated
View File

@ -22,7 +22,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-C++'
# TODO (mxyan): use version that match gRPC version when pod is stabilized
version = '1.64.0-dev'
version = '1.64.2'
s.version = version
s.summary = 'gRPC C++ library'
s.homepage = 'https://grpc.io'
@ -243,6 +243,8 @@ Pod::Spec.new do |s|
ss.dependency 'abseil/functional/bind_front', abseil_version
ss.dependency 'abseil/functional/function_ref', abseil_version
ss.dependency 'abseil/hash/hash', abseil_version
ss.dependency 'abseil/log/absl_check', abseil_version
ss.dependency 'abseil/log/absl_log', abseil_version
ss.dependency 'abseil/log/check', abseil_version
ss.dependency 'abseil/log/globals', abseil_version
ss.dependency 'abseil/log/log', abseil_version

2
gRPC-Core.podspec generated
View File

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-Core'
version = '1.64.0-dev'
version = '1.64.2'
s.version = version
s.summary = 'Core cross-platform gRPC library, written in C'
s.homepage = 'https://grpc.io'

2
gRPC-ProtoRPC.podspec generated
View File

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC'
version = '1.64.0-dev'
version = '1.64.2'
s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io'

View File

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary'
version = '1.64.0-dev'
version = '1.64.2'
s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io'

2
gRPC.podspec generated
View File

@ -20,7 +20,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC'
version = '1.64.0-dev'
version = '1.64.2'
s.version = version
s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io'

View File

@ -38,7 +38,7 @@
#include <memory>
#include <string>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/impl/compression_types.h>
#include <grpc/impl/propagation_bits.h>
@ -248,7 +248,7 @@ class ClientContext {
/// \return A multimap of initial metadata key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerInitialMetadata() const {
CHECK(initial_metadata_received_);
ABSL_CHECK(initial_metadata_received_);
return *recv_initial_metadata_.map();
}

View File

@ -34,7 +34,7 @@
#include <list>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/support/atm.h>
@ -325,7 +325,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary {
bool ok = ev.success != 0;
void* ignored = tag;
if (tag->FinalizeResult(&ignored, &ok)) {
CHECK(ignored == tag);
ABSL_CHECK(ignored == tag);
return ok;
}
}
@ -346,7 +346,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary {
bool ok = ev.success != 0;
void* ignored = tag;
// the tag must be swallowed if using TryPluck
CHECK(!tag->FinalizeResult(&ignored, &ok));
ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok));
}
/// Performs a single polling pluck on \a tag. Calls tag->FinalizeResult if
@ -363,7 +363,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary {
bool ok = ev.success != 0;
void* ignored = tag;
CHECK(!tag->FinalizeResult(&ignored, &ok));
ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok));
}
/// Manage state of avalanching operations : completion queue tags that

View File

@ -23,7 +23,8 @@
#include <map>
#include <memory>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include <grpc/grpc.h>
#include <grpc/impl/compression_types.h>
@ -318,7 +319,7 @@ class CallOpSendMessage {
return;
}
if (msg_ != nullptr) {
CHECK(serializer_(msg_).ok());
ABSL_CHECK(serializer_(msg_).ok());
}
serializer_ = nullptr;
grpc_op* op = &ops[(*nops)++];
@ -797,7 +798,7 @@ class CallOpClientRecvStatus {
if (recv_status_ == nullptr || hijacked_) return;
if (static_cast<StatusCode>(status_code_) == StatusCode::OK) {
*recv_status_ = Status();
DCHECK_EQ(debug_error_string_, nullptr);
ABSL_DCHECK_EQ(debug_error_string_, nullptr);
} else {
*recv_status_ =
Status(static_cast<StatusCode>(status_code_),
@ -974,9 +975,9 @@ class CallOpSet : public CallOpSetInterface,
// A failure here indicates an API misuse; for example, doing a Write
// while another Write is already pending on the same RPC or invoking
// WritesDone multiple times
gpr_log(GPR_ERROR, "API misuse of type %s observed",
grpc_call_error_to_string(err));
CHECK(false);
ABSL_LOG(ERROR) << "API misuse of type " << grpc_call_error_to_string(err)
<< " observed";
ABSL_CHECK(false);
}
}
@ -986,8 +987,8 @@ class CallOpSet : public CallOpSetInterface,
done_intercepting_ = true;
// The following call_start_batch is internally-generated so no need for an
// explanatory log on failure.
CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(),
nullptr) == GRPC_CALL_OK);
ABSL_CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(),
nullptr) == GRPC_CALL_OK);
}
private:

View File

@ -22,7 +22,7 @@
#include <array>
#include <functional>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/impl/grpc_types.h>
#include <grpc/support/log.h>
@ -58,15 +58,16 @@ class InterceptorBatchMethodsImpl
if (call_->client_rpc_info() != nullptr) {
return ProceedClient();
}
CHECK_NE(call_->server_rpc_info(), nullptr);
ABSL_CHECK_NE(call_->server_rpc_info(), nullptr);
ProceedServer();
}
void Hijack() override {
// Only the client can hijack when sending down initial metadata
CHECK(!reverse_ && ops_ != nullptr && call_->client_rpc_info() != nullptr);
ABSL_CHECK(!reverse_ && ops_ != nullptr &&
call_->client_rpc_info() != nullptr);
// It is illegal to call Hijack twice
CHECK(!ran_hijacking_interceptor_);
ABSL_CHECK(!ran_hijacking_interceptor_);
auto* rpc_info = call_->client_rpc_info();
rpc_info->hijacked_ = true;
rpc_info->hijacked_interceptor_ = current_interceptor_index_;
@ -81,21 +82,21 @@ class InterceptorBatchMethodsImpl
}
ByteBuffer* GetSerializedSendMessage() override {
CHECK_NE(orig_send_message_, nullptr);
ABSL_CHECK_NE(orig_send_message_, nullptr);
if (*orig_send_message_ != nullptr) {
CHECK(serializer_(*orig_send_message_).ok());
ABSL_CHECK(serializer_(*orig_send_message_).ok());
*orig_send_message_ = nullptr;
}
return send_message_;
}
const void* GetSendMessage() override {
CHECK_NE(orig_send_message_, nullptr);
ABSL_CHECK_NE(orig_send_message_, nullptr);
return *orig_send_message_;
}
void ModifySendMessage(const void* message) override {
CHECK_NE(orig_send_message_, nullptr);
ABSL_CHECK_NE(orig_send_message_, nullptr);
*orig_send_message_ = message;
}
@ -130,7 +131,7 @@ class InterceptorBatchMethodsImpl
Status* GetRecvStatus() override { return recv_status_; }
void FailHijackedSendMessage() override {
CHECK(hooks_[static_cast<size_t>(
ABSL_CHECK(hooks_[static_cast<size_t>(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)]);
*fail_send_message_ = true;
}
@ -193,7 +194,7 @@ class InterceptorBatchMethodsImpl
}
void FailHijackedRecvMessage() override {
CHECK(hooks_[static_cast<size_t>(
ABSL_CHECK(hooks_[static_cast<size_t>(
experimental::InterceptionHookPoints::PRE_RECV_MESSAGE)]);
*hijacked_recv_message_failed_ = true;
}
@ -237,7 +238,7 @@ class InterceptorBatchMethodsImpl
// ContinueFinalizeOpsAfterInterception will be called. Note that neither of
// them is invoked if there were no interceptors registered.
bool RunInterceptors() {
CHECK(ops_);
ABSL_CHECK(ops_);
auto* client_rpc_info = call_->client_rpc_info();
if (client_rpc_info != nullptr) {
if (client_rpc_info->interceptors_.empty()) {
@ -262,8 +263,8 @@ class InterceptorBatchMethodsImpl
// SyncRequest.
bool RunInterceptors(std::function<void(void)> f) {
// This is used only by the server for initial call request
CHECK_EQ(reverse_, true);
CHECK_EQ(call_->client_rpc_info(), nullptr);
ABSL_CHECK_EQ(reverse_, true);
ABSL_CHECK_EQ(call_->client_rpc_info(), nullptr);
auto* server_rpc_info = call_->server_rpc_info();
if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) {
return true;
@ -357,7 +358,7 @@ class InterceptorBatchMethodsImpl
return ops_->ContinueFinalizeResultAfterInterception();
}
}
CHECK(callback_);
ABSL_CHECK(callback_);
callback_();
}
@ -423,98 +424,103 @@ class CancelInterceptorBatchMethods
void Hijack() override {
// Only the client can hijack when sending down initial metadata
CHECK(false) << "It is illegal to call Hijack on a method which has a "
"Cancel notification";
ABSL_CHECK(false) << "It is illegal to call Hijack on a method which has a "
"Cancel notification";
}
ByteBuffer* GetSerializedSendMessage() override {
CHECK(false) << "It is illegal to call GetSendMessage on a method which "
"has a Cancel notification";
ABSL_CHECK(false)
<< "It is illegal to call GetSendMessage on a method which "
"has a Cancel notification";
return nullptr;
}
bool GetSendMessageStatus() override {
CHECK(false)
ABSL_CHECK(false)
<< "It is illegal to call GetSendMessageStatus on a method which "
"has a Cancel notification";
return false;
}
const void* GetSendMessage() override {
CHECK(false)
ABSL_CHECK(false)
<< "It is illegal to call GetOriginalSendMessage on a method which "
"has a Cancel notification";
return nullptr;
}
void ModifySendMessage(const void* /*message*/) override {
CHECK(false) << "It is illegal to call ModifySendMessage on a method which "
"has a Cancel notification";
ABSL_CHECK(false)
<< "It is illegal to call ModifySendMessage on a method which "
"has a Cancel notification";
}
std::multimap<std::string, std::string>* GetSendInitialMetadata() override {
CHECK(false) << "It is illegal to call GetSendInitialMetadata on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call GetSendInitialMetadata on a "
"method which has a Cancel notification";
return nullptr;
}
Status GetSendStatus() override {
CHECK(false) << "It is illegal to call GetSendStatus on a method which "
"has a Cancel notification";
ABSL_CHECK(false)
<< "It is illegal to call GetSendStatus on a method which "
"has a Cancel notification";
return Status();
}
void ModifySendStatus(const Status& /*status*/) override {
CHECK(false) << "It is illegal to call ModifySendStatus on a method "
"which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call ModifySendStatus on a method "
"which has a Cancel notification";
}
std::multimap<std::string, std::string>* GetSendTrailingMetadata() override {
CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a "
"method which has a Cancel notification";
return nullptr;
}
void* GetRecvMessage() override {
CHECK(false) << "It is illegal to call GetRecvMessage on a method which "
"has a Cancel notification";
ABSL_CHECK(false)
<< "It is illegal to call GetRecvMessage on a method which "
"has a Cancel notification";
return nullptr;
}
std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvInitialMetadata()
override {
CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a "
"method which has a Cancel notification";
return nullptr;
}
Status* GetRecvStatus() override {
CHECK(false) << "It is illegal to call GetRecvStatus on a method which "
"has a Cancel notification";
ABSL_CHECK(false)
<< "It is illegal to call GetRecvStatus on a method which "
"has a Cancel notification";
return nullptr;
}
std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvTrailingMetadata()
override {
CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a "
"method which has a Cancel notification";
return nullptr;
}
std::unique_ptr<ChannelInterface> GetInterceptedChannel() override {
CHECK(false) << "It is illegal to call GetInterceptedChannel on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call GetInterceptedChannel on a "
"method which has a Cancel notification";
return std::unique_ptr<ChannelInterface>(nullptr);
}
void FailHijackedRecvMessage() override {
CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a "
"method which has a Cancel notification";
}
void FailHijackedSendMessage() override {
CHECK(false) << "It is illegal to call FailHijackedSendMessage on a "
"method which has a Cancel notification";
ABSL_CHECK(false) << "It is illegal to call FailHijackedSendMessage on a "
"method which has a Cancel notification";
}
};
} // namespace internal

View File

@ -21,7 +21,7 @@
#include <type_traits>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/byte_buffer_reader.h>
#include <grpc/impl/grpc_types.h>
@ -53,8 +53,8 @@ Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb,
if (static_cast<size_t>(byte_size) <= GRPC_SLICE_INLINED_SIZE) {
Slice slice(byte_size);
// We serialize directly into the allocated slices memory
CHECK(slice.end() == msg.SerializeWithCachedSizesToArray(
const_cast<uint8_t*>(slice.begin())));
ABSL_CHECK(slice.end() == msg.SerializeWithCachedSizesToArray(
const_cast<uint8_t*>(slice.begin())));
ByteBuffer tmp(&slice, 1);
bb->Swap(&tmp);

View File

@ -25,7 +25,8 @@
#include <memory>
#include <vector>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include "absl/log/absl_log.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_method.h>
@ -77,7 +78,7 @@ class MethodHandler {
// retained by the handler. Returns nullptr if deserialization failed.
virtual void* Deserialize(grpc_call* /*call*/, grpc_byte_buffer* req,
Status* /*status*/, void** /*handler_data*/) {
CHECK_EQ(req, nullptr);
ABSL_CHECK_EQ(req, nullptr);
return nullptr;
}
};
@ -116,12 +117,12 @@ class RpcServiceMethod : public RpcMethod {
// this is not an error condition, as it allows users to declare a server
// like WithRawMethod_foo<AsyncService>. However since it
// overwrites behavior, it should be logged.
gpr_log(
GPR_INFO,
"You are marking method %s as '%s', even though it was "
"previously marked '%s'. This behavior will overwrite the original "
"behavior. If you expected this then ignore this message.",
name(), TypeToString(api_type_), TypeToString(type));
ABSL_LOG(INFO)
<< "You are marking method " << name() << " as '"
<< TypeToString(api_type_)
<< "', even though it was previously marked '" << TypeToString(type)
<< "'. This behavior will overwrite the original behavior. If "
"you expected this then ignore this message.";
}
api_type_ = type;
}

View File

@ -18,7 +18,7 @@
#ifndef GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H
#define GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/call.h>
@ -149,7 +149,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler {
}
void SendInitialMetadata() override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
this->Ref();
// The callback for this function should not be marked inline because it
// is directly invoking a user-controlled reaction
@ -337,7 +337,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler {
}
void SendInitialMetadata() override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
this->Ref();
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
@ -541,7 +541,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
}
void SendInitialMetadata() override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
this->Ref();
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
@ -579,7 +579,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
ctx_->sent_initial_metadata_ = true;
}
// TODO(vjpai): don't assert
CHECK(write_ops_.SendMessagePtr(resp, options).ok());
ABSL_CHECK(write_ops_.SendMessagePtr(resp, options).ok());
call_.PerformOps(&write_ops_);
}
@ -587,7 +587,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler {
grpc::Status s) override {
// This combines the write into the finish callback
// TODO(vjpai): don't assert
CHECK(finish_ops_.SendMessagePtr(resp, options).ok());
ABSL_CHECK(finish_ops_.SendMessagePtr(resp, options).ok());
Finish(std::move(s));
}
@ -753,7 +753,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
}
void SendInitialMetadata() override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
this->Ref();
// The callback for this function should not be inlined because it invokes
// a user-controlled reaction, but any resulting OnDone can be inlined in
@ -791,14 +791,14 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler {
ctx_->sent_initial_metadata_ = true;
}
// TODO(vjpai): don't assert
CHECK(write_ops_.SendMessagePtr(resp, options).ok());
ABSL_CHECK(write_ops_.SendMessagePtr(resp, options).ok());
call_.PerformOps(&write_ops_);
}
void WriteAndFinish(const ResponseType* resp, grpc::WriteOptions options,
grpc::Status s) override {
// TODO(vjpai): don't assert
CHECK(finish_ops_.SendMessagePtr(resp, options).ok());
ABSL_CHECK(finish_ops_.SendMessagePtr(resp, options).ok());
Finish(std::move(s));
}

View File

@ -19,7 +19,7 @@
#ifndef GRPCPP_IMPL_SERVICE_TYPE_H
#define GRPCPP_IMPL_SERVICE_TYPE_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_service_method.h>
@ -152,7 +152,7 @@ class Service {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
CHECK_NE(methods_[idx].get(), nullptr)
ABSL_CHECK_NE(methods_[idx].get(), nullptr)
<< "Cannot mark the method as 'async' because it has already been "
"marked as 'generic'.";
methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::ASYNC);
@ -162,7 +162,7 @@ class Service {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
CHECK_NE(methods_[idx].get(), nullptr)
ABSL_CHECK_NE(methods_[idx].get(), nullptr)
<< "Cannot mark the method as 'raw' because it has already "
"been marked as 'generic'.";
methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::RAW);
@ -172,7 +172,7 @@ class Service {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
CHECK_NE(methods_[idx]->handler(), nullptr)
ABSL_CHECK_NE(methods_[idx]->handler(), nullptr)
<< "Cannot mark the method as 'generic' because it has already been "
"marked as 'async' or 'raw'.";
methods_[idx].reset();
@ -182,7 +182,7 @@ class Service {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
CHECK(methods_[idx] && methods_[idx]->handler())
ABSL_CHECK(methods_[idx] && methods_[idx]->handler())
<< "Cannot mark an async or generic method Streamed";
methods_[idx]->SetHandler(streamed_method);
@ -197,7 +197,7 @@ class Service {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
CHECK_NE(methods_[idx].get(), nullptr)
ABSL_CHECK_NE(methods_[idx].get(), nullptr)
<< "Cannot mark the method as 'callback' because it has already been "
"marked as 'generic'.";
methods_[idx]->SetHandler(handler);
@ -209,7 +209,7 @@ class Service {
// This does not have to be a hard error, however no one has approached us
// with a use case yet. Please file an issue if you believe you have one.
size_t idx = static_cast<size_t>(index);
CHECK_NE(methods_[idx].get(), nullptr)
ABSL_CHECK_NE(methods_[idx].get(), nullptr)
<< "Cannot mark the method as 'raw callback' because it has already "
"been marked as 'generic'.";
methods_[idx]->SetHandler(handler);

View File

@ -27,7 +27,7 @@
#include <mutex>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include "absl/synchronization/mutex.h"
#include <grpc/support/log.h>
@ -106,7 +106,7 @@ class ABSL_SCOPED_LOCKABLE ReleasableMutexLock {
ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete;
void Release() ABSL_UNLOCK_FUNCTION() {
DCHECK(!released_);
ABSL_DCHECK(!released_);
released_ = true;
mu_->Unlock();
}

View File

@ -19,7 +19,7 @@
#ifndef GRPCPP_SERVER_INTERFACE_H
#define GRPCPP_SERVER_INTERFACE_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/grpc_types.h>
@ -320,7 +320,7 @@ class ServerInterface : public internal::CallHook {
grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq, void* tag,
Message* message) {
CHECK(method);
ABSL_CHECK(method);
new PayloadAsyncRequest<Message>(method, this, context, stream, call_cq,
notification_cq, tag, message);
}
@ -331,7 +331,7 @@ class ServerInterface : public internal::CallHook {
grpc::CompletionQueue* call_cq,
grpc::ServerCompletionQueue* notification_cq,
void* tag) {
CHECK(method);
ABSL_CHECK(method);
new NoPayloadAsyncRequest(method, this, context, stream, call_cq,
notification_cq, tag);
}

View File

@ -19,7 +19,7 @@
#ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H
#define GRPCPP_SUPPORT_ASYNC_STREAM_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -202,7 +202,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientAsyncReader));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncReader));
}
// This operator should never be called as the memory should be freed as part
@ -210,10 +210,10 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall(void* tag) override {
CHECK(!started_);
ABSL_CHECK(!started_);
started_ = true;
StartCallInternal(tag);
}
@ -227,8 +227,8 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
/// calling code can access the received metadata through the
/// \a ClientContext.
void ReadInitialMetadata(void* tag) override {
CHECK(started_);
CHECK(!context_->initial_metadata_received_);
ABSL_CHECK(started_);
ABSL_CHECK(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@ -236,7 +236,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
}
void Read(R* msg, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
@ -251,7 +251,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata received from the server.
void Finish(grpc::Status* status, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@ -267,12 +267,12 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
const W& request, bool start, void* tag)
: context_(context), call_(call), started_(start) {
// TODO(ctiller): don't assert
CHECK(init_ops_.SendMessage(request).ok());
ABSL_CHECK(init_ops_.SendMessage(request).ok());
init_ops_.ClientSendClose();
if (start) {
StartCallInternal(tag);
} else {
CHECK(tag == nullptr);
ABSL_CHECK(tag == nullptr);
}
}
@ -350,7 +350,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientAsyncWriter));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncWriter));
}
// This operator should never be called as the memory should be freed as part
@ -358,10 +358,10 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall(void* tag) override {
CHECK(!started_);
ABSL_CHECK(!started_);
started_ = true;
StartCallInternal(tag);
}
@ -374,8 +374,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
/// associated with this call is updated, and the calling code can access
/// the received metadata through the \a ClientContext.
void ReadInitialMetadata(void* tag) override {
CHECK(started_);
CHECK(!context_->initial_metadata_received_);
ABSL_CHECK(started_);
ABSL_CHECK(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@ -383,27 +383,27 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
}
void Write(const W& msg, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
if (options.is_last_message()) {
options.set_buffer_hint();
write_ops_.ClientSendClose();
}
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
void WritesDone(void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
write_ops_.ClientSendClose();
call_.PerformOps(&write_ops_);
@ -417,7 +417,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
/// - attempts to fill in the \a response parameter passed to this class's
/// constructor with the server's response message.
void Finish(grpc::Status* status, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@ -437,7 +437,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
if (start) {
StartCallInternal(tag);
} else {
CHECK(tag == nullptr);
ABSL_CHECK(tag == nullptr);
}
}
@ -517,7 +517,7 @@ class ClientAsyncReaderWriter final
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientAsyncReaderWriter));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncReaderWriter));
}
// This operator should never be called as the memory should be freed as part
@ -525,10 +525,10 @@ class ClientAsyncReaderWriter final
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall(void* tag) override {
CHECK(!started_);
ABSL_CHECK(!started_);
started_ = true;
StartCallInternal(tag);
}
@ -541,8 +541,8 @@ class ClientAsyncReaderWriter final
/// is updated with it, and then the receiving initial metadata can
/// be accessed through this \a ClientContext.
void ReadInitialMetadata(void* tag) override {
CHECK(started_);
CHECK(!context_->initial_metadata_received_);
ABSL_CHECK(started_);
ABSL_CHECK(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag);
meta_ops_.RecvInitialMetadata(context_);
@ -550,7 +550,7 @@ class ClientAsyncReaderWriter final
}
void Read(R* msg, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_);
@ -560,27 +560,27 @@ class ClientAsyncReaderWriter final
}
void Write(const W& msg, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
void Write(const W& msg, grpc::WriteOptions options, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
if (options.is_last_message()) {
options.set_buffer_hint();
write_ops_.ClientSendClose();
}
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
void WritesDone(void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
write_ops_.set_output_tag(tag);
write_ops_.ClientSendClose();
call_.PerformOps(&write_ops_);
@ -591,7 +591,7 @@ class ClientAsyncReaderWriter final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void Finish(grpc::Status* status, void* tag) override {
CHECK(started_);
ABSL_CHECK(started_);
finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_);
@ -608,7 +608,7 @@ class ClientAsyncReaderWriter final
if (start) {
StartCallInternal(tag);
} else {
CHECK(tag == nullptr);
ABSL_CHECK(tag == nullptr);
}
}
@ -708,7 +708,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
/// - The initial metadata that will be sent to the client from this op will
/// be taken from the \a ServerContext associated with the call.
void SendInitialMetadata(void* tag) override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@ -767,7 +767,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
/// gRPC doesn't take ownership or a reference to \a status, so it is safe to
/// to deallocate once FinishWithError returns.
void FinishWithError(const grpc::Status& status, void* tag) override {
CHECK(!status.ok());
ABSL_CHECK(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@ -857,7 +857,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
///
/// \param[in] tag Tag identifying this request.
void SendInitialMetadata(void* tag) override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@ -873,7 +873,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@ -885,7 +885,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
EnsureInitialMetadataSent(&write_ops_);
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
@ -904,7 +904,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
options.set_buffer_hint();
CHECK(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
call_.PerformOps(&write_ops_);
}
@ -1023,7 +1023,7 @@ class ServerAsyncReaderWriter final
///
/// \param[in] tag Tag identifying this request.
void SendInitialMetadata(void* tag) override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_,
@ -1045,7 +1045,7 @@ class ServerAsyncReaderWriter final
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
// TODO(ctiller): don't assert
CHECK(write_ops_.SendMessage(msg).ok());
ABSL_CHECK(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_);
}
@ -1055,7 +1055,7 @@ class ServerAsyncReaderWriter final
options.set_buffer_hint();
}
EnsureInitialMetadataSent(&write_ops_);
CHECK(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
call_.PerformOps(&write_ops_);
}
@ -1075,7 +1075,7 @@ class ServerAsyncReaderWriter final
write_ops_.set_output_tag(tag);
EnsureInitialMetadataSent(&write_ops_);
options.set_buffer_hint();
CHECK(write_ops_.SendMessage(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessage(msg, options).ok());
write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status);
call_.PerformOps(&write_ops_);
}

View File

@ -19,7 +19,7 @@
#ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
#define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/support/log.h>
@ -132,7 +132,7 @@ class ClientAsyncResponseReaderHelper {
new (grpc_call_arena_alloc(call, sizeof(SingleBufType))) SingleBufType;
*single_buf_ptr = single_buf;
// TODO(ctiller): don't assert
CHECK(single_buf->SendMessage(request).ok());
ABSL_CHECK(single_buf->SendMessage(request).ok());
single_buf->ClientSendClose();
// The purpose of the following functions is to type-erase the actual
@ -222,7 +222,7 @@ class ClientAsyncResponseReader final
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientAsyncResponseReader));
ABSL_CHECK_EQ(size, sizeof(ClientAsyncResponseReader));
}
// This operator should never be called as the memory should be freed as part
@ -230,10 +230,10 @@ class ClientAsyncResponseReader final
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() override {
DCHECK(!started_);
ABSL_DCHECK(!started_);
started_ = true;
internal::ClientAsyncResponseReaderHelper::StartCall(context_, single_buf_);
}
@ -245,8 +245,8 @@ class ClientAsyncResponseReader final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void ReadInitialMetadata(void* tag) override {
DCHECK(started_);
DCHECK(!context_->initial_metadata_received_);
ABSL_DCHECK(started_);
ABSL_DCHECK(!context_->initial_metadata_received_);
read_initial_metadata_(context_, &call_, single_buf_, tag);
initial_metadata_read_ = true;
}
@ -257,7 +257,7 @@ class ClientAsyncResponseReader final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void Finish(R* msg, grpc::Status* status, void* tag) override {
DCHECK(started_);
ABSL_DCHECK(started_);
finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_,
static_cast<void*>(msg), status, tag);
}
@ -306,7 +306,7 @@ class ServerAsyncResponseWriter final
///
/// \param[in] tag Tag identifying this request.
void SendInitialMetadata(void* tag) override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
meta_buf_.set_output_tag(tag);
meta_buf_.SendInitialMetadata(&ctx_->initial_metadata_,
@ -375,7 +375,7 @@ class ServerAsyncResponseWriter final
/// deallocate them once the Finish operation is complete (i.e. a result
/// arrives in the completion queue).
void FinishWithError(const grpc::Status& status, void* tag) {
CHECK(!status.ok());
ABSL_CHECK(!status.ok());
finish_buf_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_,

View File

@ -21,7 +21,7 @@
#include <functional>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/grpc_types.h>
@ -73,7 +73,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(CallbackWithStatusTag));
ABSL_CHECK_EQ(size, sizeof(CallbackWithStatusTag));
}
// This operator should never be called as the memory should be freed as part
@ -81,7 +81,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
CallbackWithStatusTag(grpc_call* call, std::function<void(Status)> f,
CompletionQueueTag* ops)
@ -120,7 +120,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor {
// The tag was swallowed
return;
}
CHECK(ignored == ops_);
ABSL_CHECK(ignored == ops_);
// Last use of func_ or status_, so ok to move them out
auto func = std::move(func_);
@ -139,7 +139,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(CallbackWithSuccessTag));
ABSL_CHECK_EQ(size, sizeof(CallbackWithSuccessTag));
}
// This operator should never be called as the memory should be freed as part
@ -147,7 +147,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
CallbackWithSuccessTag() : call_(nullptr) {}
@ -164,7 +164,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
// callbacks.
void Set(grpc_call* call, std::function<void(bool)> f,
CompletionQueueTag* ops, bool can_inline) {
CHECK_EQ(call_, nullptr);
ABSL_CHECK_EQ(call_, nullptr);
grpc_call_ref(call);
call_ = call;
func_ = std::move(f);
@ -210,7 +210,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor {
#endif
bool do_callback = ops_->FinalizeResult(&ignored, &ok);
#ifndef NDEBUG
DCHECK(ignored == ops);
ABSL_DCHECK(ignored == ops);
#endif
if (do_callback) {

View File

@ -22,7 +22,7 @@
#include <atomic>
#include <functional>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/grpc.h>
#include <grpc/impl/call.h>
@ -72,7 +72,7 @@ class CallbackUnaryCallImpl {
const InputMessage* request, OutputMessage* result,
std::function<void(grpc::Status)> on_completion) {
grpc::CompletionQueue* cq = channel->CallbackCQ();
CHECK_NE(cq, nullptr);
ABSL_CHECK_NE(cq, nullptr);
grpc::internal::Call call(channel->CreateCall(method, context, cq));
using FullCallOpSet = grpc::internal::CallOpSet<
@ -306,7 +306,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// The argument to AddMultipleHolds must be positive.
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) {
DCHECK_GT(holds, 0);
ABSL_DCHECK_GT(holds, 0);
stream_->AddHold(holds);
}
void RemoveHold() { stream_->RemoveHold(); }
@ -370,7 +370,7 @@ class ClientReadReactor : public internal::ClientReactor {
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) {
DCHECK_GT(holds, 0);
ABSL_DCHECK_GT(holds, 0);
reader_->AddHold(holds);
}
void RemoveHold() { reader_->RemoveHold(); }
@ -402,7 +402,7 @@ class ClientWriteReactor : public internal::ClientReactor {
void AddHold() { AddMultipleHolds(1); }
void AddMultipleHolds(int holds) {
DCHECK_GT(holds, 0);
ABSL_DCHECK_GT(holds, 0);
writer_->AddHold(holds);
}
void RemoveHold() { writer_->RemoveHold(); }
@ -463,7 +463,7 @@ class ClientCallbackReaderWriterImpl
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl));
}
// This operator should never be called as the memory should be freed as part
@ -471,7 +471,7 @@ class ClientCallbackReaderWriterImpl
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override {
// This call initiates two batches, plus any backlog, each with a callback
@ -529,7 +529,7 @@ class ClientCallbackReaderWriterImpl
write_ops_.ClientSendClose();
}
// TODO(vjpai): don't assert
CHECK(write_ops_.SendMessagePtr(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok());
callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed);
if (GPR_UNLIKELY(corked_write_needed_)) {
write_ops_.SendInitialMetadata(&context_->send_initial_metadata_,
@ -721,7 +721,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientCallbackReaderImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderImpl));
}
// This operator should never be called as the memory should be freed as part
@ -729,7 +729,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() override {
// This call initiates two batches, plus any backlog, each with a callback
@ -806,7 +806,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
: context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor);
// TODO(vjpai): don't assert
CHECK(start_ops_.SendMessagePtr(request).ok());
ABSL_CHECK(start_ops_.SendMessagePtr(request).ok());
start_ops_.ClientSendClose();
}
@ -882,7 +882,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientCallbackWriterImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackWriterImpl));
}
// This operator should never be called as the memory should be freed as part
@ -890,7 +890,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override {
// This call initiates two batches, plus any backlog, each with a callback
@ -931,7 +931,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
write_ops_.ClientSendClose();
}
// TODO(vjpai): don't assert
CHECK(write_ops_.SendMessagePtr(msg, options).ok());
ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok());
callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed);
if (GPR_UNLIKELY(corked_write_needed_)) {
@ -1112,7 +1112,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
public:
// always allocated against a call arena, no memory free required
static void operator delete(void* /*ptr*/, std::size_t size) {
CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl));
ABSL_CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl));
}
// This operator should never be called as the memory should be freed as part
@ -1120,7 +1120,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
// delete to the operator new so that some compilers will not complain (see
// https://github.com/grpc/grpc/issues/11301) Note at the time of adding this
// there are no tests catching the compiler warning.
static void operator delete(void*, void*) { CHECK(false); }
static void operator delete(void*, void*) { ABSL_CHECK(false); }
void StartCall() override {
// This call initiates two batches, each with a callback
@ -1159,7 +1159,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
: context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor);
// TODO(vjpai): don't assert
CHECK(start_ops_.SendMessagePtr(request).ok());
ABSL_CHECK(start_ops_.SendMessagePtr(request).ok());
start_ops_.ClientSendClose();
finish_ops_.RecvMessage(response);
finish_ops_.AllowNoMessage();

View File

@ -22,7 +22,7 @@
#include <memory>
#include <vector>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_method.h>
@ -141,7 +141,7 @@ class ClientRpcInfo {
// Runs interceptor at pos \a pos.
void RunInterceptor(
experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) {
CHECK_LT(pos, interceptors_.size());
ABSL_CHECK_LT(pos, interceptors_.size());
interceptors_[pos]->Intercept(interceptor_methods);
}

View File

@ -19,7 +19,7 @@
#ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H
#define GRPCPP_SUPPORT_METHOD_HANDLER_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/log.h>
@ -59,7 +59,7 @@ template <class Callable>
template <class ResponseType>
void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param,
ResponseType* rsp, grpc::Status& status) {
CHECK(!param.server_context->sent_initial_metadata_);
ABSL_CHECK(!param.server_context->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata,
grpc::internal::CallOpSendMessage,
grpc::internal::CallOpServerSendStatus>

View File

@ -21,7 +21,7 @@
#include <type_traits>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include "absl/strings/cord.h"
#include <grpc/byte_buffer.h>
@ -76,7 +76,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
if (backup_count_ > 0) {
*data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) -
backup_count_;
CHECK_LE(backup_count_, INT_MAX);
ABSL_CHECK_LE(backup_count_, INT_MAX);
*size = static_cast<int>(backup_count_);
backup_count_ = 0;
return true;
@ -87,7 +87,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
}
*data = GRPC_SLICE_START_PTR(*slice_);
// On win x64, int is only 32bit
CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast<size_t>(INT_MAX));
ABSL_CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast<size_t>(INT_MAX));
byte_count_ += * size = static_cast<int>(GRPC_SLICE_LENGTH(*slice_));
return true;
}
@ -99,7 +99,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
/// bytes that have already been returned by the last call of Next.
/// So do the backup and have that ready for a later Next.
void BackUp(int count) override {
CHECK_LE(count, static_cast<int>(GRPC_SLICE_LENGTH(*slice_)));
ABSL_CHECK_LE(count, static_cast<int>(GRPC_SLICE_LENGTH(*slice_)));
backup_count_ = count;
}
@ -175,7 +175,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream {
return true;
}
}
CHECK_EQ(count, 0);
ABSL_CHECK_EQ(count, 0);
return true;
}
#endif // GRPC_PROTOBUF_CORD_SUPPORT_ENABLED

View File

@ -21,7 +21,7 @@
#include <type_traits>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include "absl/strings/cord.h"
#include <grpc/byte_buffer.h>
@ -65,7 +65,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
total_size_(total_size),
byte_count_(0),
have_backup_(false) {
CHECK(!byte_buffer->Valid());
ABSL_CHECK(!byte_buffer->Valid());
/// Create an empty raw byte buffer and look at its underlying slice buffer
grpc_byte_buffer* bp = grpc_raw_byte_buffer_create(nullptr, 0);
byte_buffer->set_buffer(bp);
@ -82,7 +82,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
/// safe for the caller to write from data[0, size - 1].
bool Next(void** data, int* size) override {
// Protobuf should not ask for more memory than total_size_.
CHECK_LT(byte_count_, total_size_);
ABSL_CHECK_LT(byte_count_, total_size_);
// 1. Use the remaining backup slice if we have one
// 2. Otherwise allocate a slice, up to the remaining length needed
// or our maximum allocation size
@ -107,7 +107,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
}
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast<size_t>(INT_MAX));
ABSL_CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast<size_t>(INT_MAX));
byte_count_ += * size = static_cast<int>(GRPC_SLICE_LENGTH(slice_));
// Using grpc_slice_buffer_add could modify slice_ and merge it with the
// previous slice. Therefore, use grpc_slice_buffer_add_indexed method to
@ -132,7 +132,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream {
/// 2. Split it into the needed (if any) and unneeded part
/// 3. Add the needed part back to the slice buffer
/// 4. Mark that we still have the remaining part (for later use/unref)
CHECK_LE(count, static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
ABSL_CHECK_LE(count, static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
grpc_slice_buffer_pop(slice_buffer_);
if (static_cast<size_t>(count) == GRPC_SLICE_LENGTH(slice_)) {
backup_slice_ = slice_;

View File

@ -22,7 +22,7 @@
#include <atomic>
#include <vector>
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/support/log.h>
#include <grpcpp/impl/rpc_method.h>
@ -102,7 +102,7 @@ class ServerRpcInfo {
// Runs interceptor at pos \a pos.
void RunInterceptor(
experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) {
CHECK_LT(pos, interceptors_.size());
ABSL_CHECK_LT(pos, interceptors_.size());
interceptors_[pos]->Intercept(interceptor_methods);
}

View File

@ -19,7 +19,7 @@
#ifndef GRPCPP_SUPPORT_SYNC_STREAM_H
#define GRPCPP_SUPPORT_SYNC_STREAM_H
#include "absl/log/check.h"
#include "absl/log/absl_check.h"
#include <grpc/support/log.h>
#include <grpcpp/client_context.h>
@ -186,7 +186,7 @@ class ClientReader final : public ClientReaderInterface<R> {
/// the server will be accessible through the \a ClientContext used to
/// construct this object.
void WaitForInitialMetadata() override {
CHECK(!context_->initial_metadata_received_);
ABSL_CHECK(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<grpc::internal::CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@ -232,7 +232,7 @@ class ClientReader final : public ClientReaderInterface<R> {
grpc::Status status;
ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops);
CHECK(cq_.Pluck(&ops));
ABSL_CHECK(cq_.Pluck(&ops));
return status;
}
@ -261,7 +261,7 @@ class ClientReader final : public ClientReaderInterface<R> {
ops.SendInitialMetadata(&context->send_initial_metadata_,
context->initial_metadata_flags());
// TODO(ctiller): don't assert
CHECK(ops.SendMessagePtr(&request).ok());
ABSL_CHECK(ops.SendMessagePtr(&request).ok());
ops.ClientSendClose();
call_.PerformOps(&ops);
cq_.Pluck(&ops);
@ -308,7 +308,7 @@ class ClientWriter : public ClientWriterInterface<W> {
/// Once complete, the initial metadata read from the server will be
/// accessible through the \a ClientContext used to construct this object.
void WaitForInitialMetadata() {
CHECK(!context_->initial_metadata_received_);
ABSL_CHECK(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<grpc::internal::CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@ -366,7 +366,7 @@ class ClientWriter : public ClientWriterInterface<W> {
}
finish_ops_.ClientRecvStatus(context_, &status);
call_.PerformOps(&finish_ops_);
CHECK(cq_.Pluck(&finish_ops_));
ABSL_CHECK(cq_.Pluck(&finish_ops_));
return status;
}
@ -457,7 +457,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
/// Once complete, the initial metadata read from the server will be
/// accessible through the \a ClientContext used to construct this object.
void WaitForInitialMetadata() override {
CHECK(!context_->initial_metadata_received_);
ABSL_CHECK(!context_->initial_metadata_received_);
grpc::internal::CallOpSet<grpc::internal::CallOpRecvInitialMetadata> ops;
ops.RecvInitialMetadata(context_);
@ -538,7 +538,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
grpc::Status status;
ops.ClientRecvStatus(context_, &status);
call_.PerformOps(&ops);
CHECK(cq_.Pluck(&ops));
ABSL_CHECK(cq_.Pluck(&ops));
return status;
}
@ -585,7 +585,7 @@ class ServerReader final : public ServerReaderInterface<R> {
/// for semantics. Note that initial metadata will be affected by the
/// \a ServerContext associated with this call.
void SendInitialMetadata() override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_,
@ -642,7 +642,7 @@ class ServerWriter final : public ServerWriterInterface<W> {
/// Note that initial metadata will be affected by the
/// \a ServerContext associated with this call.
void SendInitialMetadata() override {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_,
@ -715,7 +715,7 @@ class ServerReaderWriterBody final {
: call_(call), ctx_(ctx) {}
void SendInitialMetadata() {
CHECK(!ctx_->sent_initial_metadata_);
ABSL_CHECK(!ctx_->sent_initial_metadata_);
grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata> ops;
ops.SendInitialMetadata(&ctx_->initial_metadata_,

View File

@ -20,8 +20,8 @@
#define GRPC_CPP_VERSION_MAJOR 1
#define GRPC_CPP_VERSION_MINOR 64
#define GRPC_CPP_VERSION_PATCH 0
#define GRPC_CPP_VERSION_TAG "dev"
#define GRPC_CPP_VERSION_STRING "1.64.0-dev"
#define GRPC_CPP_VERSION_PATCH 2
#define GRPC_CPP_VERSION_TAG ""
#define GRPC_CPP_VERSION_STRING "1.64.2"
#endif // GRPCPP_VERSION_INFO_H

10
package.xml generated
View File

@ -13,16 +13,16 @@
<date>2019-09-24</date>
<time>16:06:07</time>
<version>
<release>1.64.0dev</release>
<api>1.64.0dev</api>
<release>1.64.2</release>
<api>1.64.2</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
<release>stable</release>
<api>stable</api>
</stability>
<license>Apache 2.0</license>
<notes>
- gRPC Core 1.64.0 update
- gRPC Core 1.64.2 update
</notes>
<contents>
<dir baseinstalldir="/" name="/">

View File

@ -85,7 +85,7 @@ class ChaoticGoodClientTransport final : public ClientTransport {
grpc_endpoint* GetEndpoint() override { return nullptr; }
void Orphan() override {
AbortWithError();
Unref();
delete this;
}
void StartCall(CallHandler call_handler) override;

View File

@ -96,7 +96,7 @@ class ChaoticGoodServerTransport final : public ServerTransport {
void SetPollsetSet(grpc_stream*, grpc_pollset_set*) override {}
void PerformOp(grpc_transport_op*) override;
grpc_endpoint* GetEndpoint() override { return nullptr; }
void Orphan() override { Unref(); }
void Orphan() override { delete this; }
void SetAcceptor(Acceptor* acceptor) override;
void AbortWithError();

View File

@ -143,6 +143,8 @@ static bool g_default_server_keepalive_permit_without_calls = false;
#define MAX_CLIENT_STREAM_ID 0x7fffffffu
grpc_core::TraceFlag grpc_keepalive_trace(false, "http_keepalive");
grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false,
"chttp2_refcount");
// forward declarations of various callbacks that we'll build closures around
static void write_action_begin_locked(
@ -593,7 +595,12 @@ static void init_keepalive_pings_if_enabled_locked(
grpc_chttp2_transport::grpc_chttp2_transport(
const grpc_core::ChannelArgs& channel_args, grpc_endpoint* ep,
bool is_client)
: ep(ep),
: grpc_core::RefCounted<grpc_chttp2_transport,
grpc_core::NonPolymorphicRefCount>(
GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_refcount)
? "chttp2_refcount"
: nullptr),
ep(ep),
peer_string(
grpc_core::Slice::FromCopiedString(grpc_endpoint_get_peer(ep))),
memory_owner(channel_args.GetObject<grpc_core::ResourceQuota>()

View File

@ -223,19 +223,17 @@ typedef enum {
GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED,
} grpc_chttp2_keepalive_state;
struct grpc_chttp2_transport final : public grpc_core::FilterStackTransport,
public grpc_core::KeepsGrpcInitialized {
struct grpc_chttp2_transport final
: public grpc_core::FilterStackTransport,
public grpc_core::RefCounted<grpc_chttp2_transport,
grpc_core::NonPolymorphicRefCount>,
public grpc_core::KeepsGrpcInitialized {
grpc_chttp2_transport(const grpc_core::ChannelArgs& channel_args,
grpc_endpoint* ep, bool is_client);
~grpc_chttp2_transport() override;
void Orphan() override;
grpc_core::RefCountedPtr<grpc_chttp2_transport> Ref() {
return grpc_core::FilterStackTransport::RefAsSubclass<
grpc_chttp2_transport>();
}
size_t SizeOfStream() const override;
bool HackyDisableStreamOpBatchCoalescingInConnectedChannel() const override;
void PerformStreamOp(grpc_stream* gs,

View File

@ -35,9 +35,8 @@
namespace grpc_core {
namespace {
class InprocClientTransport;
class InprocServerTransport final : public ServerTransport {
class InprocServerTransport final : public RefCounted<InprocServerTransport>,
public ServerTransport {
public:
void SetAcceptor(Acceptor* acceptor) override {
acceptor_ = acceptor;
@ -98,8 +97,6 @@ class InprocServerTransport final : public ServerTransport {
return acceptor_->CreateCall(std::move(md), acceptor_->CreateArena());
}
OrphanablePtr<InprocClientTransport> MakeClientTransport();
private:
enum class ConnectionState : uint8_t { kInitial, kReady, kDisconnected };
@ -114,10 +111,6 @@ class InprocServerTransport final : public ServerTransport {
class InprocClientTransport final : public ClientTransport {
public:
explicit InprocClientTransport(
RefCountedPtr<InprocServerTransport> server_transport)
: server_transport_(std::move(server_transport)) {}
void StartCall(CallHandler call_handler) override {
call_handler.SpawnGuarded(
"pull_initial_metadata",
@ -134,6 +127,10 @@ class InprocClientTransport final : public ClientTransport {
void Orphan() override { delete this; }
OrphanablePtr<Transport> GetServerTransport() {
return OrphanablePtr<Transport>(server_transport_->Ref().release());
}
FilterStackTransport* filter_stack_transport() override { return nullptr; }
ClientTransport* client_transport() override { return this; }
ServerTransport* server_transport() override { return nullptr; }
@ -149,7 +146,8 @@ class InprocClientTransport final : public ClientTransport {
absl::UnavailableError("Client transport closed"));
}
const RefCountedPtr<InprocServerTransport> server_transport_;
RefCountedPtr<InprocServerTransport> server_transport_ =
MakeRefCounted<InprocServerTransport>();
};
bool UsePromiseBasedTransport() {
@ -159,12 +157,6 @@ bool UsePromiseBasedTransport() {
return true;
}
OrphanablePtr<InprocClientTransport>
InprocServerTransport::MakeClientTransport() {
return MakeOrphanable<InprocClientTransport>(
RefAsSubclass<InprocServerTransport>());
}
OrphanablePtr<Channel> MakeLameChannel(absl::string_view why,
absl::Status error) {
gpr_log(GPR_ERROR, "%s: %s", std::string(why).c_str(),
@ -206,8 +198,8 @@ OrphanablePtr<Channel> MakeInprocChannel(Server* server,
std::pair<OrphanablePtr<Transport>, OrphanablePtr<Transport>>
MakeInProcessTransportPair() {
auto server_transport = MakeOrphanable<InprocServerTransport>();
auto client_transport = server_transport->MakeClientTransport();
auto client_transport = MakeOrphanable<InprocClientTransport>();
auto server_transport = client_transport->GetServerTransport();
return std::make_pair(std::move(client_transport),
std::move(server_transport));
}

View File

@ -95,7 +95,7 @@ ConfigVars::ConfigVars(const Overrides& overrides)
FLAGS_grpc_not_use_system_ssl_roots, "GRPC_NOT_USE_SYSTEM_SSL_ROOTS",
overrides.not_use_system_ssl_roots, false)),
absl_logging_(LoadConfig(FLAGS_grpc_absl_logging, "GRPC_ABSL_LOGGING",
overrides.absl_logging, true)),
overrides.absl_logging, false)),
dns_resolver_(LoadConfig(FLAGS_grpc_dns_resolver, "GRPC_DNS_RESOLVER",
overrides.dns_resolver, "")),
verbosity_(LoadConfig(FLAGS_grpc_verbosity, "GRPC_VERBOSITY",

View File

@ -128,6 +128,6 @@
ECDHE-RSA-AES256-GCM-SHA384"
- name: absl_logging
type: bool
default: true
default: false
description:
Use absl logging from within gpr_log.

View File

@ -65,7 +65,7 @@
expiry: 2024/09/09
owner: ctiller@google.com
requires: [promise_based_client_call, promise_based_server_call]
test_tags: [core_end2end_test]
test_tags: []
- name: client_privacy
description:
If set, client privacy

View File

@ -71,7 +71,13 @@ class PromiseLike<void>;
template <typename F>
class PromiseLike<F, absl::enable_if_t<!std::is_void<
typename std::result_of<F()>::type>::value>> {
#if (defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703L) || \
(defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
std::invoke_result_t<F>
#else
typename std::result_of<F()>::type
#endif
>::value>> {
private:
GPR_NO_UNIQUE_ADDRESS F f_;

View File

@ -3732,8 +3732,7 @@ class MaybeOpImpl {
MaybeOpImpl(const MaybeOpImpl&) = delete;
MaybeOpImpl& operator=(const MaybeOpImpl&) = delete;
MaybeOpImpl(MaybeOpImpl&& other) noexcept
: state_(MoveState(other.state_)), op_(other.op_) {}
MaybeOpImpl(MaybeOpImpl&& /*other*/) noexcept { Crash("not implemented"); }
MaybeOpImpl& operator=(MaybeOpImpl&& other) noexcept {
op_ = other.op_;
if (absl::holds_alternative<Dismissed>(state_)) {

View File

@ -93,13 +93,13 @@ absl::StatusOr<OrphanablePtr<Channel>> LegacyChannel::Create(
*(*r)->stats_plugin_group =
GlobalStatsPluginRegistry::GetStatsPluginsForServer(args);
} else {
experimental::StatsPluginChannelScope scope(
target, args.GetOwnedString(GRPC_ARG_DEFAULT_AUTHORITY)
.value_or(CoreConfiguration::Get()
.resolver_registry()
.GetDefaultAuthority(target)));
std::string authority = args.GetOwnedString(GRPC_ARG_DEFAULT_AUTHORITY)
.value_or(CoreConfiguration::Get()
.resolver_registry()
.GetDefaultAuthority(target));
*(*r)->stats_plugin_group =
GlobalStatsPluginRegistry::GetStatsPluginsForChannel(scope);
GlobalStatsPluginRegistry::GetStatsPluginsForChannel(
experimental::StatsPluginChannelScope(target, authority));
}
return MakeOrphanable<LegacyChannel>(
grpc_channel_stack_type_is_client(builder.channel_stack_type()),

View File

@ -502,7 +502,7 @@ class FilterStackTransport;
class ClientTransport;
class ServerTransport;
class Transport : public InternallyRefCounted<Transport> {
class Transport : public Orphanable {
public:
struct RawPointerChannelArgTag {};
static absl::string_view ChannelArgName() { return GRPC_ARG_TRANSPORT; }

View File

@ -105,23 +105,25 @@ XdsClusterLocalityStats::XdsClusterLocalityStats(
eds_service_name_(eds_service_name),
name_(std::move(name)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO,
"[xds_client %p] created locality stats %p for {%s, %s, %s, %s}",
xds_client_.get(), this, std::string(lrs_server_).c_str(),
std::string(cluster_name_).c_str(),
std::string(eds_service_name_).c_str(),
name_->human_readable_string().c_str());
gpr_log(
GPR_INFO,
"[xds_client %p] created locality stats %p for {%s, %s, %s, %s}",
xds_client_.get(), this, std::string(lrs_server_).c_str(),
std::string(cluster_name_).c_str(),
std::string(eds_service_name_).c_str(),
name_ == nullptr ? "<none>" : name_->human_readable_string().c_str());
}
}
XdsClusterLocalityStats::~XdsClusterLocalityStats() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO,
"[xds_client %p] destroying locality stats %p for {%s, %s, %s, %s}",
xds_client_.get(), this, std::string(lrs_server_).c_str(),
std::string(cluster_name_).c_str(),
std::string(eds_service_name_).c_str(),
name_->human_readable_string().c_str());
gpr_log(
GPR_INFO,
"[xds_client %p] destroying locality stats %p for {%s, %s, %s, %s}",
xds_client_.get(), this, std::string(lrs_server_).c_str(),
std::string(cluster_name_).c_str(),
std::string(eds_service_name_).c_str(),
name_ == nullptr ? "<none>" : name_->human_readable_string().c_str());
}
xds_client_->RemoveClusterLocalityStats(lrs_server_, cluster_name_,
eds_service_name_, name_, this);

View File

@ -1,7 +1,7 @@
<!-- This file is generated -->
<Project>
<PropertyGroup>
<GrpcCsharpVersion>2.64.0-dev</GrpcCsharpVersion>
<GrpcCsharpVersion>2.64.2</GrpcCsharpVersion>
<GoogleProtobufVersion>3.26.1</GoogleProtobufVersion>
</PropertyGroup>
</Project>

View File

@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them.
s.name = '!ProtoCompiler-gRPCCppPlugin'
v = '1.64.0-dev'
v = '1.64.2'
s.version = v
s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.'
s.description = <<-DESC

View File

@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them.
s.name = '!ProtoCompiler-gRPCPlugin'
v = '1.64.0-dev'
v = '1.64.2'
s.version = v
s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
s.description = <<-DESC

View File

@ -22,4 +22,4 @@
// instead. This file can be regenerated from the template by running
// `tools/buildgen/generate_projects.sh`.
#define GRPC_OBJC_VERSION_STRING @"1.64.0-dev"
#define GRPC_OBJC_VERSION_STRING @"1.64.2"

View File

@ -22,5 +22,5 @@
// instead. This file can be regenerated from the template by running
// `tools/buildgen/generate_projects.sh`.
#define GRPC_OBJC_VERSION_STRING @"1.64.0-dev"
#define GRPC_OBJC_VERSION_STRING @"1.64.2"
#define GRPC_C_VERSION_STRING @"41.0.0"

View File

@ -2,7 +2,7 @@
"name": "grpc/grpc-dev",
"description": "gRPC library for PHP - for Development use only",
"license": "Apache-2.0",
"version": "1.64.0",
"version": "1.64.2",
"require": {
"php": ">=7.0.0",
"google/protobuf": "^v3.3.0"

View File

@ -20,6 +20,6 @@
#ifndef VERSION_H
#define VERSION_H
#define PHP_GRPC_VERSION "1.64.0dev"
#define PHP_GRPC_VERSION "1.64.2"
#endif /* VERSION_H */

View File

@ -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):

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!!
__version__ = """1.64.0.dev0"""
__version__ = """1.64.2"""

View File

@ -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

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_admin/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_channelz/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_csds/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_observability/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_status/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,5 +14,5 @@
# GRPC contains the General RPC module.
module GRPC
VERSION = '1.64.0.dev'
VERSION = '1.64.2'
end

View File

@ -14,6 +14,6 @@
module GRPC
module NativeDebug
VERSION = '1.64.0.dev'
VERSION = '1.64.2'
end
end

View File

@ -14,6 +14,6 @@
module GRPC
module Tools
VERSION = '1.64.0.dev'
VERSION = '1.64.2'
end
end

View File

@ -119,7 +119,10 @@
if lib_name == 'protobuf':
# TODO(jtattermusch): add better way of excluding explicit protobuf dependency.
continue
requires.add(lib_name)
if lib_name == 'opentelemetry-cpp::api':
requires.add('opentelemetry_api')
else:
requires.add(lib_name)
return list(sorted(requires))
def get_pkgconfig_requires_private(lib):
@ -1142,3 +1145,14 @@
"${" ".join(get_pkgconfig_libs("grpc++_unsecure"))}"
"${" ".join(get_pkgconfig_libs_private("grpc++_unsecure"))}"
"grpc++_unsecure.pc")
# grpcpp_otel_plugin .pc file
generate_pkgconfig(
"gRPC++ OpenTelemetry Plugin"
"OpenTelemetry Plugin for gRPC C++"
"<%text>${gRPC_CPP_VERSION}</%text>"
"${" ".join(get_pkgconfig_requires("grpcpp_otel_plugin"))}"
"${" ".join(get_pkgconfig_requires_private("grpcpp_otel_plugin"))}"
"${" ".join(get_pkgconfig_libs("grpcpp_otel_plugin"))}"
"${" ".join(get_pkgconfig_libs_private("grpcpp_otel_plugin"))}"
"grpcpp_otel_plugin.pc")

View File

@ -471,6 +471,28 @@ TEST_F(OpenTelemetryPluginEnd2EndTest, NoMeterProviderRegistered) {
SendRPC();
}
// Test that the otel plugin sees the expected channel target and default
// authority.
TEST_F(OpenTelemetryPluginEnd2EndTest, VerifyChannelScopeTargetAndAuthority) {
Init(std::move(
Options()
.set_metric_names({grpc::OpenTelemetryPluginBuilder::
kClientAttemptStartedInstrumentName})
.set_channel_scope_filter(
[&](const OpenTelemetryPluginBuilder::ChannelScope& scope) {
return scope.target() == canonical_server_address_ &&
scope.default_authority() == server_address_;
})));
SendRPC();
const char* kMetricName = "grpc.client.attempt.started";
auto data = ReadCurrentMetricsData(
[&](const absl::flat_hash_map<
std::string,
std::vector<opentelemetry::sdk::metrics::PointDataAttributes>>&
data) { return !data.contains(kMetricName); });
ASSERT_EQ(data[kMetricName].size(), 1);
}
// Test that a channel scope filter returning true records metrics on the
// channel.
TEST_F(OpenTelemetryPluginEnd2EndTest, ChannelScopeFilterReturnsTrue) {

View File

@ -353,6 +353,7 @@ grpc_cc_test(
],
args = grpc_benchmark_args(),
tags = [
"manual", # See https://github.com/grpc/grpc/pull/36839
"no_mac", # to emulate "excluded_poll_engines: poll"
"no_windows",
],

View File

@ -65,6 +65,13 @@ cmake -DCMAKE_BUILD_TYPE=Release ../..
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}" install
popd
# Install OpenTelemetry
mkdir -p "third_party/opentelemetry-cpp/cmake/build"
pushd "third_party/opentelemetry-cpp/cmake/build"
cmake -DCMAKE_BUILD_TYPE=Release -DWITH_ABSEIL=ON -DBUILD_TESTING=OFF -DWITH_BENCHMARK=OFF ../..
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}" install
popd
# Just before installing gRPC, wipe out contents of all the submodules to simulate
# a standalone build from an archive.
# Get list of submodules from the .gitmodules file since for "git submodule foreach"
@ -88,6 +95,7 @@ cmake \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON \
../..
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}" install
popd
@ -111,3 +119,8 @@ popd
pushd examples/cpp/route_guide
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}"
popd
# Build otel example using Makefile and pkg-config
pushd examples/cpp/otel/ostream
make "-j${GRPC_CPP_DISTRIBTEST_BUILD_COMPILER_JOBS}"
popd

View File

@ -14,5 +14,5 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'
PROTOBUF_VERSION = '3.26.1'

View File

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_tools/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'

View File

@ -14,5 +14,5 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'
PROTOBUF_VERSION = '3.26.1'

View File

@ -14,5 +14,5 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!!
VERSION = '1.64.0.dev0'
VERSION = '1.64.2'
PROTOBUF_VERSION = '3.26.1'

View File

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.64.0-dev
PROJECT_NUMBER = 1.64.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.64.0-dev
PROJECT_NUMBER = 1.64.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Objective-C"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.64.0-dev
PROJECT_NUMBER = 1.64.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Objective-C"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.64.0-dev
PROJECT_NUMBER = 1.64.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC PHP"
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 1.64.0-dev
PROJECT_NUMBER = 1.64.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a