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

pull/35804/head
Mark D. Roth 1 year ago
commit 3ed0916bc3
  1. 2
      BUILD
  2. 3
      CMakeLists.txt
  3. 2
      Makefile
  4. 2
      Package.swift
  5. 2
      bazel/experiments.bzl
  6. 6
      build_autogenerated.yaml
  7. 1
      config.m4
  8. 1
      config.w32
  9. 2
      examples/cpp/csm/Dockerfile.client
  10. 24
      examples/cpp/csm/README.md
  11. 170
      examples/cpp/csm/csm_greeter_client.cc
  12. 2
      gRPC-C++.podspec
  13. 3
      gRPC-Core.podspec
  14. 2
      grpc.gemspec
  15. 3
      grpc.gyp
  16. 2
      package.xml
  17. 32
      src/core/BUILD
  18. 12
      src/core/lib/event_engine/forkable.cc
  19. 27
      src/core/lib/experiments/experiments.cc
  20. 16
      src/core/lib/experiments/experiments.h
  21. 11
      src/core/lib/experiments/experiments.yaml
  22. 4
      src/core/lib/experiments/rollouts.yaml
  23. 32
      src/core/lib/surface/channel.cc
  24. 10
      src/core/lib/surface/channel.h
  25. 35
      src/core/lib/transport/call_destination.h
  26. 41
      src/core/lib/transport/call_factory.cc
  27. 56
      src/core/lib/transport/call_factory.h
  28. 26
      src/core/load_balancing/grpclb/grpclb.cc
  29. 2
      src/core/load_balancing/outlier_detection/outlier_detection.cc
  30. 2
      src/core/load_balancing/pick_first/pick_first.cc
  31. 2
      src/core/load_balancing/priority/priority.cc
  32. 2
      src/core/load_balancing/ring_hash/ring_hash.cc
  33. 12
      src/core/load_balancing/rls/rls.cc
  34. 2
      src/core/load_balancing/round_robin/round_robin.cc
  35. 2
      src/core/load_balancing/subchannel_list.h
  36. 2
      src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc
  37. 2
      src/core/load_balancing/weighted_target/weighted_target.cc
  38. 2
      src/core/load_balancing/xds/cds.cc
  39. 6
      src/core/load_balancing/xds/xds_cluster_impl.cc
  40. 4
      src/core/load_balancing/xds/xds_cluster_manager.cc
  41. 4
      src/core/load_balancing/xds/xds_override_host.cc
  42. 4
      src/core/resolver/dns/c_ares/dns_resolver_ares.cc
  43. 10
      src/core/resolver/dns/event_engine/event_engine_client_channel_resolver.cc
  44. 4
      src/core/resolver/xds/xds_dependency_manager.cc
  45. 6
      src/core/resolver/xds/xds_resolver.cc
  46. 9
      src/cpp/ext/csm/csm_observability.cc
  47. 27
      src/cpp/ext/otel/key_value_iterable.h
  48. 24
      src/cpp/ext/otel/otel_client_filter.cc
  49. 8
      src/cpp/ext/otel/otel_plugin.cc
  50. 4
      src/cpp/ext/otel/otel_plugin.h
  51. 14
      src/cpp/ext/otel/otel_server_call_tracer.cc
  52. 1
      src/python/grpcio/grpc_core_dependencies.py
  53. 23
      templates/tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_0/Dockerfile.template
  54. 23
      templates/tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_1/Dockerfile.template
  55. 23
      templates/tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_2/Dockerfile.template
  56. 23
      templates/tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_3/Dockerfile.template
  57. 16
      templates/tools/dockerfile/ruby_3_0_deps.include
  58. 16
      templates/tools/dockerfile/ruby_3_1_deps.include
  59. 16
      templates/tools/dockerfile/ruby_3_2_deps.include
  60. 16
      templates/tools/dockerfile/ruby_3_3_deps.include
  61. 32
      test/cpp/ext/csm/metadata_exchange_test.cc
  62. 65
      test/cpp/ext/otel/otel_plugin_test.cc
  63. 1
      test/cpp/ext/otel/otel_test_library.cc
  64. 15
      test/cpp/ext/otel/otel_test_library.h
  65. 9
      third_party/utf8_range/.github/workflows/bazel_tests.yml
  66. 7
      third_party/utf8_range/BUILD.bazel
  67. 5
      third_party/utf8_range/CMakeLists.txt
  68. 11
      third_party/utf8_range/cmake/utf8_range.pc.cmake
  69. 2
      third_party/utf8_range/utf8_validity.cc
  70. 5
      tools/bazelify_tests/dockerimage_current_versions.bzl
  71. 27
      tools/buildgen/extract_metadata_from_bazel_xml.py
  72. 2
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_0.current_version
  73. 62
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_0/Dockerfile
  74. 1
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_1.current_version
  75. 84
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_1/Dockerfile
  76. 1
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_2.current_version
  77. 84
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_2/Dockerfile
  78. 1
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_3.current_version
  79. 84
      tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_3/Dockerfile
  80. 1
      tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh
  81. 2
      tools/doxygen/Doxyfile.c++.internal
  82. 2
      tools/doxygen/Doxyfile.core.internal
  83. 9
      tools/interop_matrix/client_matrix.py
  84. 9
      tools/run_tests/artifacts/distribtest_targets.py

@ -1531,9 +1531,9 @@ grpc_cc_library(
"//src/core:arena_promise", "//src/core:arena_promise",
"//src/core:atomic_utils", "//src/core:atomic_utils",
"//src/core:bitset", "//src/core:bitset",
"//src/core:call_factory",
"//src/core:call_filters", "//src/core:call_filters",
"//src/core:call_final_info", "//src/core:call_final_info",
"//src/core:call_size_estimator",
"//src/core:call_spine", "//src/core:call_spine",
"//src/core:cancel_callback", "//src/core:cancel_callback",
"//src/core:channel_args", "//src/core:channel_args",

3
CMakeLists.txt generated

@ -2479,6 +2479,7 @@ add_library(grpc
src/core/lib/surface/version.cc src/core/lib/surface/version.cc
src/core/lib/transport/batch_builder.cc src/core/lib/transport/batch_builder.cc
src/core/lib/transport/bdp_estimator.cc src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/call_factory.cc
src/core/lib/transport/call_filters.cc src/core/lib/transport/call_filters.cc
src/core/lib/transport/call_final_info.cc src/core/lib/transport/call_final_info.cc
src/core/lib/transport/call_size_estimator.cc src/core/lib/transport/call_size_estimator.cc
@ -3206,6 +3207,7 @@ add_library(grpc_unsecure
src/core/lib/surface/version.cc src/core/lib/surface/version.cc
src/core/lib/transport/batch_builder.cc src/core/lib/transport/batch_builder.cc
src/core/lib/transport/bdp_estimator.cc src/core/lib/transport/bdp_estimator.cc
src/core/lib/transport/call_factory.cc
src/core/lib/transport/call_filters.cc src/core/lib/transport/call_filters.cc
src/core/lib/transport/call_final_info.cc src/core/lib/transport/call_final_info.cc
src/core/lib/transport/call_size_estimator.cc src/core/lib/transport/call_size_estimator.cc
@ -5327,6 +5329,7 @@ add_library(grpc_authorization_provider
src/core/lib/surface/validate_metadata.cc src/core/lib/surface/validate_metadata.cc
src/core/lib/surface/version.cc src/core/lib/surface/version.cc
src/core/lib/transport/batch_builder.cc src/core/lib/transport/batch_builder.cc
src/core/lib/transport/call_factory.cc
src/core/lib/transport/call_filters.cc src/core/lib/transport/call_filters.cc
src/core/lib/transport/call_final_info.cc src/core/lib/transport/call_final_info.cc
src/core/lib/transport/call_size_estimator.cc src/core/lib/transport/call_size_estimator.cc

2
Makefile generated

@ -1661,6 +1661,7 @@ LIBGRPC_SRC = \
src/core/lib/surface/version.cc \ src/core/lib/surface/version.cc \
src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/batch_builder.cc \
src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/call_factory.cc \
src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.cc \
src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.cc \
src/core/lib/transport/call_size_estimator.cc \ src/core/lib/transport/call_size_estimator.cc \
@ -2222,6 +2223,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/version.cc \ src/core/lib/surface/version.cc \
src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/batch_builder.cc \
src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/call_factory.cc \
src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.cc \
src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.cc \
src/core/lib/transport/call_size_estimator.cc \ src/core/lib/transport/call_size_estimator.cc \

2
Package.swift generated

@ -1810,6 +1810,8 @@ let package = Package(
"src/core/lib/transport/batch_builder.h", "src/core/lib/transport/batch_builder.h",
"src/core/lib/transport/bdp_estimator.cc", "src/core/lib/transport/bdp_estimator.cc",
"src/core/lib/transport/bdp_estimator.h", "src/core/lib/transport/bdp_estimator.h",
"src/core/lib/transport/call_factory.cc",
"src/core/lib/transport/call_factory.h",
"src/core/lib/transport/call_filters.cc", "src/core/lib/transport/call_filters.cc",
"src/core/lib/transport/call_filters.h", "src/core/lib/transport/call_filters.h",
"src/core/lib/transport/call_final_info.cc", "src/core/lib/transport/call_final_info.cc",

@ -18,6 +18,7 @@
EXPERIMENT_ENABLES = { EXPERIMENT_ENABLES = {
"call_status_override_on_cancellation": "call_status_override_on_cancellation", "call_status_override_on_cancellation": "call_status_override_on_cancellation",
"call_v3": "call_v3",
"canary_client_privacy": "canary_client_privacy", "canary_client_privacy": "canary_client_privacy",
"client_idleness": "client_idleness", "client_idleness": "client_idleness",
"client_privacy": "client_privacy", "client_privacy": "client_privacy",
@ -37,7 +38,6 @@ EXPERIMENT_ENABLES = {
"promise_based_server_call": "promise_based_server_call", "promise_based_server_call": "promise_based_server_call",
"registered_method_lookup_in_transport": "registered_method_lookup_in_transport", "registered_method_lookup_in_transport": "registered_method_lookup_in_transport",
"promise_based_inproc_transport": "promise_based_client_call,promise_based_inproc_transport,promise_based_server_call,registered_method_lookup_in_transport", "promise_based_inproc_transport": "promise_based_client_call,promise_based_inproc_transport,promise_based_server_call,registered_method_lookup_in_transport",
"registered_methods_map": "registered_methods_map",
"rfc_max_concurrent_streams": "rfc_max_concurrent_streams", "rfc_max_concurrent_streams": "rfc_max_concurrent_streams",
"round_robin_delegate_to_pick_first": "round_robin_delegate_to_pick_first", "round_robin_delegate_to_pick_first": "round_robin_delegate_to_pick_first",
"rstpit": "rstpit", "rstpit": "rstpit",

@ -1135,6 +1135,7 @@ libs:
- src/core/lib/surface/wait_for_cq_end_op.h - src/core/lib/surface/wait_for_cq_end_op.h
- src/core/lib/transport/batch_builder.h - src/core/lib/transport/batch_builder.h
- src/core/lib/transport/bdp_estimator.h - src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/call_factory.h
- src/core/lib/transport/call_filters.h - src/core/lib/transport/call_filters.h
- src/core/lib/transport/call_final_info.h - src/core/lib/transport/call_final_info.h
- src/core/lib/transport/call_size_estimator.h - src/core/lib/transport/call_size_estimator.h
@ -1935,6 +1936,7 @@ libs:
- src/core/lib/surface/version.cc - src/core/lib/surface/version.cc
- src/core/lib/transport/batch_builder.cc - src/core/lib/transport/batch_builder.cc
- src/core/lib/transport/bdp_estimator.cc - src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/call_factory.cc
- src/core/lib/transport/call_filters.cc - src/core/lib/transport/call_filters.cc
- src/core/lib/transport/call_final_info.cc - src/core/lib/transport/call_final_info.cc
- src/core/lib/transport/call_size_estimator.cc - src/core/lib/transport/call_size_estimator.cc
@ -2594,6 +2596,7 @@ libs:
- src/core/lib/surface/wait_for_cq_end_op.h - src/core/lib/surface/wait_for_cq_end_op.h
- src/core/lib/transport/batch_builder.h - src/core/lib/transport/batch_builder.h
- src/core/lib/transport/bdp_estimator.h - src/core/lib/transport/bdp_estimator.h
- src/core/lib/transport/call_factory.h
- src/core/lib/transport/call_filters.h - src/core/lib/transport/call_filters.h
- src/core/lib/transport/call_final_info.h - src/core/lib/transport/call_final_info.h
- src/core/lib/transport/call_size_estimator.h - src/core/lib/transport/call_size_estimator.h
@ -3014,6 +3017,7 @@ libs:
- src/core/lib/surface/version.cc - src/core/lib/surface/version.cc
- src/core/lib/transport/batch_builder.cc - src/core/lib/transport/batch_builder.cc
- src/core/lib/transport/bdp_estimator.cc - src/core/lib/transport/bdp_estimator.cc
- src/core/lib/transport/call_factory.cc
- src/core/lib/transport/call_filters.cc - src/core/lib/transport/call_filters.cc
- src/core/lib/transport/call_final_info.cc - src/core/lib/transport/call_final_info.cc
- src/core/lib/transport/call_size_estimator.cc - src/core/lib/transport/call_size_estimator.cc
@ -4665,6 +4669,7 @@ libs:
- src/core/lib/surface/validate_metadata.h - src/core/lib/surface/validate_metadata.h
- src/core/lib/surface/wait_for_cq_end_op.h - src/core/lib/surface/wait_for_cq_end_op.h
- src/core/lib/transport/batch_builder.h - src/core/lib/transport/batch_builder.h
- src/core/lib/transport/call_factory.h
- src/core/lib/transport/call_filters.h - src/core/lib/transport/call_filters.h
- src/core/lib/transport/call_final_info.h - src/core/lib/transport/call_final_info.h
- src/core/lib/transport/call_size_estimator.h - src/core/lib/transport/call_size_estimator.h
@ -4968,6 +4973,7 @@ libs:
- src/core/lib/surface/validate_metadata.cc - src/core/lib/surface/validate_metadata.cc
- src/core/lib/surface/version.cc - src/core/lib/surface/version.cc
- src/core/lib/transport/batch_builder.cc - src/core/lib/transport/batch_builder.cc
- src/core/lib/transport/call_factory.cc
- src/core/lib/transport/call_filters.cc - src/core/lib/transport/call_filters.cc
- src/core/lib/transport/call_final_info.cc - src/core/lib/transport/call_final_info.cc
- src/core/lib/transport/call_size_estimator.cc - src/core/lib/transport/call_size_estimator.cc

1
config.m4 generated

@ -789,6 +789,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/surface/version.cc \ src/core/lib/surface/version.cc \
src/core/lib/transport/batch_builder.cc \ src/core/lib/transport/batch_builder.cc \
src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/call_factory.cc \
src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.cc \
src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.cc \
src/core/lib/transport/call_size_estimator.cc \ src/core/lib/transport/call_size_estimator.cc \

1
config.w32 generated

@ -754,6 +754,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\surface\\version.cc " + "src\\core\\lib\\surface\\version.cc " +
"src\\core\\lib\\transport\\batch_builder.cc " + "src\\core\\lib\\transport\\batch_builder.cc " +
"src\\core\\lib\\transport\\bdp_estimator.cc " + "src\\core\\lib\\transport\\bdp_estimator.cc " +
"src\\core\\lib\\transport\\call_factory.cc " +
"src\\core\\lib\\transport\\call_filters.cc " + "src\\core\\lib\\transport\\call_filters.cc " +
"src\\core\\lib\\transport\\call_final_info.cc " + "src\\core\\lib\\transport\\call_final_info.cc " +
"src\\core\\lib\\transport\\call_size_estimator.cc " + "src\\core\\lib\\transport\\call_size_estimator.cc " +

@ -22,7 +22,7 @@ RUN ln -s /usr/bin/python3 /usr/bin/python
RUN mkdir /artifacts RUN mkdir /artifacts
COPY . . COPY . .
RUN OVERRIDE_BAZEL_VERSION=5.4.0 tools/bazel build //examples/cpp/csm:csm_greeter_client RUN tools/bazel build //examples/cpp/csm:csm_greeter_client
RUN cp -rL /workdir/bazel-bin/examples/cpp/csm/csm_greeter_client /artifacts/ RUN cp -rL /workdir/bazel-bin/examples/cpp/csm/csm_greeter_client /artifacts/
FROM python:3.9-slim-bookworm FROM python:3.9-slim-bookworm

@ -6,6 +6,30 @@ This CSM example builds on the [Hello World Example](https://github.com/grpc/grp
The client takes the following command-line arguments - The client takes the following command-line arguments -
* target - By default, the client tries to connect to the xDS "xds:///helloworld:50051" and gRPC would use xDS to resolve this target and connect to the server backend. This can be overriden to change the target. * target - By default, the client tries to connect to the xDS "xds:///helloworld:50051" and gRPC would use xDS to resolve this target and connect to the server backend. This can be overriden to change the target.
* cookie_name - session affinity cookie name. Defaults to "GSSA"
* delay_s - delay (in seconds) between the RPCs. Default value is 5
The server takes the following command-line arguments - The server takes the following command-line arguments -
* port - Port on which the Hello World service is run. Defaults to 50051. * port - Port on which the Hello World service is run. Defaults to 50051.
## Building
From the gRPC workspace folder:
Client:
```
docker build -f examples/cpp/csm/Dockerfile.client
```
Server:
```
docker build -f examples/cpp/csm/Dockerfile.server
```
To push to a registry, add a tag to the image either by adding a `-t` flag to `docker build` command above or run:
```
docker image tag ${sha from build command above} ${tag}
```
And then push the tagged image using `docker push`

@ -16,16 +16,20 @@
* *
*/ */
#include <sys/types.h>
#include <chrono>
#include <condition_variable> #include <condition_variable>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <mutex> #include <optional>
#include <string> #include <string>
#include "absl/flags/flag.h" #include "absl/flags/flag.h"
#include "absl/flags/parse.h" #include "absl/flags/parse.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "absl/strings/str_split.h" #include "absl/strings/str_split.h"
#include "absl/types/optional.h"
#include "opentelemetry/exporters/prometheus/exporter_factory.h" #include "opentelemetry/exporters/prometheus/exporter_factory.h"
#include "opentelemetry/exporters/prometheus/exporter_options.h" #include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h" #include "opentelemetry/sdk/metrics/meter_provider.h"
@ -41,6 +45,8 @@
#endif #endif
ABSL_FLAG(std::string, target, "xds:///helloworld:50051", "Target string"); ABSL_FLAG(std::string, target, "xds:///helloworld:50051", "Target string");
ABSL_FLAG(std::string, cookie_name, "GSSA", "Cookie name");
ABSL_FLAG(uint, delay_s, 5, "Delay between requests");
using grpc::Channel; using grpc::Channel;
using grpc::ClientContext; using grpc::ClientContext;
@ -49,15 +55,13 @@ using helloworld::Greeter;
using helloworld::HelloReply; using helloworld::HelloReply;
using helloworld::HelloRequest; using helloworld::HelloRequest;
namespace {
struct Cookie { struct Cookie {
std::string name; std::string name;
std::string value; std::string value;
std::set<std::string> attributes; std::set<std::string> attributes;
std::pair<std::string, std::string> Header() const {
return std::make_pair("cookie", absl::StrFormat("%s=%s", name, value));
}
template <typename Sink> template <typename Sink>
friend void AbslStringify(Sink& sink, const Cookie& cookie) { friend void AbslStringify(Sink& sink, const Cookie& cookie) {
absl::Format(&sink, "(Cookie: %s, value: %s, attributes: {%s})", absl::Format(&sink, "(Cookie: %s, value: %s, attributes: {%s})",
@ -66,49 +70,45 @@ struct Cookie {
} }
}; };
class GreeterClient { Cookie ParseCookie(absl::string_view header) {
protected: Cookie cookie;
static Cookie ParseCookie(absl::string_view header) { std::pair<absl::string_view, absl::string_view> name_value =
Cookie cookie; absl::StrSplit(header, absl::MaxSplits('=', 1));
std::pair<absl::string_view, absl::string_view> name_value = cookie.name = std::string(name_value.first);
absl::StrSplit(header, absl::MaxSplits('=', 1)); std::pair<absl::string_view, absl::string_view> value_attrs =
cookie.name = std::string(name_value.first); absl::StrSplit(name_value.second, absl::MaxSplits(';', 1));
std::pair<absl::string_view, absl::string_view> value_attrs = cookie.value = std::string(value_attrs.first);
absl::StrSplit(name_value.second, absl::MaxSplits(';', 1)); for (absl::string_view segment : absl::StrSplit(value_attrs.second, ';')) {
cookie.value = std::string(value_attrs.first); cookie.attributes.emplace(absl::StripAsciiWhitespace(segment));
for (absl::string_view segment : absl::StrSplit(value_attrs.second, ';')) {
cookie.attributes.emplace(absl::StripAsciiWhitespace(segment));
}
return cookie;
} }
return cookie;
}
static std::vector<Cookie> GetCookies( std::vector<Cookie> GetCookies(
const std::multimap<grpc::string_ref, grpc::string_ref>& const std::multimap<grpc::string_ref, grpc::string_ref>& initial_metadata,
server_initial_metadata, absl::string_view cookie_name) {
absl::string_view cookie_name) { std::vector<Cookie> values;
std::vector<Cookie> values; auto pair = initial_metadata.equal_range("set-cookie");
auto pair = server_initial_metadata.equal_range("set-cookie"); for (auto it = pair.first; it != pair.second; ++it) {
for (auto it = pair.first; it != pair.second; ++it) { const auto cookie = ParseCookie(it->second.data());
gpr_log(GPR_INFO, "set-cookie header: %s", it->second.data()); if (cookie.name == cookie_name) {
const auto cookie = ParseCookie(it->second.data()); values.emplace_back(std::move(cookie));
if (cookie.name == cookie_name) {
values.emplace_back(cookie);
}
} }
return values;
} }
return values;
}
class GreeterClient {
public: public:
GreeterClient(std::shared_ptr<Channel> channel) GreeterClient(std::shared_ptr<Channel> channel, absl::string_view cookie_name)
: stub_(Greeter::NewStub(channel)) {} : stub_(Greeter::NewStub(channel)), cookie_name_(cookie_name) {}
// Assembles the client's payload, sends it and presents the response back // Assembles the client's payload, sends it and presents the response back
// from the server. // from the server.
std::string SayHello(const std::string& user, Cookie* cookieFromServer, void SayHello() {
const Cookie* cookieToServer) {
// Data we are sending to the server. // Data we are sending to the server.
HelloRequest request; HelloRequest request;
request.set_name(user); request.set_name("world");
// Container for the data we expect from the server. // Container for the data we expect from the server.
HelloReply reply; HelloReply reply;
@ -120,59 +120,45 @@ class GreeterClient {
// The actual RPC. // The actual RPC.
std::mutex mu; std::mutex mu;
std::condition_variable cv; std::condition_variable cv;
bool done = false; absl::optional<Status> status;
Status status; // Set the cookie header if we already got a cookie from the server
if (cookieToServer != NULL) { if (cookie_from_server_.has_value()) {
std::pair<std::string, std::string> cookieHeader = context.AddMetadata("cookie",
cookieToServer->Header(); absl::StrFormat("%s=%s", cookie_from_server_->name,
context.AddMetadata(cookieHeader.first, cookieHeader.second); cookie_from_server_->value));
} }
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); std::unique_lock<std::mutex> lock(mu);
while (!done) { stub_->async()->SayHello(&context, &request, &reply, [&](Status s) {
std::lock_guard<std::mutex> lock(mu);
status = std::move(s);
cv.notify_one();
});
while (!status.has_value()) {
cv.wait(lock); cv.wait(lock);
} }
if (!status->ok()) {
// Act upon its status. std::cout << "RPC failed" << status->error_code() << ": "
if (status.ok()) { << status->error_message() << std::endl;
if (cookieFromServer != NULL) { return;
const std::multimap<grpc::string_ref, grpc::string_ref>&
server_initial_metadata = context.GetServerInitialMetadata();
std::vector<Cookie> cookies =
GetCookies(server_initial_metadata, "GSSA");
if (!cookies.empty()) {
*cookieFromServer = cookies.front();
}
}
return reply.message();
} else {
std::cout << status.error_code() << ": " << status.error_message()
<< std::endl;
return "RPC failed";
} }
const std::multimap<grpc::string_ref, grpc::string_ref>&
server_initial_metadata = context.GetServerInitialMetadata();
// Update a cookie after a successful request
std::vector<Cookie> cookies =
GetCookies(server_initial_metadata, cookie_name_);
if (!cookies.empty()) {
cookie_from_server_.emplace(std::move(cookies.front()));
}
std::cout << "Greeter received: " << reply.message() << std::endl;
} }
private: private:
std::unique_ptr<Greeter::Stub> stub_; std::unique_ptr<Greeter::Stub> stub_;
std::string cookie_name_;
absl::optional<Cookie> cookie_from_server_;
}; };
static void sayHello(GreeterClient& greeter, Cookie* cookieFromServer, absl::StatusOr<grpc::experimental::CsmObservability> InitializeObservability() {
const Cookie* cookieToServer) {
std::string user("world");
std::string reply = greeter.SayHello(user, cookieFromServer, cookieToServer);
std::cout << "Greeter received: " << reply << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(5));
}
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE pods // default was "localhost:9464" which causes connection issue across GKE pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
@ -181,21 +167,29 @@ int main(int argc, char** argv) {
auto meter_provider = auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>(); std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
meter_provider->AddMetricReader(std::move(prometheus_exporter)); meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto observability = grpc::experimental::CsmObservabilityBuilder() return grpc::experimental::CsmObservabilityBuilder()
.SetMeterProvider(std::move(meter_provider)) .SetMeterProvider(std::move(meter_provider))
.BuildAndRegister(); .BuildAndRegister();
}
} // namespace
int main(int argc, char** argv) {
absl::ParseCommandLine(argc, argv);
// Setup the observability
auto observability = InitializeObservability();
if (!observability.ok()) { if (!observability.ok()) {
std::cerr << "CsmObservability::Init() failed: " std::cerr << "CsmObservability::Init() failed: "
<< observability.status().ToString() << std::endl; << observability.status().ToString() << std::endl;
return static_cast<int>(observability.status().code()); return static_cast<int>(observability.status().code());
} }
GreeterClient greeter(grpc::CreateChannel( GreeterClient greeter(grpc::CreateChannel(absl::GetFlag(FLAGS_target),
absl::GetFlag(FLAGS_target), grpc::InsecureChannelCredentials())); grpc::InsecureChannelCredentials()),
absl::GetFlag(FLAGS_cookie_name));
Cookie session_cookie;
sayHello(greeter, &session_cookie, NULL);
while (true) { while (true) {
sayHello(greeter, NULL, &session_cookie); greeter.SayHello();
std::this_thread::sleep_for(
std::chrono::seconds(absl::GetFlag(FLAGS_delay_s)));
} }
return 0; return 0;
} }

2
gRPC-C++.podspec generated

@ -1239,6 +1239,7 @@ Pod::Spec.new do |s|
'src/core/lib/surface/wait_for_cq_end_op.h', 'src/core/lib/surface/wait_for_cq_end_op.h',
'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.h', 'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/call_factory.h',
'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_filters.h',
'src/core/lib/transport/call_final_info.h', 'src/core/lib/transport/call_final_info.h',
'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_size_estimator.h',
@ -2495,6 +2496,7 @@ Pod::Spec.new do |s|
'src/core/lib/surface/wait_for_cq_end_op.h', 'src/core/lib/surface/wait_for_cq_end_op.h',
'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.h', 'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/call_factory.h',
'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_filters.h',
'src/core/lib/transport/call_final_info.h', 'src/core/lib/transport/call_final_info.h',
'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_size_estimator.h',

3
gRPC-Core.podspec generated

@ -1919,6 +1919,8 @@ Pod::Spec.new do |s|
'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.cc', 'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/bdp_estimator.h', 'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/call_factory.cc',
'src/core/lib/transport/call_factory.h',
'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_filters.cc',
'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_filters.h',
'src/core/lib/transport/call_final_info.cc', 'src/core/lib/transport/call_final_info.cc',
@ -3274,6 +3276,7 @@ Pod::Spec.new do |s|
'src/core/lib/surface/wait_for_cq_end_op.h', 'src/core/lib/surface/wait_for_cq_end_op.h',
'src/core/lib/transport/batch_builder.h', 'src/core/lib/transport/batch_builder.h',
'src/core/lib/transport/bdp_estimator.h', 'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/call_factory.h',
'src/core/lib/transport/call_filters.h', 'src/core/lib/transport/call_filters.h',
'src/core/lib/transport/call_final_info.h', 'src/core/lib/transport/call_final_info.h',
'src/core/lib/transport/call_size_estimator.h', 'src/core/lib/transport/call_size_estimator.h',

2
grpc.gemspec generated

@ -1812,6 +1812,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/transport/batch_builder.h ) s.files += %w( src/core/lib/transport/batch_builder.h )
s.files += %w( src/core/lib/transport/bdp_estimator.cc ) s.files += %w( src/core/lib/transport/bdp_estimator.cc )
s.files += %w( src/core/lib/transport/bdp_estimator.h ) s.files += %w( src/core/lib/transport/bdp_estimator.h )
s.files += %w( src/core/lib/transport/call_factory.cc )
s.files += %w( src/core/lib/transport/call_factory.h )
s.files += %w( src/core/lib/transport/call_filters.cc ) s.files += %w( src/core/lib/transport/call_filters.cc )
s.files += %w( src/core/lib/transport/call_filters.h ) s.files += %w( src/core/lib/transport/call_filters.h )
s.files += %w( src/core/lib/transport/call_final_info.cc ) s.files += %w( src/core/lib/transport/call_final_info.cc )

3
grpc.gyp generated

@ -975,6 +975,7 @@
'src/core/lib/surface/version.cc', 'src/core/lib/surface/version.cc',
'src/core/lib/transport/batch_builder.cc', 'src/core/lib/transport/batch_builder.cc',
'src/core/lib/transport/bdp_estimator.cc', 'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/call_factory.cc',
'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_filters.cc',
'src/core/lib/transport/call_final_info.cc', 'src/core/lib/transport/call_final_info.cc',
'src/core/lib/transport/call_size_estimator.cc', 'src/core/lib/transport/call_size_estimator.cc',
@ -1476,6 +1477,7 @@
'src/core/lib/surface/version.cc', 'src/core/lib/surface/version.cc',
'src/core/lib/transport/batch_builder.cc', 'src/core/lib/transport/batch_builder.cc',
'src/core/lib/transport/bdp_estimator.cc', 'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/call_factory.cc',
'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_filters.cc',
'src/core/lib/transport/call_final_info.cc', 'src/core/lib/transport/call_final_info.cc',
'src/core/lib/transport/call_size_estimator.cc', 'src/core/lib/transport/call_size_estimator.cc',
@ -2279,6 +2281,7 @@
'src/core/lib/surface/validate_metadata.cc', 'src/core/lib/surface/validate_metadata.cc',
'src/core/lib/surface/version.cc', 'src/core/lib/surface/version.cc',
'src/core/lib/transport/batch_builder.cc', 'src/core/lib/transport/batch_builder.cc',
'src/core/lib/transport/call_factory.cc',
'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_filters.cc',
'src/core/lib/transport/call_final_info.cc', 'src/core/lib/transport/call_final_info.cc',
'src/core/lib/transport/call_size_estimator.cc', 'src/core/lib/transport/call_size_estimator.cc',

2
package.xml generated

@ -1794,6 +1794,8 @@
<file baseinstalldir="/" name="src/core/lib/transport/batch_builder.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/batch_builder.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/bdp_estimator.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/call_factory.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/call_factory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/call_filters.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/call_filters.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/call_filters.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/call_filters.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/transport/call_final_info.cc" role="src" /> <file baseinstalldir="/" name="src/core/lib/transport/call_final_info.cc" role="src" />

@ -6734,6 +6734,38 @@ grpc_cc_library(
], ],
) )
grpc_cc_library(
name = "call_factory",
srcs = [
"lib/transport/call_factory.cc",
],
hdrs = [
"lib/transport/call_factory.h",
],
deps = [
"arena",
"call_size_estimator",
"call_spine",
"channel_args",
"ref_counted",
"resource_quota",
"//:gpr_platform",
"//:stats",
],
)
grpc_cc_library(
name = "call_destination",
hdrs = [
"lib/transport/call_destination.h",
],
deps = [
"call_spine",
"//:gpr_platform",
"//:orphanable",
],
)
grpc_cc_library( grpc_cc_library(
name = "parsed_metadata", name = "parsed_metadata",
srcs = [ srcs = [

@ -43,13 +43,15 @@ bool IsForkEnabled() {
void ObjectGroupForkHandler::RegisterForkable( void ObjectGroupForkHandler::RegisterForkable(
std::shared_ptr<Forkable> forkable, GRPC_UNUSED void (*prepare)(void), std::shared_ptr<Forkable> forkable, GRPC_UNUSED void (*prepare)(void),
GRPC_UNUSED void (*parent)(void), GRPC_UNUSED void (*child)(void)) { GRPC_UNUSED void (*parent)(void), GRPC_UNUSED void (*child)(void)) {
GPR_ASSERT(!is_forking_); if (IsForkEnabled()) {
forkables_.emplace_back(forkable); GPR_ASSERT(!is_forking_);
forkables_.emplace_back(forkable);
#ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK #ifdef GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
if (!std::exchange(registered_, true)) { if (!std::exchange(registered_, true)) {
pthread_atfork(prepare, parent, child); pthread_atfork(prepare, parent, child);
} }
#endif // GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK #endif // GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
}
} }
void ObjectGroupForkHandler::Prefork() { void ObjectGroupForkHandler::Prefork() {

@ -29,6 +29,8 @@ const char* const description_call_status_override_on_cancellation =
"with cancellation."; "with cancellation.";
const char* const additional_constraints_call_status_override_on_cancellation = const char* const additional_constraints_call_status_override_on_cancellation =
"{}"; "{}";
const char* const description_call_v3 = "Promise-based call version 3.";
const char* const additional_constraints_call_v3 = "{}";
const char* const description_canary_client_privacy = const char* const description_canary_client_privacy =
"If set, canary client privacy"; "If set, canary client privacy";
const char* const additional_constraints_canary_client_privacy = "{}"; const char* const additional_constraints_canary_client_privacy = "{}";
@ -105,9 +107,6 @@ const uint8_t required_experiments_promise_based_inproc_transport[] = {
static_cast<uint8_t>(grpc_core::kExperimentIdPromiseBasedServerCall), static_cast<uint8_t>(grpc_core::kExperimentIdPromiseBasedServerCall),
static_cast<uint8_t>( static_cast<uint8_t>(
grpc_core::kExperimentIdRegisteredMethodLookupInTransport)}; grpc_core::kExperimentIdRegisteredMethodLookupInTransport)};
const char* const description_registered_methods_map =
"Use absl::flat_hash_map for registered methods.";
const char* const additional_constraints_registered_methods_map = "{}";
const char* const description_rfc_max_concurrent_streams = const char* const description_rfc_max_concurrent_streams =
"If set, enable rfc-compliant behavior (cancellation) in the advent that " "If set, enable rfc-compliant behavior (cancellation) in the advent that "
"max concurrent streams are exceeded in chttp2. See " "max concurrent streams are exceeded in chttp2. See "
@ -191,6 +190,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
description_call_status_override_on_cancellation, description_call_status_override_on_cancellation,
additional_constraints_call_status_override_on_cancellation, nullptr, 0, additional_constraints_call_status_override_on_cancellation, nullptr, 0,
kDefaultForDebugOnly, true}, kDefaultForDebugOnly, true},
{"call_v3", description_call_v3, additional_constraints_call_v3, nullptr, 0,
false, true},
{"canary_client_privacy", description_canary_client_privacy, {"canary_client_privacy", description_canary_client_privacy,
additional_constraints_canary_client_privacy, nullptr, 0, false, false}, additional_constraints_canary_client_privacy, nullptr, 0, false, false},
{"client_idleness", description_client_idleness, {"client_idleness", description_client_idleness,
@ -234,8 +235,6 @@ const ExperimentMetadata g_experiment_metadata[] = {
description_promise_based_inproc_transport, description_promise_based_inproc_transport,
additional_constraints_promise_based_inproc_transport, additional_constraints_promise_based_inproc_transport,
required_experiments_promise_based_inproc_transport, 3, false, false}, required_experiments_promise_based_inproc_transport, 3, false, false},
{"registered_methods_map", description_registered_methods_map,
additional_constraints_registered_methods_map, nullptr, 0, false, true},
{"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams, {"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams,
additional_constraints_rfc_max_concurrent_streams, nullptr, 0, false, additional_constraints_rfc_max_concurrent_streams, nullptr, 0, false,
true}, true},
@ -293,6 +292,8 @@ const char* const description_call_status_override_on_cancellation =
"with cancellation."; "with cancellation.";
const char* const additional_constraints_call_status_override_on_cancellation = const char* const additional_constraints_call_status_override_on_cancellation =
"{}"; "{}";
const char* const description_call_v3 = "Promise-based call version 3.";
const char* const additional_constraints_call_v3 = "{}";
const char* const description_canary_client_privacy = const char* const description_canary_client_privacy =
"If set, canary client privacy"; "If set, canary client privacy";
const char* const additional_constraints_canary_client_privacy = "{}"; const char* const additional_constraints_canary_client_privacy = "{}";
@ -369,9 +370,6 @@ const uint8_t required_experiments_promise_based_inproc_transport[] = {
static_cast<uint8_t>(grpc_core::kExperimentIdPromiseBasedServerCall), static_cast<uint8_t>(grpc_core::kExperimentIdPromiseBasedServerCall),
static_cast<uint8_t>( static_cast<uint8_t>(
grpc_core::kExperimentIdRegisteredMethodLookupInTransport)}; grpc_core::kExperimentIdRegisteredMethodLookupInTransport)};
const char* const description_registered_methods_map =
"Use absl::flat_hash_map for registered methods.";
const char* const additional_constraints_registered_methods_map = "{}";
const char* const description_rfc_max_concurrent_streams = const char* const description_rfc_max_concurrent_streams =
"If set, enable rfc-compliant behavior (cancellation) in the advent that " "If set, enable rfc-compliant behavior (cancellation) in the advent that "
"max concurrent streams are exceeded in chttp2. See " "max concurrent streams are exceeded in chttp2. See "
@ -455,6 +453,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
description_call_status_override_on_cancellation, description_call_status_override_on_cancellation,
additional_constraints_call_status_override_on_cancellation, nullptr, 0, additional_constraints_call_status_override_on_cancellation, nullptr, 0,
kDefaultForDebugOnly, true}, kDefaultForDebugOnly, true},
{"call_v3", description_call_v3, additional_constraints_call_v3, nullptr, 0,
false, true},
{"canary_client_privacy", description_canary_client_privacy, {"canary_client_privacy", description_canary_client_privacy,
additional_constraints_canary_client_privacy, nullptr, 0, false, false}, additional_constraints_canary_client_privacy, nullptr, 0, false, false},
{"client_idleness", description_client_idleness, {"client_idleness", description_client_idleness,
@ -498,8 +498,6 @@ const ExperimentMetadata g_experiment_metadata[] = {
description_promise_based_inproc_transport, description_promise_based_inproc_transport,
additional_constraints_promise_based_inproc_transport, additional_constraints_promise_based_inproc_transport,
required_experiments_promise_based_inproc_transport, 3, false, false}, required_experiments_promise_based_inproc_transport, 3, false, false},
{"registered_methods_map", description_registered_methods_map,
additional_constraints_registered_methods_map, nullptr, 0, false, true},
{"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams, {"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams,
additional_constraints_rfc_max_concurrent_streams, nullptr, 0, false, additional_constraints_rfc_max_concurrent_streams, nullptr, 0, false,
true}, true},
@ -557,6 +555,8 @@ const char* const description_call_status_override_on_cancellation =
"with cancellation."; "with cancellation.";
const char* const additional_constraints_call_status_override_on_cancellation = const char* const additional_constraints_call_status_override_on_cancellation =
"{}"; "{}";
const char* const description_call_v3 = "Promise-based call version 3.";
const char* const additional_constraints_call_v3 = "{}";
const char* const description_canary_client_privacy = const char* const description_canary_client_privacy =
"If set, canary client privacy"; "If set, canary client privacy";
const char* const additional_constraints_canary_client_privacy = "{}"; const char* const additional_constraints_canary_client_privacy = "{}";
@ -633,9 +633,6 @@ const uint8_t required_experiments_promise_based_inproc_transport[] = {
static_cast<uint8_t>(grpc_core::kExperimentIdPromiseBasedServerCall), static_cast<uint8_t>(grpc_core::kExperimentIdPromiseBasedServerCall),
static_cast<uint8_t>( static_cast<uint8_t>(
grpc_core::kExperimentIdRegisteredMethodLookupInTransport)}; grpc_core::kExperimentIdRegisteredMethodLookupInTransport)};
const char* const description_registered_methods_map =
"Use absl::flat_hash_map for registered methods.";
const char* const additional_constraints_registered_methods_map = "{}";
const char* const description_rfc_max_concurrent_streams = const char* const description_rfc_max_concurrent_streams =
"If set, enable rfc-compliant behavior (cancellation) in the advent that " "If set, enable rfc-compliant behavior (cancellation) in the advent that "
"max concurrent streams are exceeded in chttp2. See " "max concurrent streams are exceeded in chttp2. See "
@ -719,6 +716,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
description_call_status_override_on_cancellation, description_call_status_override_on_cancellation,
additional_constraints_call_status_override_on_cancellation, nullptr, 0, additional_constraints_call_status_override_on_cancellation, nullptr, 0,
kDefaultForDebugOnly, true}, kDefaultForDebugOnly, true},
{"call_v3", description_call_v3, additional_constraints_call_v3, nullptr, 0,
false, true},
{"canary_client_privacy", description_canary_client_privacy, {"canary_client_privacy", description_canary_client_privacy,
additional_constraints_canary_client_privacy, nullptr, 0, false, false}, additional_constraints_canary_client_privacy, nullptr, 0, false, false},
{"client_idleness", description_client_idleness, {"client_idleness", description_client_idleness,
@ -762,8 +761,6 @@ const ExperimentMetadata g_experiment_metadata[] = {
description_promise_based_inproc_transport, description_promise_based_inproc_transport,
additional_constraints_promise_based_inproc_transport, additional_constraints_promise_based_inproc_transport,
required_experiments_promise_based_inproc_transport, 3, false, false}, required_experiments_promise_based_inproc_transport, 3, false, false},
{"registered_methods_map", description_registered_methods_map,
additional_constraints_registered_methods_map, nullptr, 0, false, true},
{"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams, {"rfc_max_concurrent_streams", description_rfc_max_concurrent_streams,
additional_constraints_rfc_max_concurrent_streams, nullptr, 0, false, additional_constraints_rfc_max_concurrent_streams, nullptr, 0, false,
true}, true},

@ -67,6 +67,7 @@ inline bool IsCallStatusOverrideOnCancellationEnabled() {
return true; return true;
#endif #endif
} }
inline bool IsCallV3Enabled() { return false; }
inline bool IsCanaryClientPrivacyEnabled() { return false; } inline bool IsCanaryClientPrivacyEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_IDLENESS #define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_IDLENESS
inline bool IsClientIdlenessEnabled() { return true; } inline bool IsClientIdlenessEnabled() { return true; }
@ -92,7 +93,6 @@ inline bool IsPromiseBasedServerCallEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; } inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; }
inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsPromiseBasedInprocTransportEnabled() { return false; }
inline bool IsRegisteredMethodsMapEnabled() { return false; }
inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; } inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; } inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
@ -128,6 +128,7 @@ inline bool IsCallStatusOverrideOnCancellationEnabled() {
return true; return true;
#endif #endif
} }
inline bool IsCallV3Enabled() { return false; }
inline bool IsCanaryClientPrivacyEnabled() { return false; } inline bool IsCanaryClientPrivacyEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_IDLENESS #define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_IDLENESS
inline bool IsClientIdlenessEnabled() { return true; } inline bool IsClientIdlenessEnabled() { return true; }
@ -154,7 +155,6 @@ inline bool IsPromiseBasedServerCallEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; } inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; }
inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsPromiseBasedInprocTransportEnabled() { return false; }
inline bool IsRegisteredMethodsMapEnabled() { return false; }
inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; } inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; } inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
@ -190,6 +190,7 @@ inline bool IsCallStatusOverrideOnCancellationEnabled() {
return true; return true;
#endif #endif
} }
inline bool IsCallV3Enabled() { return false; }
inline bool IsCanaryClientPrivacyEnabled() { return false; } inline bool IsCanaryClientPrivacyEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_IDLENESS #define GRPC_EXPERIMENT_IS_INCLUDED_CLIENT_IDLENESS
inline bool IsClientIdlenessEnabled() { return true; } inline bool IsClientIdlenessEnabled() { return true; }
@ -217,7 +218,6 @@ inline bool IsPromiseBasedServerCallEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT #define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHOD_LOOKUP_IN_TRANSPORT
inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; } inline bool IsRegisteredMethodLookupInTransportEnabled() { return true; }
inline bool IsPromiseBasedInprocTransportEnabled() { return false; } inline bool IsPromiseBasedInprocTransportEnabled() { return false; }
inline bool IsRegisteredMethodsMapEnabled() { return false; }
inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; } inline bool IsRfcMaxConcurrentStreamsEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST #define GRPC_EXPERIMENT_IS_INCLUDED_ROUND_ROBIN_DELEGATE_TO_PICK_FIRST
inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; } inline bool IsRoundRobinDelegateToPickFirstEnabled() { return true; }
@ -246,6 +246,7 @@ inline bool IsWrrDelegateToPickFirstEnabled() { return true; }
#else #else
enum ExperimentIds { enum ExperimentIds {
kExperimentIdCallStatusOverrideOnCancellation, kExperimentIdCallStatusOverrideOnCancellation,
kExperimentIdCallV3,
kExperimentIdCanaryClientPrivacy, kExperimentIdCanaryClientPrivacy,
kExperimentIdClientIdleness, kExperimentIdClientIdleness,
kExperimentIdClientPrivacy, kExperimentIdClientPrivacy,
@ -265,7 +266,6 @@ enum ExperimentIds {
kExperimentIdPromiseBasedServerCall, kExperimentIdPromiseBasedServerCall,
kExperimentIdRegisteredMethodLookupInTransport, kExperimentIdRegisteredMethodLookupInTransport,
kExperimentIdPromiseBasedInprocTransport, kExperimentIdPromiseBasedInprocTransport,
kExperimentIdRegisteredMethodsMap,
kExperimentIdRfcMaxConcurrentStreams, kExperimentIdRfcMaxConcurrentStreams,
kExperimentIdRoundRobinDelegateToPickFirst, kExperimentIdRoundRobinDelegateToPickFirst,
kExperimentIdRstpit, kExperimentIdRstpit,
@ -290,6 +290,10 @@ enum ExperimentIds {
inline bool IsCallStatusOverrideOnCancellationEnabled() { inline bool IsCallStatusOverrideOnCancellationEnabled() {
return IsExperimentEnabled(kExperimentIdCallStatusOverrideOnCancellation); return IsExperimentEnabled(kExperimentIdCallStatusOverrideOnCancellation);
} }
#define GRPC_EXPERIMENT_IS_INCLUDED_CALL_V3
inline bool IsCallV3Enabled() {
return IsExperimentEnabled(kExperimentIdCallV3);
}
#define GRPC_EXPERIMENT_IS_INCLUDED_CANARY_CLIENT_PRIVACY #define GRPC_EXPERIMENT_IS_INCLUDED_CANARY_CLIENT_PRIVACY
inline bool IsCanaryClientPrivacyEnabled() { inline bool IsCanaryClientPrivacyEnabled() {
return IsExperimentEnabled(kExperimentIdCanaryClientPrivacy); return IsExperimentEnabled(kExperimentIdCanaryClientPrivacy);
@ -366,10 +370,6 @@ inline bool IsRegisteredMethodLookupInTransportEnabled() {
inline bool IsPromiseBasedInprocTransportEnabled() { inline bool IsPromiseBasedInprocTransportEnabled() {
return IsExperimentEnabled(kExperimentIdPromiseBasedInprocTransport); return IsExperimentEnabled(kExperimentIdPromiseBasedInprocTransport);
} }
#define GRPC_EXPERIMENT_IS_INCLUDED_REGISTERED_METHODS_MAP
inline bool IsRegisteredMethodsMapEnabled() {
return IsExperimentEnabled(kExperimentIdRegisteredMethodsMap);
}
#define GRPC_EXPERIMENT_IS_INCLUDED_RFC_MAX_CONCURRENT_STREAMS #define GRPC_EXPERIMENT_IS_INCLUDED_RFC_MAX_CONCURRENT_STREAMS
inline bool IsRfcMaxConcurrentStreamsEnabled() { inline bool IsRfcMaxConcurrentStreamsEnabled() {
return IsExperimentEnabled(kExperimentIdRfcMaxConcurrentStreams); return IsExperimentEnabled(kExperimentIdRfcMaxConcurrentStreams);

@ -47,6 +47,11 @@
expiry: 2024/04/01 expiry: 2024/04/01
owner: vigneshbabu@google.com owner: vigneshbabu@google.com
test_tags: [] test_tags: []
- name: call_v3
description: Promise-based call version 3.
expiry: 2024/06/01
owner: ctiller@google.com
test_tags: []
- name: canary_client_privacy - name: canary_client_privacy
description: description:
If set, canary client privacy If set, canary client privacy
@ -178,12 +183,6 @@
expiry: 2024/03/31 expiry: 2024/03/31
owner: yashkt@google.com owner: yashkt@google.com
test_tags: ["surface_registered_method_lookup"] test_tags: ["surface_registered_method_lookup"]
- name: registered_methods_map
description:
Use absl::flat_hash_map for registered methods.
expiry: 2024/01/31
owner: alishananda@google.com
test_tags: []
- name: rfc_max_concurrent_streams - name: rfc_max_concurrent_streams
description: description:
If set, enable rfc-compliant behavior (cancellation) in the advent that If set, enable rfc-compliant behavior (cancellation) in the advent that

@ -42,6 +42,8 @@
- name: call_status_override_on_cancellation - name: call_status_override_on_cancellation
default: debug default: debug
- name: call_v3
default: false
- name: canary_client_privacy - name: canary_client_privacy
default: false default: false
- name: client_idleness - name: client_idleness
@ -92,8 +94,6 @@
default: false default: false
- name: registered_method_lookup_in_transport - name: registered_method_lookup_in_transport
default: true default: true
- name: registered_methods_map
default: false
- name: rfc_max_concurrent_streams - name: rfc_max_concurrent_streams
default: false default: false
- name: round_robin_delegate_to_pick_first - name: round_robin_delegate_to_pick_first

@ -58,12 +58,25 @@
#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/surface/channel_stack_type.h" #include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/surface/init_internally.h" #include "src/core/lib/surface/init_internally.h"
#include "src/core/lib/transport/call_factory.h"
#include "src/core/lib/transport/transport.h" #include "src/core/lib/transport/transport.h"
// IWYU pragma: no_include <type_traits> // IWYU pragma: no_include <type_traits>
namespace grpc_core { namespace grpc_core {
namespace {
class NotReallyACallFactory final : public CallFactory {
public:
using CallFactory::CallFactory;
CallInitiator CreateCall(ClientMetadataHandle, Arena*) override {
Crash("NotReallyACallFactory::CreateCall should never be called");
}
};
} // namespace
Channel::Channel(bool is_client, bool is_promising, std::string target, Channel::Channel(bool is_client, bool is_promising, std::string target,
const ChannelArgs& channel_args, const ChannelArgs& channel_args,
grpc_compression_options compression_options, grpc_compression_options compression_options,
@ -71,14 +84,10 @@ Channel::Channel(bool is_client, bool is_promising, std::string target,
: is_client_(is_client), : is_client_(is_client),
is_promising_(is_promising), is_promising_(is_promising),
compression_options_(compression_options), compression_options_(compression_options),
call_size_estimator_(channel_stack->call_stack_size +
grpc_call_get_initial_size_estimate()),
channelz_node_(channel_args.GetObjectRef<channelz::ChannelNode>()), channelz_node_(channel_args.GetObjectRef<channelz::ChannelNode>()),
allocator_(channel_args.GetObject<ResourceQuota>()
->memory_quota()
->CreateMemoryOwner()),
target_(std::move(target)), target_(std::move(target)),
channel_stack_(std::move(channel_stack)) { channel_stack_(std::move(channel_stack)),
call_factory_(MakeRefCounted<NotReallyACallFactory>(channel_args)) {
// We need to make sure that grpc_shutdown() does not shut things down // We need to make sure that grpc_shutdown() does not shut things down
// until after the channel is destroyed. However, the channel may not // until after the channel is destroyed. However, the channel may not
// actually be destroyed by the time grpc_channel_destroy() returns, // actually be destroyed by the time grpc_channel_destroy() returns,
@ -107,17 +116,6 @@ Channel::Channel(bool is_client, bool is_promising, std::string target,
}; };
} }
Arena* Channel::CreateArena() {
const size_t initial_size = call_size_estimator_.CallSizeEstimate();
global_stats().IncrementCallInitialSize(initial_size);
return Arena::Create(initial_size, &allocator_);
}
void Channel::DestroyArena(Arena* arena) {
call_size_estimator_.UpdateCallSizeEstimate(arena->TotalUsedBytes());
arena->Destroy();
}
absl::StatusOr<RefCountedPtr<Channel>> Channel::CreateWithBuilder( absl::StatusOr<RefCountedPtr<Channel>> Channel::CreateWithBuilder(
ChannelStackBuilder* builder) { ChannelStackBuilder* builder) {
auto channel_args = builder->channel_args(); auto channel_args = builder->channel_args();

@ -52,10 +52,9 @@
#include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/time.h"
#include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/iomgr_fwd.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice.h"
#include "src/core/lib/surface/channel_stack_type.h" #include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/call_size_estimator.h" #include "src/core/lib/transport/call_factory.h"
#include "src/core/lib/transport/transport.h" #include "src/core/lib/transport/transport.h"
/// The same as grpc_channel_destroy, but doesn't create an ExecCtx, and so /// The same as grpc_channel_destroy, but doesn't create an ExecCtx, and so
@ -122,8 +121,8 @@ class Channel : public RefCounted<Channel>,
channelz::ChannelNode* channelz_node() const { return channelz_node_.get(); } channelz::ChannelNode* channelz_node() const { return channelz_node_.get(); }
Arena* CreateArena(); Arena* CreateArena() { return call_factory_->CreateArena(); }
void DestroyArena(Arena* arena); void DestroyArena(Arena* arena) { return call_factory_->DestroyArena(arena); }
absl::string_view target() const { return target_; } absl::string_view target() const { return target_; }
bool is_client() const { return is_client_; } bool is_client() const { return is_client_; }
@ -148,12 +147,11 @@ class Channel : public RefCounted<Channel>,
const bool is_client_; const bool is_client_;
const bool is_promising_; const bool is_promising_;
const grpc_compression_options compression_options_; const grpc_compression_options compression_options_;
CallSizeEstimator call_size_estimator_;
CallRegistrationTable registration_table_; CallRegistrationTable registration_table_;
RefCountedPtr<channelz::ChannelNode> channelz_node_; RefCountedPtr<channelz::ChannelNode> channelz_node_;
MemoryAllocator allocator_;
std::string target_; std::string target_;
const RefCountedPtr<grpc_channel_stack> channel_stack_; const RefCountedPtr<grpc_channel_stack> channel_stack_;
const RefCountedPtr<CallFactory> call_factory_;
}; };
} // namespace grpc_core } // namespace grpc_core

@ -0,0 +1,35 @@
// Copyright 2024 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_DESTINATION_H
#define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_DESTINATION_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/transport/call_spine.h"
namespace grpc_core {
// CallDestination is responsible for the processing of a CallHandler.
// It might be a transport, the server API, or a subchannel on the client (for
// instance).
class CallDestination : public Orphanable {
public:
virtual void StartCall(CallHandler call_handler) = 0;
};
} // namespace grpc_core
#endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_DESTINATION_H

@ -0,0 +1,41 @@
// 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.
#include <grpc/support/port_platform.h>
#include "src/core/lib/transport/call_factory.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/resource_quota/resource_quota.h"
namespace grpc_core {
CallFactory::CallFactory(const ChannelArgs& args)
: call_size_estimator_(1024),
allocator_(args.GetObject<ResourceQuota>()
->memory_quota()
->CreateMemoryOwner()) {}
Arena* CallFactory::CreateArena() {
const size_t initial_size = call_size_estimator_.CallSizeEstimate();
global_stats().IncrementCallInitialSize(initial_size);
return Arena::Create(initial_size, &allocator_);
}
void CallFactory::DestroyArena(Arena* arena) {
call_size_estimator_.UpdateCallSizeEstimate(arena->TotalUsedBytes());
arena->Destroy();
}
} // namespace grpc_core

@ -0,0 +1,56 @@
// Copyright 2024 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FACTORY_H
#define GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FACTORY_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/transport/call_size_estimator.h"
#include "src/core/lib/transport/call_spine.h"
namespace grpc_core {
// CallFactory creates calls.
class CallFactory : public RefCounted<CallFactory> {
public:
explicit CallFactory(const ChannelArgs& args);
// Create an arena for a call.
// We do this as a separate step so that servers can create arenas without
// creating the call into it - in the case that we have a HTTP/2 rapid reset
// like attack this saves a lot of cpu time.
Arena* CreateArena();
// Destroy an arena created by CreateArena.
// Updates the call size estimator so that we always create arenas of about
// the right size.
void DestroyArena(Arena* arena);
// Create a call. The call will be created in the given arena.
// It is the CallFactory's responsibility to ensure that the CallHandler
// associated with the call is eventually handled by something (typically a
// CallDestination, but this is not strictly required).
virtual CallInitiator CreateCall(ClientMetadataHandle md, Arena* arena) = 0;
private:
CallSizeEstimator call_size_estimator_;
MemoryAllocator allocator_;
};
} // namespace grpc_core
#endif // GRPC_SRC_CORE_LIB_TRANSPORT_CALL_FACTORY_H

@ -94,12 +94,6 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/load_balancing/child_policy_handler.h"
#include "src/core/load_balancing/grpclb/client_load_reporting_filter.h"
#include "src/core/load_balancing/grpclb/grpclb_balancer_addresses.h"
#include "src/core/load_balancing/grpclb/grpclb_client_stats.h"
#include "src/core/load_balancing/grpclb/load_balancer_api.h"
#include "src/core/resolver/fake/fake_resolver.h"
#include "src/core/lib/address_utils/sockaddr_utils.h" #include "src/core/lib/address_utils/sockaddr_utils.h"
#include "src/core/lib/backoff/backoff.h" #include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
@ -128,13 +122,6 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/resolver.h"
#include "src/core/lib/security/credentials/credentials.h" #include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice.h"
#include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/slice/slice_string_helpers.h"
@ -143,6 +130,19 @@
#include "src/core/lib/surface/channel_stack_type.h" #include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/metadata_batch.h"
#include "src/core/load_balancing/child_policy_handler.h"
#include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/grpclb/client_load_reporting_filter.h"
#include "src/core/load_balancing/grpclb/grpclb_balancer_addresses.h"
#include "src/core/load_balancing/grpclb/grpclb_client_stats.h"
#include "src/core/load_balancing/grpclb/load_balancer_api.h"
#include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/fake/fake_resolver.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/resolver.h"
#define GRPC_GRPCLB_INITIAL_CONNECT_BACKOFF_SECONDS 1 #define GRPC_GRPCLB_INITIAL_CONNECT_BACKOFF_SECONDS 1
#define GRPC_GRPCLB_RECONNECT_BACKOFF_MULTIPLIER 1.6 #define GRPC_GRPCLB_RECONNECT_BACKOFF_MULTIPLIER 1.6

@ -65,13 +65,13 @@
#include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/iomgr/resolved_address.h" #include "src/core/lib/iomgr/resolved_address.h"
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -60,11 +60,11 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -56,12 +56,12 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -62,12 +62,12 @@
#include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/iomgr/resolved_address.h" #include "src/core/lib/iomgr/resolved_address.h"
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -87,12 +87,6 @@
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/json/json_writer.h" #include "src/core/lib/json/json_writer.h"
#include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/resolver_registry.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h" #include "src/core/lib/security/credentials/fake/fake_credentials.h"
#include "src/core/lib/service_config/service_config_impl.h" #include "src/core/lib/service_config/service_config_impl.h"
#include "src/core/lib/slice/slice.h" #include "src/core/lib/slice/slice.h"
@ -101,6 +95,12 @@
#include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/channel.h"
#include "src/core/lib/transport/connectivity_state.h" #include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/error_utils.h" #include "src/core/lib/transport/error_utils.h"
#include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/resolver_registry.h"
#include "src/proto/grpc/lookup/v1/rls.upb.h" #include "src/proto/grpc/lookup/v1/rls.upb.h"
namespace grpc_core { namespace grpc_core {

@ -48,12 +48,12 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/gprpp/work_serializer.h"
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/server_address.h" #include "src/core/resolver/server_address.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -40,11 +40,11 @@
#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/work_serializer.h" #include "src/core/lib/gprpp/work_serializer.h"
#include "src/core/lib/iomgr/iomgr_fwd.h" #include "src/core/lib/iomgr/iomgr_fwd.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/server_address.h" #include "src/core/resolver/server_address.h"
#include "src/core/lib/transport/connectivity_state.h"
// Code for maintaining a list of subchannels within an LB policy. // Code for maintaining a list of subchannels within an LB policy.
// //

@ -71,12 +71,12 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/server_address.h" #include "src/core/resolver/server_address.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -57,12 +57,12 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h"
// IWYU pragma: no_include <type_traits> // IWYU pragma: no_include <type_traits>

@ -40,7 +40,6 @@
#include "src/core/load_balancing/address_filtering.h" #include "src/core/load_balancing/address_filtering.h"
#include "src/core/load_balancing/outlier_detection/outlier_detection.h" #include "src/core/load_balancing/outlier_detection/outlier_detection.h"
#include "src/core/load_balancing/xds/xds_channel_args.h" #include "src/core/load_balancing/xds/xds_channel_args.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/ext/xds/xds_cluster.h" #include "src/core/ext/xds/xds_cluster.h"
#include "src/core/ext/xds/xds_common_types.h" #include "src/core/ext/xds/xds_common_types.h"
#include "src/core/ext/xds/xds_health_status.h" #include "src/core/ext/xds/xds_health_status.h"
@ -64,6 +63,7 @@
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
namespace grpc_core { namespace grpc_core {

@ -41,7 +41,6 @@
#include "src/core/load_balancing/backend_metric_data.h" #include "src/core/load_balancing/backend_metric_data.h"
#include "src/core/load_balancing/child_policy_handler.h" #include "src/core/load_balancing/child_policy_handler.h"
#include "src/core/load_balancing/xds/xds_channel_args.h" #include "src/core/load_balancing/xds/xds_channel_args.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/ext/xds/xds_bootstrap.h" #include "src/core/ext/xds/xds_bootstrap.h"
#include "src/core/ext/xds/xds_bootstrap_grpc.h" #include "src/core/ext/xds/xds_bootstrap_grpc.h"
#include "src/core/ext/xds/xds_client.h" #include "src/core/ext/xds/xds_client.h"
@ -62,14 +61,15 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/security/credentials/xds/xds_credentials.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/security/credentials/xds/xds_credentials.h" #include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/lib/transport/connectivity_state.h"
namespace grpc_core { namespace grpc_core {

@ -40,7 +40,6 @@
#include "src/core/ext/filters/client_channel/client_channel_internal.h" #include "src/core/ext/filters/client_channel/client_channel_internal.h"
#include "src/core/load_balancing/child_policy_handler.h" #include "src/core/load_balancing/child_policy_handler.h"
#include "src/core/resolver/xds/xds_resolver_attributes.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h" #include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/trace.h" #include "src/core/lib/debug/trace.h"
@ -55,12 +54,13 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h" #include "src/core/resolver/xds/xds_resolver_attributes.h"
namespace grpc_core { namespace grpc_core {

@ -49,7 +49,6 @@
#include "src/core/ext/filters/client_channel/client_channel_internal.h" #include "src/core/ext/filters/client_channel/client_channel_internal.h"
#include "src/core/load_balancing/child_policy_handler.h" #include "src/core/load_balancing/child_policy_handler.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/ext/filters/stateful_session/stateful_session_filter.h" #include "src/core/ext/filters/stateful_session/stateful_session_filter.h"
#include "src/core/ext/xds/xds_health_status.h" #include "src/core/ext/xds/xds_health_status.h"
#include "src/core/lib/address_utils/parse_address.h" #include "src/core/lib/address_utils/parse_address.h"
@ -75,13 +74,14 @@
#include "src/core/lib/json/json.h" #include "src/core/lib/json/json.h"
#include "src/core/lib/json/json_args.h" #include "src/core/lib/json/json_args.h"
#include "src/core/lib/json/json_object_loader.h" #include "src/core/lib/json/json_object_loader.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/load_balancing/delegating_helper.h" #include "src/core/load_balancing/delegating_helper.h"
#include "src/core/load_balancing/lb_policy.h" #include "src/core/load_balancing/lb_policy.h"
#include "src/core/load_balancing/lb_policy_factory.h" #include "src/core/load_balancing/lb_policy_factory.h"
#include "src/core/load_balancing/lb_policy_registry.h" #include "src/core/load_balancing/lb_policy_registry.h"
#include "src/core/load_balancing/subchannel_interface.h" #include "src/core/load_balancing/subchannel_interface.h"
#include "src/core/resolver/endpoint_addresses.h" #include "src/core/resolver/endpoint_addresses.h"
#include "src/core/lib/transport/connectivity_state.h" #include "src/core/resolver/xds/xds_dependency_manager.h"
namespace grpc_core { namespace grpc_core {

@ -62,8 +62,6 @@
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#include "src/core/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/resolver/polling_resolver.h"
#include "src/core/lib/backoff/backoff.h" #include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/config_vars.h" #include "src/core/lib/config/config_vars.h"
@ -72,6 +70,8 @@
#include "src/core/lib/service_config/service_config_impl.h" #include "src/core/lib/service_config/service_config_impl.h"
#include "src/core/lib/transport/error_utils.h" #include "src/core/lib/transport/error_utils.h"
#include "src/core/load_balancing/grpclb/grpclb_balancer_addresses.h" #include "src/core/load_balancing/grpclb/grpclb_balancer_addresses.h"
#include "src/core/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/resolver/polling_resolver.h"
#define GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS 1 #define GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS 1
#define GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER 1.6 #define GRPC_DNS_RECONNECT_BACKOFF_MULTIPLIER 1.6

@ -38,8 +38,6 @@
#include <grpc/impl/channel_arg_names.h> #include <grpc/impl/channel_arg_names.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/resolver/dns/event_engine/service_config_helper.h"
#include "src/core/resolver/polling_resolver.h"
#include "src/core/lib/backoff/backoff.h" #include "src/core/lib/backoff/backoff.h"
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/debug/trace.h" #include "src/core/lib/debug/trace.h"
@ -51,12 +49,14 @@
#include "src/core/lib/gprpp/validation_errors.h" #include "src/core/lib/gprpp/validation_errors.h"
#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/resolver.h"
#include "src/core/resolver/resolver_factory.h"
#include "src/core/lib/service_config/service_config.h" #include "src/core/lib/service_config/service_config.h"
#include "src/core/lib/service_config/service_config_impl.h" #include "src/core/lib/service_config/service_config_impl.h"
#include "src/core/load_balancing/grpclb/grpclb_balancer_addresses.h" #include "src/core/load_balancing/grpclb/grpclb_balancer_addresses.h"
#include "src/core/resolver/dns/event_engine/service_config_helper.h"
#include "src/core/resolver/endpoint_addresses.h"
#include "src/core/resolver/polling_resolver.h"
#include "src/core/resolver/resolver.h"
#include "src/core/resolver/resolver_factory.h"
// IWYU pragma: no_include <ratio> // IWYU pragma: no_include <ratio>

@ -20,12 +20,12 @@
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
#include "src/core/resolver/fake/fake_resolver.h"
#include "src/core/resolver/xds/xds_resolver_trace.h"
#include "src/core/ext/xds/xds_routing.h" #include "src/core/ext/xds/xds_routing.h"
#include "src/core/lib/config/core_configuration.h" #include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/match.h" #include "src/core/lib/gprpp/match.h"
#include "src/core/load_balancing/xds/xds_channel_args.h" #include "src/core/load_balancing/xds/xds_channel_args.h"
#include "src/core/resolver/fake/fake_resolver.h"
#include "src/core/resolver/xds/xds_resolver_trace.h"
namespace grpc_core { namespace grpc_core {

@ -50,9 +50,6 @@
#include "src/core/ext/filters/client_channel/client_channel_internal.h" #include "src/core/ext/filters/client_channel/client_channel_internal.h"
#include "src/core/ext/filters/client_channel/config_selector.h" #include "src/core/ext/filters/client_channel/config_selector.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/resolver/xds/xds_resolver_attributes.h"
#include "src/core/resolver/xds/xds_resolver_trace.h"
#include "src/core/ext/xds/xds_bootstrap.h" #include "src/core/ext/xds/xds_bootstrap.h"
#include "src/core/ext/xds/xds_bootstrap_grpc.h" #include "src/core/ext/xds/xds_bootstrap_grpc.h"
#include "src/core/ext/xds/xds_client_grpc.h" #include "src/core/ext/xds/xds_client_grpc.h"
@ -93,6 +90,9 @@
#include "src/core/lib/transport/transport.h" #include "src/core/lib/transport/transport.h"
#include "src/core/lib/uri/uri_parser.h" #include "src/core/lib/uri/uri_parser.h"
#include "src/core/load_balancing/ring_hash/ring_hash.h" #include "src/core/load_balancing/ring_hash/ring_hash.h"
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include "src/core/resolver/xds/xds_resolver_attributes.h"
#include "src/core/resolver/xds/xds_resolver_trace.h"
namespace grpc_core { namespace grpc_core {

@ -130,13 +130,8 @@ CsmObservabilityBuilder::SetGenericMethodAttributeFilter(
} }
absl::StatusOr<CsmObservability> CsmObservabilityBuilder::BuildAndRegister() { absl::StatusOr<CsmObservability> CsmObservabilityBuilder::BuildAndRegister() {
builder_->SetServerSelector(internal::CsmServerSelector); builder_->AddPluginOption(
builder_->SetTargetSelector(internal::CsmChannelTargetSelector); std::make_unique<grpc::internal::CsmOpenTelemetryPluginOption>());
builder_->SetLabelsInjector(
std::make_unique<internal::ServiceMeshLabelsInjector>(
google::cloud::otel::MakeResourceDetector()
->Detect()
.GetAttributes()));
auto status = builder_->BuildAndRegisterGlobal(); auto status = builder_->BuildAndRegisterGlobal();
if (!status.ok()) { if (!status.ok()) {
return status; return status;

@ -49,7 +49,6 @@ inline opentelemetry::nostd::string_view AbslStrViewToOpenTelemetryStrView(
class KeyValueIterable : public opentelemetry::common::KeyValueIterable { class KeyValueIterable : public opentelemetry::common::KeyValueIterable {
public: public:
explicit KeyValueIterable( explicit KeyValueIterable(
LabelsIterable* injected_labels_iterable,
const std::vector<std::unique_ptr<LabelsIterable>>& const std::vector<std::unique_ptr<LabelsIterable>>&
injected_labels_from_plugin_options, injected_labels_from_plugin_options,
absl::Span<const std::pair<absl::string_view, absl::string_view>> absl::Span<const std::pair<absl::string_view, absl::string_view>>
@ -58,8 +57,7 @@ class KeyValueIterable : public opentelemetry::common::KeyValueIterable {
absl::Span<const std::shared_ptr<std::map<std::string, std::string>>> absl::Span<const std::shared_ptr<std::map<std::string, std::string>>>
optional_labels_span, optional_labels_span,
bool is_client) bool is_client)
: injected_labels_iterable_(injected_labels_iterable), : injected_labels_from_plugin_options_(
injected_labels_from_plugin_options_(
injected_labels_from_plugin_options), injected_labels_from_plugin_options),
additional_labels_(additional_labels), additional_labels_(additional_labels),
active_plugin_options_view_(active_plugin_options_view), active_plugin_options_view_(active_plugin_options_view),
@ -70,20 +68,6 @@ class KeyValueIterable : public opentelemetry::common::KeyValueIterable {
bool(opentelemetry::nostd::string_view, bool(opentelemetry::nostd::string_view,
opentelemetry::common::AttributeValue)> opentelemetry::common::AttributeValue)>
callback) const noexcept override { callback) const noexcept override {
if (injected_labels_iterable_ != nullptr) {
injected_labels_iterable_->ResetIteratorPosition();
while (const auto& pair = injected_labels_iterable_->Next()) {
if (!callback(AbslStrViewToOpenTelemetryStrView(pair->first),
AbslStrViewToOpenTelemetryStrView(pair->second))) {
return false;
}
}
}
if (OpenTelemetryPluginState().labels_injector != nullptr &&
!OpenTelemetryPluginState().labels_injector->AddOptionalLabels(
is_client_, optional_labels_, callback)) {
return false;
}
if (active_plugin_options_view_ != nullptr && if (active_plugin_options_view_ != nullptr &&
!active_plugin_options_view_->ForEach( !active_plugin_options_view_->ForEach(
[callback, this]( [callback, this](
@ -116,9 +100,7 @@ class KeyValueIterable : public opentelemetry::common::KeyValueIterable {
} }
size_t size() const noexcept override { size_t size() const noexcept override {
size_t size = injected_labels_iterable_ != nullptr size_t size = 0;
? injected_labels_iterable_->Size()
: 0;
for (const auto& plugin_option_injected_iterable : for (const auto& plugin_option_injected_iterable :
injected_labels_from_plugin_options_) { injected_labels_from_plugin_options_) {
if (plugin_option_injected_iterable != nullptr) { if (plugin_option_injected_iterable != nullptr) {
@ -126,10 +108,6 @@ class KeyValueIterable : public opentelemetry::common::KeyValueIterable {
} }
} }
size += additional_labels_.size(); size += additional_labels_.size();
if (OpenTelemetryPluginState().labels_injector != nullptr) {
size += OpenTelemetryPluginState().labels_injector->GetOptionalLabelsSize(
is_client_, optional_labels_);
}
if (active_plugin_options_view_ != nullptr) { if (active_plugin_options_view_ != nullptr) {
active_plugin_options_view_->ForEach( active_plugin_options_view_->ForEach(
[&size, this](const InternalOpenTelemetryPluginOption& plugin_option, [&size, this](const InternalOpenTelemetryPluginOption& plugin_option,
@ -143,7 +121,6 @@ class KeyValueIterable : public opentelemetry::common::KeyValueIterable {
} }
private: private:
LabelsIterable* injected_labels_iterable_;
const std::vector<std::unique_ptr<LabelsIterable>>& const std::vector<std::unique_ptr<LabelsIterable>>&
injected_labels_from_plugin_options_; injected_labels_from_plugin_options_;
absl::Span<const std::pair<absl::string_view, absl::string_view>> absl::Span<const std::pair<absl::string_view, absl::string_view>>

@ -131,19 +131,15 @@ OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer::
// We might not have all the injected labels that we want at this point, so // We might not have all the injected labels that we want at this point, so
// avoid recording a subset of injected labels here. // avoid recording a subset of injected labels here.
OpenTelemetryPluginState().client.attempt.started->Add( OpenTelemetryPluginState().client.attempt.started->Add(
1, KeyValueIterable( 1, KeyValueIterable(/*injected_labels_from_plugin_options=*/{},
/*injected_labels_iterable=*/nullptr, {}, additional_labels, additional_labels,
/*active_plugin_options_view=*/nullptr, /*active_plugin_options_view=*/nullptr,
/*optional_labels_span=*/{}, /*is_client=*/true)); /*optional_labels_span=*/{}, /*is_client=*/true));
} }
} }
void OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer:: void OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer::
RecordReceivedInitialMetadata(grpc_metadata_batch* recv_initial_metadata) { RecordReceivedInitialMetadata(grpc_metadata_batch* recv_initial_metadata) {
if (OpenTelemetryPluginState().labels_injector != nullptr) {
injected_labels_ = OpenTelemetryPluginState().labels_injector->GetLabels(
recv_initial_metadata);
}
parent_->parent_->active_plugin_options_view().ForEach( parent_->parent_->active_plugin_options_view().ForEach(
[&](const InternalOpenTelemetryPluginOption& plugin_option, [&](const InternalOpenTelemetryPluginOption& plugin_option,
size_t /*index*/) { size_t /*index*/) {
@ -158,10 +154,6 @@ void OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer::
void OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer:: void OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer::
RecordSendInitialMetadata(grpc_metadata_batch* send_initial_metadata) { RecordSendInitialMetadata(grpc_metadata_batch* send_initial_metadata) {
if (OpenTelemetryPluginState().labels_injector != nullptr) {
OpenTelemetryPluginState().labels_injector->AddLabels(send_initial_metadata,
nullptr);
}
parent_->parent_->active_plugin_options_view().ForEach( parent_->parent_->active_plugin_options_view().ForEach(
[&](const InternalOpenTelemetryPluginOption& plugin_option, [&](const InternalOpenTelemetryPluginOption& plugin_option,
size_t /*index*/) { size_t /*index*/) {
@ -210,10 +202,10 @@ void OpenTelemetryCallTracer::OpenTelemetryCallAttemptTracer::
{OpenTelemetryStatusKey(), {OpenTelemetryStatusKey(),
grpc_status_code_to_string( grpc_status_code_to_string(
static_cast<grpc_status_code>(status.code()))}}}; static_cast<grpc_status_code>(status.code()))}}};
KeyValueIterable labels( KeyValueIterable labels(injected_labels_from_plugin_options_,
injected_labels_.get(), injected_labels_from_plugin_options_, additional_labels,
additional_labels, &parent_->parent_->active_plugin_options_view(), &parent_->parent_->active_plugin_options_view(),
optional_labels_array_, /*is_client=*/true); optional_labels_array_, /*is_client=*/true);
if (OpenTelemetryPluginState().client.attempt.duration != nullptr) { if (OpenTelemetryPluginState().client.attempt.duration != nullptr) {
OpenTelemetryPluginState().client.attempt.duration->Record( OpenTelemetryPluginState().client.attempt.duration->Record(
absl::ToDoubleSeconds(absl::Now() - start_time_), labels, absl::ToDoubleSeconds(absl::Now() - start_time_), labels,

@ -116,13 +116,6 @@ OpenTelemetryPluginBuilderImpl::DisableAllMetrics() {
return *this; return *this;
} }
OpenTelemetryPluginBuilderImpl&
OpenTelemetryPluginBuilderImpl::SetLabelsInjector(
std::unique_ptr<LabelsInjector> labels_injector) {
labels_injector_ = std::move(labels_injector);
return *this;
}
OpenTelemetryPluginBuilderImpl& OpenTelemetryPluginBuilderImpl&
OpenTelemetryPluginBuilderImpl::SetTargetSelector( OpenTelemetryPluginBuilderImpl::SetTargetSelector(
absl::AnyInvocable<bool(absl::string_view /*target*/) const> absl::AnyInvocable<bool(absl::string_view /*target*/) const>
@ -243,7 +236,6 @@ absl::Status OpenTelemetryPluginBuilderImpl::BuildAndRegisterGlobal() {
kServerCallRcvdTotalCompressedMessageSizeInstrumentName), kServerCallRcvdTotalCompressedMessageSizeInstrumentName),
"Compressed message bytes received per server call", "By"); "Compressed message bytes received per server call", "By");
} }
g_otel_plugin_state_->labels_injector = std::move(labels_injector_);
g_otel_plugin_state_->target_attribute_filter = g_otel_plugin_state_->target_attribute_filter =
std::move(target_attribute_filter_); std::move(target_attribute_filter_);
g_otel_plugin_state_->server_selector = std::move(server_selector_); g_otel_plugin_state_->server_selector = std::move(server_selector_);

@ -135,7 +135,6 @@ struct OpenTelemetryPluginState {
} server; } server;
opentelemetry::nostd::shared_ptr<opentelemetry::metrics::MeterProvider> opentelemetry::nostd::shared_ptr<opentelemetry::metrics::MeterProvider>
meter_provider; meter_provider;
std::unique_ptr<LabelsInjector> labels_injector;
absl::AnyInvocable<bool(absl::string_view /*target*/) const> absl::AnyInvocable<bool(absl::string_view /*target*/) const>
target_attribute_filter; target_attribute_filter;
absl::AnyInvocable<bool(absl::string_view /*generic_method*/) const> absl::AnyInvocable<bool(absl::string_view /*generic_method*/) const>
@ -173,9 +172,6 @@ class OpenTelemetryPluginBuilderImpl {
OpenTelemetryPluginBuilderImpl& EnableMetric(absl::string_view metric_name); OpenTelemetryPluginBuilderImpl& EnableMetric(absl::string_view metric_name);
OpenTelemetryPluginBuilderImpl& DisableMetric(absl::string_view metric_name); OpenTelemetryPluginBuilderImpl& DisableMetric(absl::string_view metric_name);
OpenTelemetryPluginBuilderImpl& DisableAllMetrics(); OpenTelemetryPluginBuilderImpl& DisableAllMetrics();
// Allows setting a labels injector on calls traced through this plugin.
OpenTelemetryPluginBuilderImpl& SetLabelsInjector(
std::unique_ptr<LabelsInjector> labels_injector);
// If set, \a target_selector is called per channel to decide whether to // If set, \a target_selector is called per channel to decide whether to
// collect metrics on that target or not. // collect metrics on that target or not.
OpenTelemetryPluginBuilderImpl& SetTargetSelector( OpenTelemetryPluginBuilderImpl& SetTargetSelector(

@ -82,10 +82,6 @@ class OpenTelemetryServerCallTracer : public grpc_core::ServerCallTracer {
// arguments. // arguments.
void RecordSendInitialMetadata( void RecordSendInitialMetadata(
grpc_metadata_batch* send_initial_metadata) override { grpc_metadata_batch* send_initial_metadata) override {
if (OpenTelemetryPluginState().labels_injector != nullptr) {
OpenTelemetryPluginState().labels_injector->AddLabels(
send_initial_metadata, injected_labels_.get());
}
active_plugin_options_view_.ForEach( active_plugin_options_view_.ForEach(
[&](const InternalOpenTelemetryPluginOption& plugin_option, [&](const InternalOpenTelemetryPluginOption& plugin_option,
size_t index) { size_t index) {
@ -162,7 +158,6 @@ class OpenTelemetryServerCallTracer : public grpc_core::ServerCallTracer {
absl::Time start_time_; absl::Time start_time_;
absl::Duration elapsed_time_; absl::Duration elapsed_time_;
grpc_core::Slice path_; grpc_core::Slice path_;
std::unique_ptr<LabelsIterable> injected_labels_;
bool registered_method_; bool registered_method_;
ActivePluginOptionsView active_plugin_options_view_; ActivePluginOptionsView active_plugin_options_view_;
// TODO(yashykt): It's wasteful to do this per call. When we re-haul the stats // TODO(yashykt): It's wasteful to do this per call. When we re-haul the stats
@ -175,10 +170,6 @@ void OpenTelemetryServerCallTracer::RecordReceivedInitialMetadata(
grpc_metadata_batch* recv_initial_metadata) { grpc_metadata_batch* recv_initial_metadata) {
path_ = path_ =
recv_initial_metadata->get_pointer(grpc_core::HttpPathMetadata())->Ref(); recv_initial_metadata->get_pointer(grpc_core::HttpPathMetadata())->Ref();
if (OpenTelemetryPluginState().labels_injector != nullptr) {
injected_labels_ = OpenTelemetryPluginState().labels_injector->GetLabels(
recv_initial_metadata);
}
active_plugin_options_view_.ForEach( active_plugin_options_view_.ForEach(
[&](const InternalOpenTelemetryPluginOption& plugin_option, [&](const InternalOpenTelemetryPluginOption& plugin_option,
size_t index) { size_t index) {
@ -198,7 +189,7 @@ void OpenTelemetryServerCallTracer::RecordReceivedInitialMetadata(
// We might not have all the injected labels that we want at this point, so // We might not have all the injected labels that we want at this point, so
// avoid recording a subset of injected labels here. // avoid recording a subset of injected labels here.
OpenTelemetryPluginState().server.call.started->Add( OpenTelemetryPluginState().server.call.started->Add(
1, KeyValueIterable(/*injected_labels_iterable=*/nullptr, {}, 1, KeyValueIterable(/*injected_labels_from_plugin_options=*/{},
additional_labels, additional_labels,
/*active_plugin_options_view=*/nullptr, {}, /*active_plugin_options_view=*/nullptr, {},
/*is_client=*/false)); /*is_client=*/false));
@ -221,8 +212,7 @@ void OpenTelemetryServerCallTracer::RecordEnd(
grpc_status_code_to_string(final_info->final_status)}}}; grpc_status_code_to_string(final_info->final_status)}}};
// Currently we do not have any optional labels on the server side. // Currently we do not have any optional labels on the server side.
KeyValueIterable labels( KeyValueIterable labels(
injected_labels_.get(), injected_labels_from_plugin_options_, injected_labels_from_plugin_options_, additional_labels,
additional_labels,
/*active_plugin_options_view=*/nullptr, /*optional_labels_span=*/{}, /*active_plugin_options_view=*/nullptr, /*optional_labels_span=*/{},
/*is_client=*/false); /*is_client=*/false);
if (OpenTelemetryPluginState().server.call.duration != nullptr) { if (OpenTelemetryPluginState().server.call.duration != nullptr) {

@ -763,6 +763,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/surface/version.cc', 'src/core/lib/surface/version.cc',
'src/core/lib/transport/batch_builder.cc', 'src/core/lib/transport/batch_builder.cc',
'src/core/lib/transport/bdp_estimator.cc', 'src/core/lib/transport/bdp_estimator.cc',
'src/core/lib/transport/call_factory.cc',
'src/core/lib/transport/call_filters.cc', 'src/core/lib/transport/call_filters.cc',
'src/core/lib/transport/call_final_info.cc', 'src/core/lib/transport/call_final_info.cc',
'src/core/lib/transport/call_size_estimator.cc', 'src/core/lib/transport/call_size_estimator.cc',

@ -0,0 +1,23 @@
%YAML 1.2
--- |
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
<%include file="../../apt_get_basic.include"/>
<%include file="../../ruby_3_0_deps.include"/>
# Define the default command.
CMD ["bash"]

@ -0,0 +1,23 @@
%YAML 1.2
--- |
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
<%include file="../../apt_get_basic.include"/>
<%include file="../../ruby_3_1_deps.include"/>
# Define the default command.
CMD ["bash"]

@ -0,0 +1,23 @@
%YAML 1.2
--- |
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
<%include file="../../apt_get_basic.include"/>
<%include file="../../ruby_3_2_deps.include"/>
# Define the default command.
CMD ["bash"]

@ -0,0 +1,23 @@
%YAML 1.2
--- |
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
<%include file="../../apt_get_basic.include"/>
<%include file="../../ruby_3_3_deps.include"/>
# Define the default command.
CMD ["bash"]

@ -0,0 +1,16 @@
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.0
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.0.5"
RUN /bin/bash -l -c "rvm use --default ruby-3.0.5"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.0.5' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"

@ -0,0 +1,16 @@
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.1
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.1.3"
RUN /bin/bash -l -c "rvm use --default ruby-3.1.3"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.1.3' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"

@ -0,0 +1,16 @@
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.2
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.2.0"
RUN /bin/bash -l -c "rvm use --default ruby-3.2.0"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.2.0' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"

@ -0,0 +1,16 @@
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.3
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.3.0"
RUN /bin/bash -l -c "rvm use --default ruby-3.3.0"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.3.0' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"

@ -121,6 +121,33 @@ class TestScenario {
XdsBootstrapSource bootstrap_source_; XdsBootstrapSource bootstrap_source_;
}; };
// A PluginOption that injects `ServiceMeshLabelsInjector`. (This is different
// from CsmOpenTelemetryPluginOption since it does not restrict itself to just
// CSM channels and servers.)
class MeshLabelsPluginOption
: public grpc::internal::InternalOpenTelemetryPluginOption {
public:
explicit MeshLabelsPluginOption(
const opentelemetry::sdk::common::AttributeMap& map)
: labels_injector_(
std::make_unique<grpc::internal::ServiceMeshLabelsInjector>(map)) {}
bool IsActiveOnClientChannel(absl::string_view /*target*/) const override {
return true;
}
bool IsActiveOnServer(const grpc_core::ChannelArgs& /*args*/) const override {
return true;
}
const grpc::internal::LabelsInjector* labels_injector() const override {
return labels_injector_.get();
}
private:
std::unique_ptr<grpc::internal::ServiceMeshLabelsInjector> labels_injector_;
};
class MetadataExchangeTest class MetadataExchangeTest
: public OpenTelemetryPluginEnd2EndTest, : public OpenTelemetryPluginEnd2EndTest,
public ::testing::WithParamInterface<TestScenario> { public ::testing::WithParamInterface<TestScenario> {
@ -149,9 +176,8 @@ class MetadataExchangeTest
OpenTelemetryPluginEnd2EndTest::Init(std::move( OpenTelemetryPluginEnd2EndTest::Init(std::move(
Options() Options()
.set_metric_names(std::move(metric_names)) .set_metric_names(std::move(metric_names))
.set_labels_injector( .add_plugin_option(std::make_unique<MeshLabelsPluginOption>(
std::make_unique<grpc::internal::ServiceMeshLabelsInjector>( GetParam().GetTestResource().GetAttributes()))
GetParam().GetTestResource().GetAttributes()))
.set_labels_to_inject(std::move(labels_to_inject)) .set_labels_to_inject(std::move(labels_to_inject))
.set_target_selector( .set_target_selector(
[enable_client_side_injector](absl::string_view /*target*/) { [enable_client_side_injector](absl::string_view /*target*/) {

@ -775,19 +775,15 @@ class CustomPluginOption
}; };
TEST_F(OpenTelemetryPluginOptionEnd2EndTest, Basic) { TEST_F(OpenTelemetryPluginOptionEnd2EndTest, Basic) {
std::vector<
std::unique_ptr<grpc::internal::InternalOpenTelemetryPluginOption>>
plugin_option_list;
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ true,
std::make_pair("key", "value")));
Init( Init(
std::move(Options() std::move(Options()
.set_metric_names({grpc::OpenTelemetryPluginBuilder:: .set_metric_names({grpc::OpenTelemetryPluginBuilder::
kClientAttemptDurationInstrumentName, kClientAttemptDurationInstrumentName,
grpc::OpenTelemetryPluginBuilder:: grpc::OpenTelemetryPluginBuilder::
kServerCallDurationInstrumentName}) kServerCallDurationInstrumentName})
.set_plugin_options(std::move(plugin_option_list)))); .add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ true,
std::make_pair("key", "value")))));
SendRPC(); SendRPC();
auto data = ReadCurrentMetricsData( auto data = ReadCurrentMetricsData(
[&](const absl::flat_hash_map< [&](const absl::flat_hash_map<
@ -812,19 +808,15 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, Basic) {
} }
TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ClientOnlyPluginOption) { TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ClientOnlyPluginOption) {
std::vector<
std::unique_ptr<grpc::internal::InternalOpenTelemetryPluginOption>>
plugin_option_list;
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ false,
std::make_pair("key", "value")));
Init( Init(
std::move(Options() std::move(Options()
.set_metric_names({grpc::OpenTelemetryPluginBuilder:: .set_metric_names({grpc::OpenTelemetryPluginBuilder::
kClientAttemptDurationInstrumentName, kClientAttemptDurationInstrumentName,
grpc::OpenTelemetryPluginBuilder:: grpc::OpenTelemetryPluginBuilder::
kServerCallDurationInstrumentName}) kServerCallDurationInstrumentName})
.set_plugin_options(std::move(plugin_option_list)))); .add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ false,
std::make_pair("key", "value")))));
SendRPC(); SendRPC();
auto data = ReadCurrentMetricsData( auto data = ReadCurrentMetricsData(
[&](const absl::flat_hash_map< [&](const absl::flat_hash_map<
@ -850,19 +842,15 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ClientOnlyPluginOption) {
} }
TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ServerOnlyPluginOption) { TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ServerOnlyPluginOption) {
std::vector<
std::unique_ptr<grpc::internal::InternalOpenTelemetryPluginOption>>
plugin_option_list;
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ false, /*enabled_on_server*/ true,
std::make_pair("key", "value")));
Init( Init(
std::move(Options() std::move(Options()
.set_metric_names({grpc::OpenTelemetryPluginBuilder:: .set_metric_names({grpc::OpenTelemetryPluginBuilder::
kClientAttemptDurationInstrumentName, kClientAttemptDurationInstrumentName,
grpc::OpenTelemetryPluginBuilder:: grpc::OpenTelemetryPluginBuilder::
kServerCallDurationInstrumentName}) kServerCallDurationInstrumentName})
.set_plugin_options(std::move(plugin_option_list)))); .add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ false, /*enabled_on_server*/ true,
std::make_pair("key", "value")))));
SendRPC(); SendRPC();
auto data = ReadCurrentMetricsData( auto data = ReadCurrentMetricsData(
[&](const absl::flat_hash_map< [&](const absl::flat_hash_map<
@ -889,32 +877,27 @@ TEST_F(OpenTelemetryPluginOptionEnd2EndTest, ServerOnlyPluginOption) {
TEST_F(OpenTelemetryPluginOptionEnd2EndTest, TEST_F(OpenTelemetryPluginOptionEnd2EndTest,
MultipleEnabledAndDisabledPluginOptions) { MultipleEnabledAndDisabledPluginOptions) {
std::vector<
std::unique_ptr<grpc::internal::InternalOpenTelemetryPluginOption>>
plugin_option_list;
plugin_option_list.reserve(5);
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ true,
std::make_pair("key1", "value1")));
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ false,
std::make_pair("key2", "value2")));
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ false,
std::make_pair("key3", "value3")));
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ false, /*enabled_on_server*/ true,
std::make_pair("key4", "value4")));
plugin_option_list.emplace_back(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ false, /*enabled_on_server*/ true,
std::make_pair("key5", "value5")));
Init( Init(
std::move(Options() std::move(Options()
.set_metric_names({grpc::OpenTelemetryPluginBuilder:: .set_metric_names({grpc::OpenTelemetryPluginBuilder::
kClientAttemptDurationInstrumentName, kClientAttemptDurationInstrumentName,
grpc::OpenTelemetryPluginBuilder:: grpc::OpenTelemetryPluginBuilder::
kServerCallDurationInstrumentName}) kServerCallDurationInstrumentName})
.set_plugin_options(std::move(plugin_option_list)))); .add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ true,
std::make_pair("key1", "value1")))
.add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ false,
std::make_pair("key2", "value2")))
.add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ true, /*enabled_on_server*/ false,
std::make_pair("key3", "value3")))
.add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ false, /*enabled_on_server*/ true,
std::make_pair("key4", "value4")))
.add_plugin_option(std::make_unique<CustomPluginOption>(
/*enabled_on_client*/ false, /*enabled_on_server*/ true,
std::make_pair("key5", "value5")))));
SendRPC(); SendRPC();
auto data = ReadCurrentMetricsData( auto data = ReadCurrentMetricsData(
[&](const absl::flat_hash_map< [&](const absl::flat_hash_map<

@ -105,7 +105,6 @@ void OpenTelemetryPluginEnd2EndTest::Init(Options config) {
meter_provider->AddMetricReader(reader_); meter_provider->AddMetricReader(reader_);
ot_builder.SetMeterProvider(std::move(meter_provider)); ot_builder.SetMeterProvider(std::move(meter_provider));
} }
ot_builder.SetLabelsInjector(std::move(config.labels_injector));
ot_builder.SetTargetSelector(std::move(config.target_selector)); ot_builder.SetTargetSelector(std::move(config.target_selector));
ot_builder.SetServerSelector(std::move(config.server_selector)); ot_builder.SetServerSelector(std::move(config.server_selector));
ot_builder.SetTargetAttributeFilter( ot_builder.SetTargetAttributeFilter(

@ -68,12 +68,6 @@ class OpenTelemetryPluginEnd2EndTest : public ::testing::Test {
return *this; return *this;
} }
Options& set_labels_injector(
std::unique_ptr<grpc::internal::LabelsInjector> injector) {
labels_injector = std::move(injector);
return *this;
}
Options& set_use_meter_provider(bool flag) { Options& set_use_meter_provider(bool flag) {
use_meter_provider = flag; use_meter_provider = flag;
return *this; return *this;
@ -111,11 +105,10 @@ class OpenTelemetryPluginEnd2EndTest : public ::testing::Test {
return *this; return *this;
} }
Options& set_plugin_options( Options& add_plugin_option(
std::vector< std::unique_ptr<grpc::internal::InternalOpenTelemetryPluginOption>
std::unique_ptr<grpc::internal::InternalOpenTelemetryPluginOption>> option) {
options) { plugin_options.push_back(std::move(option));
plugin_options = std::move(options);
return *this; return *this;
} }

@ -29,8 +29,15 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Bazel
run: |
echo "BAZEL=bazel" >> $GITHUB_ENV
echo "USE_BAZEL_VERSION=5.1.1" >> $GITHUB_ENV
- name: Setup Bazel (macOS)
if: runner.os == 'macOS'
run: echo "BAZEL=bazelisk" >> $GITHUB_ENV
- name: Install dependencies - name: Install dependencies
run: sudo apt update && sudo apt install -y ${{ matrix.install }} run: sudo apt update && sudo apt install -y ${{ matrix.install }}
if: matrix.install != '' if: matrix.install != ''
- name: Run tests - name: Run tests
run: cd ${{ github.workspace }} && CC=${{ matrix.CC }} bazel test --test_output=errors ... ${{ matrix.flags }} run: cd ${{ github.workspace }} && CC=${{ matrix.CC }} ${{ env.BAZEL }} test --test_output=errors ... ${{ matrix.flags }}

@ -4,6 +4,12 @@
# license that can be found in the LICENSE file or at # license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT. # https://opensource.org/licenses/MIT.
DEFAULT_VISIBILITY = [
"//third_party/protobuf:__subpackages__",
"//:__subpackages__",
"//util/utf8/internal:__subpackages__",
]
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
licenses(["notice"]) licenses(["notice"])
@ -21,6 +27,7 @@ filegroup(
], ],
visibility = [ visibility = [
"@com_google_protobuf//:__subpackages__", "@com_google_protobuf//:__subpackages__",
"@upb//:__subpackages__",
], ],
) )

@ -73,6 +73,11 @@ if (utf8_range_ENABLE_INSTALL)
install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" install(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
) )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/utf8_range.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/utf8_range.pc @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/utf8_range.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
# Install public headers explicitly. # Install public headers explicitly.
install(FILES utf8_range.h utf8_validity.h install(FILES utf8_range.h utf8_validity.h

@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Name: UTF8 Range
Description: Google's UTF8 Library
Version: 1.0
Requires: absl_strings
Libs: -L${libdir} -lutf8_validity -lutf8_range @CMAKE_THREAD_LIBS_INIT@
Cflags: -I${includedir}

@ -133,6 +133,7 @@ size_t ValidUTF8Span(const char* data, const char* end) {
return err_pos + (1 - ReturnPosition); return err_pos + (1 - ReturnPosition);
} }
#ifdef __SSE4_1__
/* Returns the number of bytes needed to skip backwards to get to the first /* Returns the number of bytes needed to skip backwards to get to the first
byte of codepoint. byte of codepoint.
*/ */
@ -148,6 +149,7 @@ inline int CodepointSkipBackwards(int32_t codepoint_word) {
} }
return 0; return 0;
} }
#endif // __SSE4_1__
/* Skipping over ASCII as much as possible, per 8 bytes. It is intentional /* Skipping over ASCII as much as possible, per 8 bytes. It is intentional
as most strings to check for validity consist only of 1 byte codepoints. as most strings to check for validity consist only of 1 byte codepoints.

@ -57,7 +57,10 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/distribtest/ruby_centos7_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_centos7_x64@sha256:4d529b984b78ca179086f7f9b416605e2d9a96ca0a28a71f4421bb5ffdc18f96", "tools/dockerfile/distribtest/ruby_centos7_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_centos7_x64@sha256:4d529b984b78ca179086f7f9b416605e2d9a96ca0a28a71f4421bb5ffdc18f96",
"tools/dockerfile/distribtest/ruby_debian10_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64@sha256:1298c39c950b2a48261555b6cff1ae66230a5020f100d3b381759285f0caf84e", "tools/dockerfile/distribtest/ruby_debian10_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64@sha256:1298c39c950b2a48261555b6cff1ae66230a5020f100d3b381759285f0caf84e",
"tools/dockerfile/distribtest/ruby_debian10_x64_ruby_2_7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_2_7@sha256:5ee26ad3abe2683c9a8ee03987ab0ae63f50793c3d3f5e4be6e6cbacb4556fcf", "tools/dockerfile/distribtest/ruby_debian10_x64_ruby_2_7.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_2_7@sha256:5ee26ad3abe2683c9a8ee03987ab0ae63f50793c3d3f5e4be6e6cbacb4556fcf",
"tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_0.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_0@sha256:9190da90a2a95eca1370cef64dcba7ddee9f59cc7487093da6711c1280a0b0f9", "tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_0.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_0@sha256:be9dfa852af7fe5c700747bbad5b93d15c3f030ac980a107e98fc9b70fee6077",
"tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_1.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_1@sha256:282a052275fa9e0378301d759f5febcc9f1ff0ebb702e536690cd4fed1a43904",
"tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_2.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_2@sha256:f1ba9030d7d7496a6ed42c0e1a9a2fe3204208e94983d7d4b6b4c7752042ed28",
"tools/dockerfile/distribtest/ruby_debian10_x64_ruby_3_3.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_3@sha256:a26d6bfe8f799ae817db0bd0280283c2cc9ea0f02174fe9a2cb0cd10d71d81f8",
"tools/dockerfile/distribtest/ruby_ubuntu2004_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_ubuntu2004_x64@sha256:426cbf625df0c0e7451b9716041996dc6a35a3788c1a24d68891256f84733d8e", "tools/dockerfile/distribtest/ruby_ubuntu2004_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_ubuntu2004_x64@sha256:426cbf625df0c0e7451b9716041996dc6a35a3788c1a24d68891256f84733d8e",
"tools/dockerfile/distribtest/ruby_ubuntu2204_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_ubuntu2204_x64@sha256:1c74c312f8a4ab37e629732a35daa3056e12136b90f37540cdf9fa11303c7eb8", "tools/dockerfile/distribtest/ruby_ubuntu2204_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_ubuntu2204_x64@sha256:1c74c312f8a4ab37e629732a35daa3056e12136b90f37540cdf9fa11303c7eb8",
"tools/dockerfile/grpc_artifact_centos6_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_centos6_x64@sha256:3285047265ea2b7c5d4df4c769b2d05f56288d947c75e16d27ae2dee693f791b", "tools/dockerfile/grpc_artifact_centos6_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/grpc_artifact_centos6_x64@sha256:3285047265ea2b7c5d4df4c769b2d05f56288d947c75e16d27ae2dee693f791b",

@ -99,11 +99,13 @@ EXTERNAL_PROTO_LIBRARIES = {
# For that we need mapping from external repo name to a corresponding # For that we need mapping from external repo name to a corresponding
# path to a git submodule. # path to a git submodule.
EXTERNAL_SOURCE_PREFIXES = { EXTERNAL_SOURCE_PREFIXES = {
"@utf8_range": "third_party/utf8_range", # TODO(veblush): Remove @utf8_range// item once protobuf is upgraded to 26.x
"@com_googlesource_code_re2": "third_party/re2", "@utf8_range//": "third_party/utf8_range",
"@com_google_googletest": "third_party/googletest", "@com_googlesource_code_re2//": "third_party/re2",
"@com_google_protobuf": "third_party/upb", "@com_google_googletest//": "third_party/googletest",
"@zlib": "third_party/zlib", "@com_google_protobuf//upb": "third_party/upb/upb",
"@com_google_protobuf//third_party/utf8_range": "third_party/utf8_range",
"@zlib//": "third_party/zlib",
} }
@ -209,9 +211,9 @@ def _try_extract_source_file_path(label: str) -> str:
# This is an external source file. We are only interested in sources # This is an external source file. We are only interested in sources
# for some of the external libraries. # for some of the external libraries.
for lib_name, prefix in EXTERNAL_SOURCE_PREFIXES.items(): for lib_name, prefix in EXTERNAL_SOURCE_PREFIXES.items():
if label.startswith(lib_name + "//"): if label.startswith(lib_name):
return ( return (
label.replace("%s//" % lib_name, prefix + "/") label.replace("%s" % lib_name, prefix)
.replace(":", "/") .replace(":", "/")
.replace("//", "/") .replace("//", "/")
) )
@ -1100,7 +1102,7 @@ _BUILD_EXTRA_METADATA = {
"build": "all", "build": "all",
"_RENAME": "upb_textformat_lib", "_RENAME": "upb_textformat_lib",
}, },
"@utf8_range//:utf8_range": { "@com_google_protobuf//third_party/utf8_range:utf8_range": {
"language": "c", "language": "c",
"build": "all", "build": "all",
# rename to utf8_range_lib is necessary for now to avoid clash with utf8_range target in protobuf's cmake # rename to utf8_range_lib is necessary for now to avoid clash with utf8_range target in protobuf's cmake
@ -1400,6 +1402,15 @@ tests = _exclude_unwanted_cc_tests(_extract_cc_tests(bazel_rules))
# only very little "extra metadata" would be needed and/or it would be trivial # only very little "extra metadata" would be needed and/or it would be trivial
# to generate it automatically. # to generate it automatically.
all_extra_metadata = {} all_extra_metadata = {}
# TODO(veblush): Remove this workaround once protobuf is upgraded to 26.x
if "@com_google_protobuf//third_party/utf8_range:utf8_range" not in bazel_rules:
md = _BUILD_EXTRA_METADATA[
"@com_google_protobuf//third_party/utf8_range:utf8_range"
]
del _BUILD_EXTRA_METADATA[
"@com_google_protobuf//third_party/utf8_range:utf8_range"
]
_BUILD_EXTRA_METADATA["@utf8_range//:utf8_range"] = md
all_extra_metadata.update(_BUILD_EXTRA_METADATA) all_extra_metadata.update(_BUILD_EXTRA_METADATA)
all_extra_metadata.update( all_extra_metadata.update(
_generate_build_extra_metadata_for_tests(tests, bazel_rules) _generate_build_extra_metadata_for_tests(tests, bazel_rules)

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_0:c277dbca7dbd28ff6112cbc842ba3144c49266bd@sha256:9190da90a2a95eca1370cef64dcba7ddee9f59cc7487093da6711c1280a0b0f9 us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_0:dce91a018316b35b962e5fa576fded4775457077@sha256:be9dfa852af7fe5c700747bbad5b93d15c3f030ac980a107e98fc9b70fee6077

@ -1,4 +1,4 @@
# Copyright 2020 gRPC authors. # Copyright 2024 gRPC authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -14,29 +14,71 @@
FROM debian:10 FROM debian:10
# Install Git and basic packages. #=================
# Basic C core dependencies
# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
libtool \
pkg-config \
&& apt-get clean
# GCC
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& apt-get clean
# libc6
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
gnupg2 \ libc6 \
procps \ libc6-dbg \
libc6-dev \
&& apt-get clean
# Tools
RUN apt-get update && apt-get install -y \
bzip2 \
curl \ curl \
gcc && apt-get clean dnsutils \
git \
lcov \
make \
strace \
time \
unzip \
wget \
zip \
&& apt-get clean
#=================
# Setup git to access working directory across docker boundary.
# This avoids the "fatal: detected dubious ownership in repository XYZ"
# git error.
RUN git config --global --add safe.directory '*'
RUN git config --global protocol.file.allow always
#================== #==================
# Ruby dependencies # Ruby dependencies
# Install rvm # Install rvm
RUN gpg2 --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.0 # Install Ruby 3.0
RUN /bin/bash -l -c "rvm install ruby-3.0.0" RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm use --default ruby-3.0.0" RUN /bin/bash -l -c "rvm install ruby-3.0.5"
RUN /bin/bash -l -c "rvm use --default ruby-3.0.5"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc" RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.0.0' >> ~/.bashrc" RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.0.5' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document" RUN /bin/bash -l -c "gem install bundler --no-document"
RUN mkdir /var/local/jenkins
# Define the default command. # Define the default command.
CMD ["bash"] CMD ["bash"]

@ -0,0 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_1:348a4b975f4d19772bb9a1a95fc03720f89edbc0@sha256:282a052275fa9e0378301d759f5febcc9f1ff0ebb702e536690cd4fed1a43904

@ -0,0 +1,84 @@
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
#=================
# Basic C core dependencies
# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
libtool \
pkg-config \
&& apt-get clean
# GCC
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& apt-get clean
# libc6
RUN apt-get update && apt-get install -y \
libc6 \
libc6-dbg \
libc6-dev \
&& apt-get clean
# Tools
RUN apt-get update && apt-get install -y \
bzip2 \
curl \
dnsutils \
git \
lcov \
make \
strace \
time \
unzip \
wget \
zip \
&& apt-get clean
#=================
# Setup git to access working directory across docker boundary.
# This avoids the "fatal: detected dubious ownership in repository XYZ"
# git error.
RUN git config --global --add safe.directory '*'
RUN git config --global protocol.file.allow always
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.1
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.1.3"
RUN /bin/bash -l -c "rvm use --default ruby-3.1.3"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.1.3' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"
# Define the default command.
CMD ["bash"]

@ -0,0 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_2:e9f8640c6bb80a029c65ed6ebdfddd9574a041e4@sha256:f1ba9030d7d7496a6ed42c0e1a9a2fe3204208e94983d7d4b6b4c7752042ed28

@ -0,0 +1,84 @@
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
#=================
# Basic C core dependencies
# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
libtool \
pkg-config \
&& apt-get clean
# GCC
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& apt-get clean
# libc6
RUN apt-get update && apt-get install -y \
libc6 \
libc6-dbg \
libc6-dev \
&& apt-get clean
# Tools
RUN apt-get update && apt-get install -y \
bzip2 \
curl \
dnsutils \
git \
lcov \
make \
strace \
time \
unzip \
wget \
zip \
&& apt-get clean
#=================
# Setup git to access working directory across docker boundary.
# This avoids the "fatal: detected dubious ownership in repository XYZ"
# git error.
RUN git config --global --add safe.directory '*'
RUN git config --global protocol.file.allow always
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.2
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.2.0"
RUN /bin/bash -l -c "rvm use --default ruby-3.2.0"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.2.0' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"
# Define the default command.
CMD ["bash"]

@ -0,0 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian10_x64_ruby_3_3:c063f13c0987355593ce6bcf2123bb9717eeba35@sha256:a26d6bfe8f799ae817db0bd0280283c2cc9ea0f02174fe9a2cb0cd10d71d81f8

@ -0,0 +1,84 @@
# Copyright 2024 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM debian:10
#=================
# Basic C core dependencies
# C/C++ dependencies according to https://github.com/grpc/grpc/blob/master/BUILDING.md
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
libtool \
pkg-config \
&& apt-get clean
# GCC
RUN apt-get update && apt-get install -y \
gcc \
g++ \
&& apt-get clean
# libc6
RUN apt-get update && apt-get install -y \
libc6 \
libc6-dbg \
libc6-dev \
&& apt-get clean
# Tools
RUN apt-get update && apt-get install -y \
bzip2 \
curl \
dnsutils \
git \
lcov \
make \
strace \
time \
unzip \
wget \
zip \
&& apt-get clean
#=================
# Setup git to access working directory across docker boundary.
# This avoids the "fatal: detected dubious ownership in repository XYZ"
# git error.
RUN git config --global --add safe.directory '*'
RUN git config --global protocol.file.allow always
#==================
# Ruby dependencies
# Install rvm
RUN apt-get update && apt-get install -y gnupg2 && apt-get clean
RUN gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
RUN \curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.3
RUN apt-get update && apt-get install -y procps && apt-get clean
RUN /bin/bash -l -c "rvm install ruby-3.3.0"
RUN /bin/bash -l -c "rvm use --default ruby-3.3.0"
RUN /bin/bash -l -c "echo 'gem: --no-document' > ~/.gemrc"
RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
RUN /bin/bash -l -c "echo 'rvm --default use ruby-3.3.0' >> ~/.bashrc"
RUN /bin/bash -l -c "gem install bundler --no-document"
# Define the default command.
CMD ["bash"]

@ -52,6 +52,7 @@ do
-and -not -name grpc_tls_credentials_options_comparator_test.cc \ -and -not -name grpc_tls_credentials_options_comparator_test.cc \
-and -not -path '*/cmake/build/*' \ -and -not -path '*/cmake/build/*' \
-and -not -path '*/third_party/*' \ -and -not -path '*/third_party/*' \
-and -not -path '*/src/python/grpcio_observability/grpc_root/*' \
`" `"
done done
done done

@ -2811,6 +2811,8 @@ src/core/lib/transport/batch_builder.cc \
src/core/lib/transport/batch_builder.h \ src/core/lib/transport/batch_builder.h \
src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \ src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/call_factory.cc \
src/core/lib/transport/call_factory.h \
src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.cc \
src/core/lib/transport/call_filters.h \ src/core/lib/transport/call_filters.h \
src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.cc \

@ -2588,6 +2588,8 @@ src/core/lib/transport/batch_builder.cc \
src/core/lib/transport/batch_builder.h \ src/core/lib/transport/batch_builder.h \
src/core/lib/transport/bdp_estimator.cc \ src/core/lib/transport/bdp_estimator.cc \
src/core/lib/transport/bdp_estimator.h \ src/core/lib/transport/bdp_estimator.h \
src/core/lib/transport/call_factory.cc \
src/core/lib/transport/call_factory.h \
src/core/lib/transport/call_filters.cc \ src/core/lib/transport/call_filters.cc \
src/core/lib/transport/call_filters.h \ src/core/lib/transport/call_filters.h \
src/core/lib/transport/call_final_info.cc \ src/core/lib/transport/call_final_info.cc \

@ -130,6 +130,7 @@ LANG_RELEASE_MATRIX = {
("v1.57.0", ReleaseInfo()), ("v1.57.0", ReleaseInfo()),
("v1.58.0", ReleaseInfo()), ("v1.58.0", ReleaseInfo()),
("v1.60.0", ReleaseInfo()), ("v1.60.0", ReleaseInfo()),
("v1.61.0", ReleaseInfo()),
] ]
), ),
"go": OrderedDict( "go": OrderedDict(
@ -764,6 +765,12 @@ LANG_RELEASE_MATRIX = {
runtimes=["python"], testcases_file="python__master" runtimes=["python"], testcases_file="python__master"
), ),
), ),
(
"v1.61.0",
ReleaseInfo(
runtimes=["python"], testcases_file="python__master"
),
),
] ]
), ),
"node": OrderedDict( "node": OrderedDict(
@ -858,6 +865,7 @@ LANG_RELEASE_MATRIX = {
("v1.57.0", ReleaseInfo()), ("v1.57.0", ReleaseInfo()),
("v1.58.0", ReleaseInfo()), ("v1.58.0", ReleaseInfo()),
("v1.60.0", ReleaseInfo()), ("v1.60.0", ReleaseInfo()),
("v1.61.0", ReleaseInfo()),
] ]
), ),
"php": OrderedDict( "php": OrderedDict(
@ -916,6 +924,7 @@ LANG_RELEASE_MATRIX = {
("v1.57.0", ReleaseInfo()), ("v1.57.0", ReleaseInfo()),
("v1.58.0", ReleaseInfo()), ("v1.58.0", ReleaseInfo()),
("v1.60.0", ReleaseInfo()), ("v1.60.0", ReleaseInfo()),
("v1.61.0", ReleaseInfo()),
] ]
), ),
"csharp": OrderedDict( "csharp": OrderedDict(

@ -476,6 +476,15 @@ def targets():
RubyDistribTest( RubyDistribTest(
"linux", "x64", "debian10", ruby_version="ruby_3_0", presubmit=True "linux", "x64", "debian10", ruby_version="ruby_3_0", presubmit=True
), ),
RubyDistribTest(
"linux", "x64", "debian10", ruby_version="ruby_3_1", presubmit=True
),
RubyDistribTest(
"linux", "x64", "debian10", ruby_version="ruby_3_2", presubmit=True
),
RubyDistribTest(
"linux", "x64", "debian10", ruby_version="ruby_3_3", presubmit=True
),
RubyDistribTest("linux", "x64", "centos7"), RubyDistribTest("linux", "x64", "centos7"),
RubyDistribTest("linux", "x64", "ubuntu2004"), RubyDistribTest("linux", "x64", "ubuntu2004"),
RubyDistribTest("linux", "x64", "ubuntu2204", presubmit=True), RubyDistribTest("linux", "x64", "ubuntu2204", presubmit=True),

Loading…
Cancel
Save