Merge github.com:grpc/grpc into rq

pull/36967/head
Craig Tiller 5 months ago
commit 4e76af9bda
  1. 1
      BUILD
  2. 6
      examples/cpp/route_guide/route_guide_callback_client.cc
  3. 1
      src/core/BUILD
  4. 4
      src/core/client_channel/client_channel_filter.cc
  5. 4
      src/core/client_channel/dynamic_filters.cc
  6. 2
      src/core/client_channel/retry_filter.cc
  7. 4
      src/core/client_channel/subchannel.cc
  8. 3
      src/core/ext/filters/backend_metrics/backend_metric_filter.cc
  9. 2
      src/core/ext/filters/backend_metrics/backend_metric_filter.h
  10. 6
      src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc
  11. 4
      src/core/ext/filters/channel_idle/legacy_channel_idle_filter.h
  12. 3
      src/core/ext/filters/fault_injection/fault_injection_filter.cc
  13. 2
      src/core/ext/filters/fault_injection/fault_injection_filter.h
  14. 2
      src/core/ext/filters/http/client/http_client_filter.cc
  15. 2
      src/core/ext/filters/http/client/http_client_filter.h
  16. 3
      src/core/ext/filters/http/client_authority_filter.cc
  17. 2
      src/core/ext/filters/http/client_authority_filter.h
  18. 4
      src/core/ext/filters/http/message_compress/compression_filter.cc
  19. 5
      src/core/ext/filters/http/message_compress/compression_filter.h
  20. 2
      src/core/ext/filters/http/server/http_server_filter.cc
  21. 2
      src/core/ext/filters/http/server/http_server_filter.h
  22. 4
      src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
  23. 2
      src/core/ext/filters/load_reporting/server_load_reporting_filter.h
  24. 4
      src/core/ext/filters/logging/logging_filter.cc
  25. 4
      src/core/ext/filters/logging/logging_filter.h
  26. 4
      src/core/ext/filters/message_size/message_size_filter.cc
  27. 4
      src/core/ext/filters/message_size/message_size_filter.h
  28. 2
      src/core/ext/filters/rbac/rbac_filter.cc
  29. 2
      src/core/ext/filters/rbac/rbac_filter.h
  30. 3
      src/core/ext/filters/stateful_session/stateful_session_filter.cc
  31. 2
      src/core/ext/filters/stateful_session/stateful_session_filter.h
  32. 11
      src/core/lib/channel/channel_stack.cc
  33. 14
      src/core/lib/channel/channel_stack.h
  34. 4
      src/core/lib/channel/connected_channel.cc
  35. 4
      src/core/lib/channel/promise_based_filter.cc
  36. 8
      src/core/lib/channel/promise_based_filter.h
  37. 23
      src/core/lib/gprpp/unique_type_name.h
  38. 3
      src/core/lib/security/authorization/grpc_server_authz_filter.cc
  39. 2
      src/core/lib/security/authorization/grpc_server_authz_filter.h
  40. 4
      src/core/lib/security/transport/auth_filters.h
  41. 3
      src/core/lib/security/transport/client_auth_filter.cc
  42. 3
      src/core/lib/security/transport/server_auth_filter.cc
  43. 27
      src/core/lib/surface/channel_init.cc
  44. 3
      src/core/lib/surface/channel_init.h
  45. 4
      src/core/lib/surface/filter_stack_call.cc
  46. 2
      src/core/lib/surface/lame_client.cc
  47. 2
      src/core/lib/surface/lame_client.h
  48. 3
      src/core/load_balancing/grpclb/client_load_reporting_filter.cc
  49. 2
      src/core/load_balancing/grpclb/client_load_reporting_filter.h
  50. 5
      src/core/resolver/xds/xds_resolver.cc
  51. 2
      src/core/server/server.cc
  52. 5
      src/core/server/server_call_tracer_filter.cc
  53. 8
      src/core/server/server_config_selector_filter.cc
  54. 2
      src/core/server/xds_channel_stack_modifier.cc
  55. 5
      src/core/service_config/service_config_channel_arg_filter.cc
  56. 3
      src/cpp/ext/filters/census/client_filter.cc
  57. 2
      src/cpp/ext/filters/census/client_filter.h
  58. 22
      test/core/channel/channel_stack_builder_test.cc
  59. 2
      test/core/channel/channel_stack_test.cc
  60. 4
      test/core/channel/minimal_stack_is_minimal_test.cc
  61. 4
      test/core/end2end/tests/filter_causes_close.cc
  62. 2
      test/core/end2end/tests/filter_init_fails.cc
  63. 2
      test/core/end2end/tests/retry_cancel_with_multiple_send_batches.cc
  64. 3
      test/core/end2end/tests/retry_recv_message_replay.cc
  65. 2
      test/core/end2end/tests/retry_recv_trailing_metadata_error.cc
  66. 2
      test/core/end2end/tests/retry_send_op_fails.cc
  67. 3
      test/core/end2end/tests/retry_transparent_goaway.cc
  68. 3
      test/core/end2end/tests/retry_transparent_not_sent_on_wire.cc
  69. 20
      test/core/gprpp/unique_type_name_test.cc
  70. 11
      test/core/server/xds_channel_stack_modifier_test.cc
  71. 18
      test/core/surface/channel_init_test.cc
  72. 6
      test/core/surface/secure_channel_create_test.cc
  73. 5
      test/core/test_util/fake_stats_plugin.cc
  74. 2
      test/core/transport/chttp2/streams_not_seen_test.cc
  75. 5
      test/cpp/ext/otel/otel_test_library.cc
  76. 1
      tools/distrib/check_namespace_qualification.py
  77. 1
      tools/release/verify_python_release.py

@ -2116,6 +2116,7 @@ grpc_cc_library(
"//src/core:time", "//src/core:time",
"//src/core:transport_fwd", "//src/core:transport_fwd",
"//src/core:try_seq", "//src/core:try_seq",
"//src/core:unique_type_name",
"//src/core:useful", "//src/core:useful",
], ],
) )

@ -243,7 +243,11 @@ class RouteGuideClient {
StartRead(&server_note_); StartRead(&server_note_);
StartCall(); StartCall();
} }
void OnWriteDone(bool /*ok*/) override { NextWrite(); } void OnWriteDone(bool ok) override {
if (ok) {
NextWrite();
}
}
void OnReadDone(bool ok) override { void OnReadDone(bool ok) override {
if (ok) { if (ok) {
std::cout << "Got message " << server_note_.message() << " at " std::cout << "Got message " << server_note_.message() << " at "

@ -3073,6 +3073,7 @@ grpc_cc_library(
"channel_fwd", "channel_fwd",
"channel_stack_type", "channel_stack_type",
"interception_chain", "interception_chain",
"unique_type_name",
"//:channel_stack_builder", "//:channel_stack_builder",
"//:debug_location", "//:debug_location",
"//:gpr", "//:gpr",

@ -316,7 +316,7 @@ const grpc_channel_filter ClientChannelFilter::kFilter = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
ClientChannelFilter::Destroy, ClientChannelFilter::Destroy,
ClientChannelFilter::GetChannelInfo, ClientChannelFilter::GetChannelInfo,
"client-channel", GRPC_UNIQUE_TYPE_NAME_HERE("client-channel"),
}; };
// //
@ -443,7 +443,7 @@ const grpc_channel_filter DynamicTerminationFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
DynamicTerminationFilter::Destroy, DynamicTerminationFilter::Destroy,
DynamicTerminationFilter::GetChannelInfo, DynamicTerminationFilter::GetChannelInfo,
"dynamic_filter_termination", GRPC_UNIQUE_TYPE_NAME_HERE("dynamic_filter_termination"),
}; };
} // namespace } // namespace

@ -78,7 +78,9 @@ void DynamicFilters::Call::StartTransportStreamOpBatch(
grpc_transport_stream_op_batch* batch) { grpc_transport_stream_op_batch* batch) {
grpc_call_stack* call_stack = CALL_TO_CALL_STACK(this); grpc_call_stack* call_stack = CALL_TO_CALL_STACK(this);
grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0); grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0);
GRPC_CALL_LOG_OP(GPR_INFO, top_elem, batch); GRPC_TRACE_LOG(channel, INFO)
<< "OP[" << top_elem->filter->name << ":" << top_elem
<< "]: " << grpc_transport_stream_op_batch_string(batch, false);
top_elem->filter->start_transport_stream_op_batch(top_elem, batch); top_elem->filter->start_transport_stream_op_batch(top_elem, batch);
} }

@ -147,7 +147,7 @@ const grpc_channel_filter RetryFilter::kVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
RetryFilter::Destroy, RetryFilter::Destroy,
RetryFilter::GetChannelInfo, RetryFilter::GetChannelInfo,
"retry_filter", GRPC_UNIQUE_TYPE_NAME_HERE("retry_filter"),
}; };
} // namespace grpc_core } // namespace grpc_core

@ -270,7 +270,9 @@ void SubchannelCall::StartTransportStreamOpBatch(
MaybeInterceptRecvTrailingMetadata(batch); MaybeInterceptRecvTrailingMetadata(batch);
grpc_call_stack* call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(this); grpc_call_stack* call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(this);
grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0); grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0);
GRPC_CALL_LOG_OP(GPR_INFO, top_elem, batch); GRPC_TRACE_LOG(channel, INFO)
<< "OP[" << top_elem->filter->name << ":" << top_elem
<< "]: " << grpc_transport_stream_op_batch_string(batch, false);
top_elem->filter->start_transport_stream_op_batch(top_elem, batch); top_elem->filter->start_transport_stream_op_batch(top_elem, batch);
} }

@ -117,8 +117,7 @@ absl::optional<std::string> MaybeSerializeBackendMetrics(
} // namespace } // namespace
const grpc_channel_filter BackendMetricFilter::kFilter = const grpc_channel_filter BackendMetricFilter::kFilter =
MakePromiseBasedFilter<BackendMetricFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<BackendMetricFilter, FilterEndpoint::kServer>();
"backend_metric");
absl::StatusOr<std::unique_ptr<BackendMetricFilter>> absl::StatusOr<std::unique_ptr<BackendMetricFilter>>
BackendMetricFilter::Create(const ChannelArgs&, ChannelFilter::Args) { BackendMetricFilter::Create(const ChannelArgs&, ChannelFilter::Args) {

@ -35,6 +35,8 @@ class BackendMetricFilter : public ImplementChannelFilter<BackendMetricFilter> {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "backend_metric"; }
static absl::StatusOr<std::unique_ptr<BackendMetricFilter>> Create( static absl::StatusOr<std::unique_ptr<BackendMetricFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args); const ChannelArgs& args, ChannelFilter::Args);

@ -289,11 +289,9 @@ void LegacyChannelIdleFilter::CloseChannel() {
} }
const grpc_channel_filter LegacyClientIdleFilter::kFilter = const grpc_channel_filter LegacyClientIdleFilter::kFilter =
MakePromiseBasedFilter<LegacyClientIdleFilter, FilterEndpoint::kClient>( MakePromiseBasedFilter<LegacyClientIdleFilter, FilterEndpoint::kClient>();
"client_idle");
const grpc_channel_filter LegacyMaxAgeFilter::kFilter = const grpc_channel_filter LegacyMaxAgeFilter::kFilter =
MakePromiseBasedFilter<LegacyMaxAgeFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<LegacyMaxAgeFilter, FilterEndpoint::kServer>();
"max_age");
void RegisterLegacyChannelIdleFilters(CoreConfiguration::Builder* builder) { void RegisterLegacyChannelIdleFilters(CoreConfiguration::Builder* builder) {
builder->channel_init() builder->channel_init()

@ -96,6 +96,8 @@ class LegacyClientIdleFilter final : public LegacyChannelIdleFilter {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "client_idle"; }
static absl::StatusOr<std::unique_ptr<LegacyClientIdleFilter>> Create( static absl::StatusOr<std::unique_ptr<LegacyClientIdleFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);
@ -107,6 +109,8 @@ class LegacyMaxAgeFilter final : public LegacyChannelIdleFilter {
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
struct Config; struct Config;
static absl::string_view TypeName() { return "max_age"; }
static absl::StatusOr<std::unique_ptr<LegacyMaxAgeFilter>> Create( static absl::StatusOr<std::unique_ptr<LegacyMaxAgeFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -270,8 +270,7 @@ std::string FaultInjectionFilter::InjectionDecision::ToString() const {
} }
const grpc_channel_filter FaultInjectionFilter::kFilter = const grpc_channel_filter FaultInjectionFilter::kFilter =
MakePromiseBasedFilter<FaultInjectionFilter, FilterEndpoint::kClient>( MakePromiseBasedFilter<FaultInjectionFilter, FilterEndpoint::kClient>();
"fault_injection_filter");
void FaultInjectionFilterRegister(CoreConfiguration::Builder* builder) { void FaultInjectionFilterRegister(CoreConfiguration::Builder* builder) {
FaultInjectionServiceConfigParser::Register(builder); FaultInjectionServiceConfigParser::Register(builder);

@ -45,6 +45,8 @@ class FaultInjectionFilter
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "fault_injection_filter"; }
static absl::StatusOr<std::unique_ptr<FaultInjectionFilter>> Create( static absl::StatusOr<std::unique_ptr<FaultInjectionFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -59,7 +59,7 @@ const NoInterceptor HttpClientFilter::Call::OnFinalize;
const grpc_channel_filter HttpClientFilter::kFilter = const grpc_channel_filter HttpClientFilter::kFilter =
MakePromiseBasedFilter<HttpClientFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<HttpClientFilter, FilterEndpoint::kClient,
kFilterExaminesServerInitialMetadata>("http-client"); kFilterExaminesServerInitialMetadata>();
namespace { namespace {
absl::Status CheckServerMetadata(ServerMetadata* b) { absl::Status CheckServerMetadata(ServerMetadata* b) {

@ -35,6 +35,8 @@ class HttpClientFilter : public ImplementChannelFilter<HttpClientFilter> {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "http-client"; }
static absl::StatusOr<std::unique_ptr<HttpClientFilter>> Create( static absl::StatusOr<std::unique_ptr<HttpClientFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -66,8 +66,7 @@ void ClientAuthorityFilter::Call::OnClientInitialMetadata(
} }
const grpc_channel_filter ClientAuthorityFilter::kFilter = const grpc_channel_filter ClientAuthorityFilter::kFilter =
MakePromiseBasedFilter<ClientAuthorityFilter, FilterEndpoint::kClient>( MakePromiseBasedFilter<ClientAuthorityFilter, FilterEndpoint::kClient>();
"authority");
namespace { namespace {
bool NeedsClientAuthorityFilter(const ChannelArgs& args) { bool NeedsClientAuthorityFilter(const ChannelArgs& args) {

@ -39,6 +39,8 @@ class ClientAuthorityFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "authority"; }
static absl::StatusOr<std::unique_ptr<ClientAuthorityFilter>> Create( static absl::StatusOr<std::unique_ptr<ClientAuthorityFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args); const ChannelArgs& args, ChannelFilter::Args);

@ -66,12 +66,12 @@ const grpc_channel_filter ClientCompressionFilter::kFilter =
MakePromiseBasedFilter<ClientCompressionFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<ClientCompressionFilter, FilterEndpoint::kClient,
kFilterExaminesServerInitialMetadata | kFilterExaminesServerInitialMetadata |
kFilterExaminesInboundMessages | kFilterExaminesInboundMessages |
kFilterExaminesOutboundMessages>("compression"); kFilterExaminesOutboundMessages>();
const grpc_channel_filter ServerCompressionFilter::kFilter = const grpc_channel_filter ServerCompressionFilter::kFilter =
MakePromiseBasedFilter<ServerCompressionFilter, FilterEndpoint::kServer, MakePromiseBasedFilter<ServerCompressionFilter, FilterEndpoint::kServer,
kFilterExaminesServerInitialMetadata | kFilterExaminesServerInitialMetadata |
kFilterExaminesInboundMessages | kFilterExaminesInboundMessages |
kFilterExaminesOutboundMessages>("compression"); kFilterExaminesOutboundMessages>();
absl::StatusOr<std::unique_ptr<ClientCompressionFilter>> absl::StatusOr<std::unique_ptr<ClientCompressionFilter>>
ClientCompressionFilter::Create(const ChannelArgs& args, ChannelFilter::Args) { ClientCompressionFilter::Create(const ChannelArgs& args, ChannelFilter::Args) {

@ -25,6 +25,7 @@
#include <stdint.h> #include <stdint.h>
#include "absl/status/statusor.h" #include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include <grpc/impl/compression_types.h> #include <grpc/impl/compression_types.h>
@ -110,6 +111,8 @@ class ClientCompressionFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "compression"; }
static absl::StatusOr<std::unique_ptr<ClientCompressionFilter>> Create( static absl::StatusOr<std::unique_ptr<ClientCompressionFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);
@ -147,6 +150,8 @@ class ServerCompressionFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "compression"; }
static absl::StatusOr<std::unique_ptr<ServerCompressionFilter>> Create( static absl::StatusOr<std::unique_ptr<ServerCompressionFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -55,7 +55,7 @@ const NoInterceptor HttpServerFilter::Call::OnFinalize;
const grpc_channel_filter HttpServerFilter::kFilter = const grpc_channel_filter HttpServerFilter::kFilter =
MakePromiseBasedFilter<HttpServerFilter, FilterEndpoint::kServer, MakePromiseBasedFilter<HttpServerFilter, FilterEndpoint::kServer,
kFilterExaminesServerInitialMetadata>("http-server"); kFilterExaminesServerInitialMetadata>();
namespace { namespace {
void FilterOutgoingMetadata(ServerMetadata* md) { void FilterOutgoingMetadata(ServerMetadata* md) {

@ -36,6 +36,8 @@ class HttpServerFilter : public ImplementChannelFilter<HttpServerFilter> {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "http-server"; }
static absl::StatusOr<std::unique_ptr<HttpServerFilter>> Create( static absl::StatusOr<std::unique_ptr<HttpServerFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -247,8 +247,8 @@ void ServerLoadReportingFilter::Call::OnFinalize(
} }
const grpc_channel_filter ServerLoadReportingFilter::kFilter = const grpc_channel_filter ServerLoadReportingFilter::kFilter =
MakePromiseBasedFilter<ServerLoadReportingFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<ServerLoadReportingFilter,
"server_load_reporting"); FilterEndpoint::kServer>();
// TODO(juanlishen): We should register the filter during grpc initialization // TODO(juanlishen): We should register the filter during grpc initialization
// time once OpenCensus is compatible with our build system. For now, we force // time once OpenCensus is compatible with our build system. For now, we force

@ -39,6 +39,8 @@ class ServerLoadReportingFilter
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "server_load_reporting"; }
static absl::StatusOr<std::unique_ptr<ServerLoadReportingFilter>> Create( static absl::StatusOr<std::unique_ptr<ServerLoadReportingFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args); const ChannelArgs& args, ChannelFilter::Args);

@ -417,7 +417,7 @@ const grpc_channel_filter ClientLoggingFilter::kFilter =
MakePromiseBasedFilter<ClientLoggingFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<ClientLoggingFilter, FilterEndpoint::kClient,
kFilterExaminesServerInitialMetadata | kFilterExaminesServerInitialMetadata |
kFilterExaminesInboundMessages | kFilterExaminesInboundMessages |
kFilterExaminesOutboundMessages>("logging"); kFilterExaminesOutboundMessages>();
absl::StatusOr<std::unique_ptr<ServerLoggingFilter>> absl::StatusOr<std::unique_ptr<ServerLoggingFilter>>
ServerLoggingFilter::Create(const ChannelArgs& /*args*/, ServerLoggingFilter::Create(const ChannelArgs& /*args*/,
@ -483,7 +483,7 @@ const grpc_channel_filter ServerLoggingFilter::kFilter =
MakePromiseBasedFilter<ServerLoggingFilter, FilterEndpoint::kServer, MakePromiseBasedFilter<ServerLoggingFilter, FilterEndpoint::kServer,
kFilterExaminesServerInitialMetadata | kFilterExaminesServerInitialMetadata |
kFilterExaminesInboundMessages | kFilterExaminesInboundMessages |
kFilterExaminesOutboundMessages>("logging"); kFilterExaminesOutboundMessages>();
void RegisterLoggingFilter(LoggingSink* sink) { void RegisterLoggingFilter(LoggingSink* sink) {
g_logging_sink = sink; g_logging_sink = sink;

@ -78,6 +78,8 @@ class ClientLoggingFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "logging"; }
static absl::StatusOr<std::unique_ptr<ClientLoggingFilter>> Create( static absl::StatusOr<std::unique_ptr<ClientLoggingFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args /*filter_args*/); const ChannelArgs& args, ChannelFilter::Args /*filter_args*/);
@ -108,6 +110,8 @@ class ServerLoggingFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "logging"; }
static absl::StatusOr<std::unique_ptr<ServerLoggingFilter>> Create( static absl::StatusOr<std::unique_ptr<ServerLoggingFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args /*filter_args*/); const ChannelArgs& args, ChannelFilter::Args /*filter_args*/);

@ -137,12 +137,12 @@ size_t MessageSizeParser::ParserIndex() {
const grpc_channel_filter ClientMessageSizeFilter::kFilter = const grpc_channel_filter ClientMessageSizeFilter::kFilter =
MakePromiseBasedFilter<ClientMessageSizeFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<ClientMessageSizeFilter, FilterEndpoint::kClient,
kFilterExaminesOutboundMessages | kFilterExaminesOutboundMessages |
kFilterExaminesInboundMessages>("message_size"); kFilterExaminesInboundMessages>();
const grpc_channel_filter ServerMessageSizeFilter::kFilter = const grpc_channel_filter ServerMessageSizeFilter::kFilter =
MakePromiseBasedFilter<ServerMessageSizeFilter, FilterEndpoint::kServer, MakePromiseBasedFilter<ServerMessageSizeFilter, FilterEndpoint::kServer,
kFilterExaminesOutboundMessages | kFilterExaminesOutboundMessages |
kFilterExaminesInboundMessages>("message_size"); kFilterExaminesInboundMessages>();
absl::StatusOr<std::unique_ptr<ClientMessageSizeFilter>> absl::StatusOr<std::unique_ptr<ClientMessageSizeFilter>>
ClientMessageSizeFilter::Create(const ChannelArgs& args, ChannelFilter::Args) { ClientMessageSizeFilter::Create(const ChannelArgs& args, ChannelFilter::Args) {

@ -89,6 +89,8 @@ class ServerMessageSizeFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "message_size"; }
static absl::StatusOr<std::unique_ptr<ServerMessageSizeFilter>> Create( static absl::StatusOr<std::unique_ptr<ServerMessageSizeFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);
@ -117,6 +119,8 @@ class ClientMessageSizeFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "message_size"; }
static absl::StatusOr<std::unique_ptr<ClientMessageSizeFilter>> Create( static absl::StatusOr<std::unique_ptr<ClientMessageSizeFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -71,7 +71,7 @@ absl::Status RbacFilter::Call::OnClientInitialMetadata(ClientMetadata& md,
} }
const grpc_channel_filter RbacFilter::kFilterVtable = const grpc_channel_filter RbacFilter::kFilterVtable =
MakePromiseBasedFilter<RbacFilter, FilterEndpoint::kServer>("rbac_filter"); MakePromiseBasedFilter<RbacFilter, FilterEndpoint::kServer>();
RbacFilter::RbacFilter(size_t index, RbacFilter::RbacFilter(size_t index,
EvaluateArgs::PerChannelArgs per_channel_evaluate_args) EvaluateArgs::PerChannelArgs per_channel_evaluate_args)

@ -42,6 +42,8 @@ class RbacFilter : public ImplementChannelFilter<RbacFilter> {
// and enforces the RBAC policy. // and enforces the RBAC policy.
static const grpc_channel_filter kFilterVtable; static const grpc_channel_filter kFilterVtable;
static absl::string_view TypeName() { return "rbac_filter"; }
static absl::StatusOr<std::unique_ptr<RbacFilter>> Create( static absl::StatusOr<std::unique_ptr<RbacFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -69,8 +69,7 @@ UniqueTypeName XdsOverrideHostAttribute::TypeName() {
const grpc_channel_filter StatefulSessionFilter::kFilter = const grpc_channel_filter StatefulSessionFilter::kFilter =
MakePromiseBasedFilter<StatefulSessionFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<StatefulSessionFilter, FilterEndpoint::kClient,
kFilterExaminesServerInitialMetadata>( kFilterExaminesServerInitialMetadata>();
"stateful_session_filter");
absl::StatusOr<std::unique_ptr<StatefulSessionFilter>> absl::StatusOr<std::unique_ptr<StatefulSessionFilter>>
StatefulSessionFilter::Create(const ChannelArgs&, StatefulSessionFilter::Create(const ChannelArgs&,

@ -74,6 +74,8 @@ class StatefulSessionFilter
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "stateful_session_filter"; }
static absl::StatusOr<std::unique_ptr<StatefulSessionFilter>> Create( static absl::StatusOr<std::unique_ptr<StatefulSessionFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args filter_args); const ChannelArgs& args, ChannelFilter::Args filter_args);

@ -262,7 +262,9 @@ void grpc_call_stack_destroy(grpc_call_stack* stack,
void grpc_call_next_op(grpc_call_element* elem, void grpc_call_next_op(grpc_call_element* elem,
grpc_transport_stream_op_batch* op) { grpc_transport_stream_op_batch* op) {
grpc_call_element* next_elem = elem + 1; grpc_call_element* next_elem = elem + 1;
GRPC_CALL_LOG_OP(GPR_INFO, next_elem, op); GRPC_TRACE_LOG(channel, INFO)
<< "OP[" << elem->filter->name << ":" << elem
<< "]: " << grpc_transport_stream_op_batch_string(op, false);
next_elem->filter->start_transport_stream_op_batch(next_elem, op); next_elem->filter->start_transport_stream_op_batch(next_elem, op);
} }
@ -292,10 +294,3 @@ grpc_call_stack* grpc_call_stack_from_top_element(grpc_call_element* elem) {
void grpc_channel_stack_no_post_init(grpc_channel_stack*, void grpc_channel_stack_no_post_init(grpc_channel_stack*,
grpc_channel_element*) {} grpc_channel_element*) {}
void grpc_call_log_op(const char* file, int line, gpr_log_severity severity,
grpc_call_element* elem,
grpc_transport_stream_op_batch* op) {
gpr_log(file, line, severity, "OP[%s:%p]: %s", elem->filter->name, elem,
grpc_transport_stream_op_batch_string(op, false).c_str());
}

@ -63,6 +63,7 @@
#include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/unique_type_name.h"
#include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
@ -159,7 +160,7 @@ struct grpc_channel_filter {
const grpc_channel_info* channel_info); const grpc_channel_info* channel_info);
// The name of this filter // The name of this filter
const char* name; grpc_core::UniqueTypeName name;
}; };
// A channel_element tracks its filter and the filter requested memory within // A channel_element tracks its filter and the filter requested memory within
// a channel allocation // a channel allocation
@ -357,18 +358,7 @@ grpc_channel_stack* grpc_channel_stack_from_top_element(
// Given the top element of a call stack, get the call stack itself // Given the top element of a call stack, get the call stack itself
grpc_call_stack* grpc_call_stack_from_top_element(grpc_call_element* elem); grpc_call_stack* grpc_call_stack_from_top_element(grpc_call_element* elem);
void grpc_call_log_op(const char* file, int line, gpr_log_severity severity,
grpc_call_element* elem,
grpc_transport_stream_op_batch* op);
void grpc_channel_stack_no_post_init(grpc_channel_stack* stk, void grpc_channel_stack_no_post_init(grpc_channel_stack* stk,
grpc_channel_element* elem); grpc_channel_element* elem);
#define GRPC_CALL_LOG_OP(sev, elem, op) \
do { \
if (GRPC_TRACE_FLAG_ENABLED(channel)) { \
grpc_call_log_op(sev, elem, op); \
} \
} while (0)
#endif // GRPC_SRC_CORE_LIB_CHANNEL_CHANNEL_STACK_H #endif // GRPC_SRC_CORE_LIB_CHANNEL_CHANNEL_STACK_H

@ -267,7 +267,7 @@ const grpc_channel_filter kConnectedFilter{
}, },
connected_channel_destroy_channel_elem, connected_channel_destroy_channel_elem,
connected_channel_get_channel_info, connected_channel_get_channel_info,
"connected", GRPC_UNIQUE_TYPE_NAME_HERE("connected"),
}; };
// noop filter for the v3 stack: placeholder for now because other code requires // noop filter for the v3 stack: placeholder for now because other code requires
@ -288,7 +288,7 @@ const grpc_channel_filter kPromiseBasedTransportFilter = {
+[](grpc_channel_stack*, grpc_channel_element*) {}, +[](grpc_channel_stack*, grpc_channel_element*) {},
connected_channel_destroy_channel_elem, connected_channel_destroy_channel_elem,
connected_channel_get_channel_info, connected_channel_get_channel_info,
"connected", GRPC_UNIQUE_TYPE_NAME_HERE("connected"),
}; };
bool TransportSupportsClientPromiseBasedCalls(const ChannelArgs& args) { bool TransportSupportsClientPromiseBasedCalls(const ChannelArgs& args) {

@ -1316,7 +1316,7 @@ ClientCallData::~ClientCallData() {
} }
std::string ClientCallData::DebugTag() const { std::string ClientCallData::DebugTag() const {
return absl::StrFormat("PBF_CLIENT[%p]: [%s] ", this, elem()->filter->name); return absl::StrFormat("PBF_CLIENT[%p]: [%v] ", this, elem()->filter->name);
} }
// Activity implementation. // Activity implementation.
@ -2012,7 +2012,7 @@ ServerCallData::~ServerCallData() {
} }
std::string ServerCallData::DebugTag() const { std::string ServerCallData::DebugTag() const {
return absl::StrFormat("PBF_SERVER[%p]: [%s] ", this, elem()->filter->name); return absl::StrFormat("PBF_SERVER[%p]: [%v] ", this, elem()->filter->name);
} }
// Activity implementation. // Activity implementation.

@ -1659,7 +1659,7 @@ template <typename F, FilterEndpoint kEndpoint, uint8_t kFlags = 0>
absl::enable_if_t<std::is_base_of<ChannelFilter, F>::value && absl::enable_if_t<std::is_base_of<ChannelFilter, F>::value &&
!std::is_base_of<ImplementChannelFilterTag, F>::value, !std::is_base_of<ImplementChannelFilterTag, F>::value,
grpc_channel_filter> grpc_channel_filter>
MakePromiseBasedFilter(const char* name) { MakePromiseBasedFilter() {
using CallData = promise_filter_detail::CallData<kEndpoint>; using CallData = promise_filter_detail::CallData<kEndpoint>;
return grpc_channel_filter{ return grpc_channel_filter{
@ -1690,14 +1690,14 @@ MakePromiseBasedFilter(const char* name) {
// get_channel_info // get_channel_info
promise_filter_detail::ChannelFilterMethods::GetChannelInfo, promise_filter_detail::ChannelFilterMethods::GetChannelInfo,
// name // name
name, UniqueTypeNameFor<F>(),
}; };
} }
template <typename F, FilterEndpoint kEndpoint, uint8_t kFlags = 0> template <typename F, FilterEndpoint kEndpoint, uint8_t kFlags = 0>
absl::enable_if_t<std::is_base_of<ImplementChannelFilterTag, F>::value, absl::enable_if_t<std::is_base_of<ImplementChannelFilterTag, F>::value,
grpc_channel_filter> grpc_channel_filter>
MakePromiseBasedFilter(const char* name) { MakePromiseBasedFilter() {
using CallData = promise_filter_detail::CallData<kEndpoint>; using CallData = promise_filter_detail::CallData<kEndpoint>;
return grpc_channel_filter{ return grpc_channel_filter{
@ -1728,7 +1728,7 @@ MakePromiseBasedFilter(const char* name) {
// get_channel_info // get_channel_info
promise_filter_detail::ChannelFilterMethods::GetChannelInfo, promise_filter_detail::ChannelFilterMethods::GetChannelInfo,
// name // name
name, UniqueTypeNameFor<F>(),
}; };
} }

@ -64,7 +64,7 @@ class UniqueTypeName {
Factory(const Factory&) = delete; Factory(const Factory&) = delete;
Factory& operator=(const Factory&) = delete; Factory& operator=(const Factory&) = delete;
UniqueTypeName Create() { return UniqueTypeName(*name_); } UniqueTypeName Create() const { return UniqueTypeName(*name_); }
private: private:
std::string* name_; std::string* name_;
@ -93,12 +93,33 @@ class UniqueTypeName {
absl::string_view name() const { return name_; } absl::string_view name() const { return name_; }
template <typename Sink>
friend void AbslStringify(Sink& sink, const UniqueTypeName& name) {
sink.Append(name.name_);
}
private: private:
explicit UniqueTypeName(absl::string_view name) : name_(name) {} explicit UniqueTypeName(absl::string_view name) : name_(name) {}
absl::string_view name_; absl::string_view name_;
}; };
// Given a type with a member `static absl::string_view TypeName()`, returns a
// UniqueTypeName instance who's string value is the value of TypeName.
template <typename T>
UniqueTypeName UniqueTypeNameFor() {
static UniqueTypeName::Factory factory(T::TypeName());
return factory.Create();
}
} // namespace grpc_core } // namespace grpc_core
// Creates a one-off UniqueTypeName in-place.
// Duplicate calls yield different UniqueTypeName instances.
#define GRPC_UNIQUE_TYPE_NAME_HERE(name) \
([] { \
static const ::grpc_core::UniqueTypeName::Factory factory((name)); \
return factory.Create(); \
}())
#endif // GRPC_SRC_CORE_LIB_GPRPP_UNIQUE_TYPE_NAME_H #endif // GRPC_SRC_CORE_LIB_GPRPP_UNIQUE_TYPE_NAME_H

@ -114,7 +114,6 @@ absl::Status GrpcServerAuthzFilter::Call::OnClientInitialMetadata(
} }
const grpc_channel_filter GrpcServerAuthzFilter::kFilter = const grpc_channel_filter GrpcServerAuthzFilter::kFilter =
MakePromiseBasedFilter<GrpcServerAuthzFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<GrpcServerAuthzFilter, FilterEndpoint::kServer>();
"grpc-server-authz");
} // namespace grpc_core } // namespace grpc_core

@ -37,6 +37,8 @@ class GrpcServerAuthzFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "grpc-server-authz"; }
static absl::StatusOr<std::unique_ptr<GrpcServerAuthzFilter>> Create( static absl::StatusOr<std::unique_ptr<GrpcServerAuthzFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args); const ChannelArgs& args, ChannelFilter::Args);

@ -43,6 +43,8 @@ class ClientAuthFilter final : public ChannelFilter {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "client-auth-filter"; }
ClientAuthFilter( ClientAuthFilter(
RefCountedPtr<grpc_channel_security_connector> security_connector, RefCountedPtr<grpc_channel_security_connector> security_connector,
RefCountedPtr<grpc_auth_context> auth_context); RefCountedPtr<grpc_auth_context> auth_context);
@ -96,6 +98,8 @@ class ServerAuthFilter final : public ImplementChannelFilter<ServerAuthFilter> {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "server-auth"; }
ServerAuthFilter(RefCountedPtr<grpc_server_credentials> server_credentials, ServerAuthFilter(RefCountedPtr<grpc_server_credentials> server_credentials,
RefCountedPtr<grpc_auth_context> auth_context); RefCountedPtr<grpc_auth_context> auth_context);

@ -216,7 +216,6 @@ absl::StatusOr<std::unique_ptr<ClientAuthFilter>> ClientAuthFilter::Create(
} }
const grpc_channel_filter ClientAuthFilter::kFilter = const grpc_channel_filter ClientAuthFilter::kFilter =
MakePromiseBasedFilter<ClientAuthFilter, FilterEndpoint::kClient>( MakePromiseBasedFilter<ClientAuthFilter, FilterEndpoint::kClient>();
"client-auth-filter");
} // namespace grpc_core } // namespace grpc_core

@ -62,8 +62,7 @@
namespace grpc_core { namespace grpc_core {
const grpc_channel_filter ServerAuthFilter::kFilter = const grpc_channel_filter ServerAuthFilter::kFilter =
MakePromiseBasedFilter<ServerAuthFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<ServerAuthFilter, FilterEndpoint::kServer>();
"server-auth");
const NoInterceptor ServerAuthFilter::Call::OnClientToServerMessage; const NoInterceptor ServerAuthFilter::Call::OnClientToServerMessage;
const NoInterceptor ServerAuthFilter::Call::OnClientToServerHalfClose; const NoInterceptor ServerAuthFilter::Call::OnClientToServerHalfClose;

@ -43,13 +43,15 @@
namespace grpc_core { namespace grpc_core {
const char* (*NameFromChannelFilter)(const grpc_channel_filter*); UniqueTypeName (*NameFromChannelFilter)(const grpc_channel_filter*);
namespace { namespace {
struct CompareChannelFiltersByName { struct CompareChannelFiltersByName {
bool operator()(const grpc_channel_filter* a, bool operator()(const grpc_channel_filter* a,
const grpc_channel_filter* b) const { const grpc_channel_filter* b) const {
return strcmp(NameFromChannelFilter(a), NameFromChannelFilter(b)) < 0; // Compare lexicographically instead of by pointer value so that different
// builds make the same choices.
return NameFromChannelFilter(a).name() < NameFromChannelFilter(b).name();
} }
}; };
} // namespace } // namespace
@ -260,8 +262,8 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
auto add_loc_str = [&max_loc_str_len, &loc_strs, &filter_to_registration, auto add_loc_str = [&max_loc_str_len, &loc_strs, &filter_to_registration,
&max_filter_name_len]( &max_filter_name_len](
const grpc_channel_filter* filter) { const grpc_channel_filter* filter) {
max_filter_name_len = max_filter_name_len = std::max(
std::max(strlen(NameFromChannelFilter(filter)), max_filter_name_len); NameFromChannelFilter(filter).name().length(), max_filter_name_len);
const auto registration = const auto registration =
filter_to_registration[filter]->registration_source_; filter_to_registration[filter]->registration_source_;
absl::string_view file = registration.file(); absl::string_view file = registration.file();
@ -300,14 +302,16 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
std::string after_str; std::string after_str;
if (dep_it != original.end() && !dep_it->second.empty()) { if (dep_it != original.end() && !dep_it->second.empty()) {
after_str = absl::StrCat( after_str = absl::StrCat(
std::string(max_filter_name_len + 1 - std::string(
strlen(NameFromChannelFilter(filter.filter)), max_filter_name_len + 1 -
' '), NameFromChannelFilter(filter.filter).name().length(),
' '),
"after ", "after ",
absl::StrJoin( absl::StrJoin(
dep_it->second, ", ", dep_it->second, ", ",
[](std::string* out, const grpc_channel_filter* filter) { [](std::string* out, const grpc_channel_filter* filter) {
out->append(NameFromChannelFilter(filter)); out->append(
std::string(NameFromChannelFilter(filter).name()));
})); }));
} }
const auto filter_str = const auto filter_str =
@ -321,9 +325,10 @@ ChannelInit::StackConfig ChannelInit::BuildStackConfig(
const auto filter_str = absl::StrCat( const auto filter_str = absl::StrCat(
" ", loc_strs[terminal.filter], " ", loc_strs[terminal.filter],
NameFromChannelFilter(terminal.filter), NameFromChannelFilter(terminal.filter),
std::string(max_filter_name_len + 1 - std::string(
strlen(NameFromChannelFilter(terminal.filter)), max_filter_name_len + 1 -
' '), NameFromChannelFilter(terminal.filter).name().length(),
' '),
"[terminal]"); "[terminal]");
LOG(INFO) << filter_str; LOG(INFO) << filter_str;
} }

@ -36,6 +36,7 @@
#include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_fwd.h"
#include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/channel/channel_stack_builder.h"
#include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/unique_type_name.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_filters.h" #include "src/core/lib/transport/call_filters.h"
#include "src/core/lib/transport/interception_chain.h" #include "src/core/lib/transport/interception_chain.h"
@ -61,7 +62,7 @@ namespace grpc_core {
// TODO(ctiller): remove this. When we define a FilterFactory type, that type // TODO(ctiller): remove this. When we define a FilterFactory type, that type
// can be specified with the right constraints to be depended upon by this code, // can be specified with the right constraints to be depended upon by this code,
// and that type can export a `string_view Name()` method. // and that type can export a `string_view Name()` method.
extern const char* (*NameFromChannelFilter)(const grpc_channel_filter*); extern UniqueTypeName (*NameFromChannelFilter)(const grpc_channel_filter*);
class ChannelInit { class ChannelInit {
public: public:

@ -298,7 +298,9 @@ void FilterStackCall::ExecuteBatch(grpc_transport_stream_op_batch* batch,
auto* call = auto* call =
static_cast<FilterStackCall*>(batch->handler_private.extra_arg); static_cast<FilterStackCall*>(batch->handler_private.extra_arg);
grpc_call_element* elem = call->call_elem(0); grpc_call_element* elem = call->call_elem(0);
GRPC_CALL_LOG_OP(GPR_INFO, elem, batch); GRPC_TRACE_LOG(channel, INFO)
<< "OP[" << elem->filter->name << ":" << elem
<< "]: " << grpc_transport_stream_op_batch_string(batch, false);
elem->filter->start_transport_stream_op_batch(elem, batch); elem->filter->start_transport_stream_op_batch(elem, batch);
}; };
batch->handler_private.extra_arg = this; batch->handler_private.extra_arg = this;

@ -57,7 +57,7 @@ namespace grpc_core {
const grpc_channel_filter LameClientFilter::kFilter = const grpc_channel_filter LameClientFilter::kFilter =
MakePromiseBasedFilter<LameClientFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<LameClientFilter, FilterEndpoint::kClient,
kFilterIsLast>("lame-client"); kFilterIsLast>();
absl::StatusOr<std::unique_ptr<LameClientFilter>> LameClientFilter::Create( absl::StatusOr<std::unique_ptr<LameClientFilter>> LameClientFilter::Create(
const ChannelArgs& args, ChannelFilter::Args) { const ChannelArgs& args, ChannelFilter::Args) {

@ -47,6 +47,8 @@ class LameClientFilter : public ChannelFilter {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "lame-client"; }
explicit LameClientFilter(absl::Status error); explicit LameClientFilter(absl::Status error);
static absl::StatusOr<std::unique_ptr<LameClientFilter>> Create( static absl::StatusOr<std::unique_ptr<LameClientFilter>> Create(

@ -46,8 +46,7 @@ const NoInterceptor ClientLoadReportingFilter::Call::OnFinalize;
const grpc_channel_filter ClientLoadReportingFilter::kFilter = const grpc_channel_filter ClientLoadReportingFilter::kFilter =
MakePromiseBasedFilter<ClientLoadReportingFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<ClientLoadReportingFilter, FilterEndpoint::kClient,
kFilterExaminesServerInitialMetadata>( kFilterExaminesServerInitialMetadata>();
"client_load_reporting");
absl::StatusOr<std::unique_ptr<ClientLoadReportingFilter>> absl::StatusOr<std::unique_ptr<ClientLoadReportingFilter>>
ClientLoadReportingFilter::Create(const ChannelArgs&, ChannelFilter::Args) { ClientLoadReportingFilter::Create(const ChannelArgs&, ChannelFilter::Args) {

@ -36,6 +36,8 @@ class ClientLoadReportingFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "client_load_reporting"; }
class Call { class Call {
public: public:
void OnClientInitialMetadata(ClientMetadata& client_initial_metadata); void OnClientInitialMetadata(ClientMetadata& client_initial_metadata);

@ -318,6 +318,8 @@ class XdsResolver final : public Resolver {
public: public:
const static grpc_channel_filter kFilter; const static grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "cluster_selection_filter"; }
static absl::StatusOr<std::unique_ptr<ClusterSelectionFilter>> Create( static absl::StatusOr<std::unique_ptr<ClusterSelectionFilter>> Create(
const ChannelArgs& /* unused */, const ChannelArgs& /* unused */,
ChannelFilter::Args /* filter_args */) { ChannelFilter::Args /* filter_args */) {
@ -866,8 +868,7 @@ XdsResolver::XdsRouteStateAttributeImpl::LockAndGetCluster(
const grpc_channel_filter XdsResolver::ClusterSelectionFilter::kFilter = const grpc_channel_filter XdsResolver::ClusterSelectionFilter::kFilter =
MakePromiseBasedFilter<ClusterSelectionFilter, FilterEndpoint::kClient, MakePromiseBasedFilter<ClusterSelectionFilter, FilterEndpoint::kClient,
kFilterExaminesServerInitialMetadata>( kFilterExaminesServerInitialMetadata>();
"cluster_selection_filter");
void XdsResolver::ClusterSelectionFilter::Call::OnClientInitialMetadata( void XdsResolver::ClusterSelectionFilter::Call::OnClientInitialMetadata(
ClientMetadata&) { ClientMetadata&) {

@ -779,7 +779,7 @@ const grpc_channel_filter Server::kServerTopFilter = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Server::ChannelData::DestroyChannelElement, Server::ChannelData::DestroyChannelElement,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"server", GRPC_UNIQUE_TYPE_NAME_HERE("server"),
}; };
namespace { namespace {

@ -49,6 +49,8 @@ class ServerCallTracerFilter
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "server_call_tracer"; }
static absl::StatusOr<std::unique_ptr<ServerCallTracerFilter>> Create( static absl::StatusOr<std::unique_ptr<ServerCallTracerFilter>> Create(
const ChannelArgs& /*args*/, ChannelFilter::Args /*filter_args*/); const ChannelArgs& /*args*/, ChannelFilter::Args /*filter_args*/);
@ -90,8 +92,7 @@ const NoInterceptor ServerCallTracerFilter::Call::OnServerToClientMessage;
const grpc_channel_filter ServerCallTracerFilter::kFilter = const grpc_channel_filter ServerCallTracerFilter::kFilter =
MakePromiseBasedFilter<ServerCallTracerFilter, FilterEndpoint::kServer, MakePromiseBasedFilter<ServerCallTracerFilter, FilterEndpoint::kServer,
kFilterExaminesServerInitialMetadata>( kFilterExaminesServerInitialMetadata>();
"server_call_tracer");
absl::StatusOr<std::unique_ptr<ServerCallTracerFilter>> absl::StatusOr<std::unique_ptr<ServerCallTracerFilter>>
ServerCallTracerFilter::Create(const ChannelArgs& /*args*/, ServerCallTracerFilter::Create(const ChannelArgs& /*args*/,

@ -55,6 +55,10 @@ class ServerConfigSelectorFilter final
RefCountedPtr<ServerConfigSelectorProvider> RefCountedPtr<ServerConfigSelectorProvider>
server_config_selector_provider); server_config_selector_provider);
static absl::string_view TypeName() {
return "server_config_selector_filter";
}
ServerConfigSelectorFilter(const ServerConfigSelectorFilter&) = delete; ServerConfigSelectorFilter(const ServerConfigSelectorFilter&) = delete;
ServerConfigSelectorFilter& operator=(const ServerConfigSelectorFilter&) = ServerConfigSelectorFilter& operator=(const ServerConfigSelectorFilter&) =
delete; delete;
@ -164,7 +168,7 @@ const NoInterceptor ServerConfigSelectorFilter::Call::OnFinalize;
} // namespace } // namespace
const grpc_channel_filter kServerConfigSelectorFilter = const grpc_channel_filter kServerConfigSelectorFilter =
MakePromiseBasedFilter<ServerConfigSelectorFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<ServerConfigSelectorFilter,
"server_config_selector_filter"); FilterEndpoint::kServer>();
} // namespace grpc_core } // namespace grpc_core

@ -63,7 +63,7 @@ void XdsChannelStackModifier::ModifyChannelStack(ChannelStackBuilder& builder) {
for (auto it = builder.mutable_stack()->begin(); for (auto it = builder.mutable_stack()->begin();
it != builder.mutable_stack()->end(); ++it) { it != builder.mutable_stack()->end(); ++it) {
for (absl::string_view predicate_name : {"server", "census_server"}) { for (absl::string_view predicate_name : {"server", "census_server"}) {
if (predicate_name == (*it)->name) insert_before = it + 1; if (predicate_name == (*it)->name.name()) insert_before = it + 1;
} }
} }
for (const grpc_channel_filter* filter : filters_) { for (const grpc_channel_filter* filter : filters_) {

@ -58,6 +58,8 @@ class ServiceConfigChannelArgFilter final
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "service_config_channel_arg"; }
static absl::StatusOr<std::unique_ptr<ServiceConfigChannelArgFilter>> Create( static absl::StatusOr<std::unique_ptr<ServiceConfigChannelArgFilter>> Create(
const ChannelArgs& args, ChannelFilter::Args) { const ChannelArgs& args, ChannelFilter::Args) {
return std::make_unique<ServiceConfigChannelArgFilter>(args); return std::make_unique<ServiceConfigChannelArgFilter>(args);
@ -119,8 +121,7 @@ void ServiceConfigChannelArgFilter::Call::OnClientInitialMetadata(
const grpc_channel_filter ServiceConfigChannelArgFilter::kFilter = const grpc_channel_filter ServiceConfigChannelArgFilter::kFilter =
MakePromiseBasedFilter<ServiceConfigChannelArgFilter, MakePromiseBasedFilter<ServiceConfigChannelArgFilter,
FilterEndpoint::kClient>( FilterEndpoint::kClient>();
"service_config_channel_arg");
} // namespace } // namespace

@ -81,8 +81,7 @@ constexpr uint32_t
const grpc_channel_filter OpenCensusClientFilter::kFilter = const grpc_channel_filter OpenCensusClientFilter::kFilter =
grpc_core::MakePromiseBasedFilter<OpenCensusClientFilter, grpc_core::MakePromiseBasedFilter<OpenCensusClientFilter,
grpc_core::FilterEndpoint::kClient, 0>( grpc_core::FilterEndpoint::kClient, 0>();
"opencensus_client");
absl::StatusOr<std::unique_ptr<OpenCensusClientFilter>> absl::StatusOr<std::unique_ptr<OpenCensusClientFilter>>
OpenCensusClientFilter::Create(const grpc_core::ChannelArgs& args, OpenCensusClientFilter::Create(const grpc_core::ChannelArgs& args,

@ -38,6 +38,8 @@ class OpenCensusClientFilter : public grpc_core::ChannelFilter {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "opencensus_client"; }
static absl::StatusOr<std::unique_ptr<OpenCensusClientFilter>> Create( static absl::StatusOr<std::unique_ptr<OpenCensusClientFilter>> Create(
const grpc_core::ChannelArgs& args, ChannelFilter::Args /*filter_args*/); const grpc_core::ChannelArgs& args, ChannelFilter::Args /*filter_args*/);

@ -19,6 +19,7 @@
#include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/channel/channel_stack_builder.h"
#include <map> #include <map>
#include <memory>
#include <utility> #include <utility>
#include "absl/status/status.h" #include "absl/status/status.h"
@ -53,19 +54,24 @@ void CallDestroyFunc(grpc_call_element* /*elem*/,
const grpc_call_final_info* /*final_info*/, const grpc_call_final_info* /*final_info*/,
grpc_closure* /*ignored*/) {} grpc_closure* /*ignored*/) {}
const grpc_channel_filter* FilterNamed(const char* name) { const grpc_channel_filter* FilterNamed(absl::string_view name) {
static auto* filters = static auto* filters =
new std::map<absl::string_view, const grpc_channel_filter*>; new std::map<absl::string_view, const grpc_channel_filter*>;
auto it = filters->find(name); auto it = filters->find(name);
if (it != filters->end()) return it->second; if (it != filters->end()) return it->second;
static auto* name_factories =
new std::vector<std::unique_ptr<UniqueTypeName::Factory>>();
name_factories->emplace_back(std::make_unique<UniqueTypeName::Factory>(name));
auto unique_type_name = name_factories->back()->Create();
return filters return filters
->emplace(name, ->emplace(
new grpc_channel_filter{ name,
grpc_call_next_op, grpc_channel_next_op, 0, CallInitFunc, new grpc_channel_filter{
grpc_call_stack_ignore_set_pollset_or_pollset_set, grpc_call_next_op, grpc_channel_next_op, 0, CallInitFunc,
CallDestroyFunc, 0, ChannelInitFunc, grpc_call_stack_ignore_set_pollset_or_pollset_set,
[](grpc_channel_stack*, grpc_channel_element*) {}, CallDestroyFunc, 0, ChannelInitFunc,
ChannelDestroyFunc, grpc_channel_next_get_info, name}) [](grpc_channel_stack*, grpc_channel_element*) {},
ChannelDestroyFunc, grpc_channel_next_get_info, unique_type_name})
.first->second; .first->second;
} }

@ -92,7 +92,7 @@ TEST(ChannelStackTest, CreateChannelStack) {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
channel_destroy_func, channel_destroy_func,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"some_test_filter"}; GRPC_UNIQUE_TYPE_NAME_HERE("some_test_filter")};
const grpc_channel_filter* filters = &filter; const grpc_channel_filter* filters = &filter;
grpc_channel_stack* channel_stack; grpc_channel_stack* channel_stack;
grpc_call_stack* call_stack; grpc_call_stack* call_stack;

@ -101,9 +101,7 @@ std::vector<std::string> MakeStack(const char* transport_name,
std::vector<std::string> parts; std::vector<std::string> parts;
for (const auto& entry : *builder.mutable_stack()) { for (const auto& entry : *builder.mutable_stack()) {
const char* name = entry->name; parts.push_back(std::string(entry->name.name()));
if (name == nullptr) continue;
parts.push_back(name);
} }
return parts; return parts;

@ -52,6 +52,7 @@ namespace {
class TestFilter : public ImplementChannelFilter<TestFilter> { class TestFilter : public ImplementChannelFilter<TestFilter> {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "filter_causes_close"; }
static absl::StatusOr<std::unique_ptr<TestFilter>> Create( static absl::StatusOr<std::unique_ptr<TestFilter>> Create(
const ChannelArgs&, ChannelFilter::Args) { const ChannelArgs&, ChannelFilter::Args) {
return std::make_unique<TestFilter>(); return std::make_unique<TestFilter>();
@ -81,8 +82,7 @@ const NoInterceptor TestFilter::Call::OnServerToClientMessage;
const NoInterceptor TestFilter::Call::OnFinalize; const NoInterceptor TestFilter::Call::OnFinalize;
const grpc_channel_filter TestFilter::kFilter = const grpc_channel_filter TestFilter::kFilter =
MakePromiseBasedFilter<TestFilter, FilterEndpoint::kServer>( MakePromiseBasedFilter<TestFilter, FilterEndpoint::kServer>();
"filter_causes_close");
CORE_END2END_TEST(CoreEnd2endTest, FilterCausesClose) { CORE_END2END_TEST(CoreEnd2endTest, FilterCausesClose) {
CoreConfiguration::RegisterBuilder([](CoreConfiguration::Builder* builder) { CoreConfiguration::RegisterBuilder([](CoreConfiguration::Builder* builder) {

@ -85,7 +85,7 @@ const grpc_channel_filter test_filter = {
// last one. // last one.
// Filter ordering code falls back to lexical ordering in the absense of // Filter ordering code falls back to lexical ordering in the absense of
// other dependencies, so name this appropriately. // other dependencies, so name this appropriately.
"zzzzzz_filter_init_fails"}; GRPC_UNIQUE_TYPE_NAME_HERE("zzzzzz_filter_init_fails")};
void RegisterFilter(grpc_channel_stack_type type) { void RegisterFilter(grpc_channel_stack_type type) {
CoreConfiguration::RegisterBuilder( CoreConfiguration::RegisterBuilder(

@ -172,7 +172,7 @@ grpc_channel_filter FailSendOpsFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Destroy, Destroy,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"FailSendOpsFilter", GRPC_UNIQUE_TYPE_NAME_HERE("FailSendOpsFilter"),
}; };
void RegisterFilter() { void RegisterFilter() {

@ -32,6 +32,7 @@
#include "src/core/lib/config/core_configuration.h" #include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/unique_type_name.h"
#include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
@ -118,7 +119,7 @@ grpc_channel_filter FailFirstSendOpFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Destroy, Destroy,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"FailFirstSendOpFilter", GRPC_UNIQUE_TYPE_NAME_HERE("FailFirstSendOpFilter"),
}; };
// Tests the fix for a bug found in real-world code where recv_message // Tests the fix for a bug found in real-world code where recv_message

@ -113,7 +113,7 @@ grpc_channel_filter InjectStatusFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Destroy, Destroy,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"InjectStatusFilter", GRPC_UNIQUE_TYPE_NAME_HERE("InjectStatusFilter"),
}; };
// Tests that we honor the error passed to recv_trailing_metadata_ready // Tests that we honor the error passed to recv_trailing_metadata_ready

@ -119,7 +119,7 @@ grpc_channel_filter FailFirstCallFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Destroy, Destroy,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"FailFirstCallFilter", GRPC_UNIQUE_TYPE_NAME_HERE("FailFirstCallFilter"),
}; };
// Tests failure on a send op batch: // Tests failure on a send op batch:

@ -29,6 +29,7 @@
#include "src/core/lib/config/core_configuration.h" #include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/unique_type_name.h"
#include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
@ -125,7 +126,7 @@ grpc_channel_filter FailFirstCallFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Destroy, Destroy,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"FailFirstCallFilter", GRPC_UNIQUE_TYPE_NAME_HERE("FailFirstCallFilter"),
}; };
// Tests transparent retries when the call was never sent out on the wire. // Tests transparent retries when the call was never sent out on the wire.

@ -31,6 +31,7 @@
#include "src/core/lib/config/core_configuration.h" #include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/gprpp/status_helper.h" #include "src/core/lib/gprpp/status_helper.h"
#include "src/core/lib/gprpp/time.h" #include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/unique_type_name.h"
#include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/error.h"
@ -124,7 +125,7 @@ grpc_channel_filter FailFirstTenCallsFilter::kFilterVtable = {
grpc_channel_stack_no_post_init, grpc_channel_stack_no_post_init,
Destroy, Destroy,
grpc_channel_next_get_info, grpc_channel_next_get_info,
"FailFirstTenCallsFilter", GRPC_UNIQUE_TYPE_NAME_HERE("FailFirstTenCallsFilter"),
}; };
// Tests transparent retries when the call was never sent out on the wire. // Tests transparent retries when the call was never sent out on the wire.

@ -93,6 +93,26 @@ TEST(UniqueTypeNameTest, CanUseAsMapKey) {
::testing::Pair(bar.type(), 2))); ::testing::Pair(bar.type(), 2)));
} }
struct Filter1 {
static absl::string_view TypeName() { return "Filter1"; }
};
struct Filter2 {
static absl::string_view TypeName() { return "Filter2"; }
};
TEST(UniqueTypeNameTest, UniqueTypeNameFor) {
EXPECT_EQ(UniqueTypeNameFor<Filter1>(), UniqueTypeNameFor<Filter1>());
EXPECT_NE(UniqueTypeNameFor<Filter1>(), UniqueTypeNameFor<Filter2>());
}
TEST(UniqueTypeNameTest, UniqueTypeNameHere) {
auto name1 = GRPC_UNIQUE_TYPE_NAME_HERE("name");
auto name2 = GRPC_UNIQUE_TYPE_NAME_HERE("name");
EXPECT_EQ(name1.name(), name2.name());
EXPECT_NE(name1, name2);
}
} // namespace } // namespace
} // namespace grpc_core } // namespace grpc_core

@ -70,8 +70,8 @@ TEST(XdsChannelStackModifierTest, ChannelArgsCompare) {
grpc_shutdown(); grpc_shutdown();
} }
constexpr char kTestFilter1[] = "test_filter_1"; const UniqueTypeName kTestFilter1 = GRPC_UNIQUE_TYPE_NAME_HERE("test_filter_1");
constexpr char kTestFilter2[] = "test_filter_2"; const UniqueTypeName kTestFilter2 = GRPC_UNIQUE_TYPE_NAME_HERE("test_filter_2");
namespace { namespace {
class FakeTransport final : public Transport { class FakeTransport final : public Transport {
@ -117,11 +117,12 @@ TEST(XdsChannelStackModifierTest, XdsHttpFiltersInsertion) {
} }
std::vector<std::string> filters; std::vector<std::string> filters;
for (const auto& entry : *builder.mutable_stack()) { for (const auto& entry : *builder.mutable_stack()) {
filters.push_back(entry->name); filters.push_back(std::string(entry->name.name()));
} }
filters.resize(3); filters.resize(3);
EXPECT_EQ(filters, EXPECT_EQ(filters, std::vector<std::string>(
std::vector<std::string>({"server", kTestFilter1, kTestFilter2})); {"server", std::string(kTestFilter1.name()),
std::string(kTestFilter2.name())}));
grpc_shutdown(); grpc_shutdown();
} }

@ -37,10 +37,15 @@ const grpc_channel_filter* FilterNamed(const char* name) {
new std::map<absl::string_view, const grpc_channel_filter*>; new std::map<absl::string_view, const grpc_channel_filter*>;
auto it = filters->find(name); auto it = filters->find(name);
if (it != filters->end()) return it->second; if (it != filters->end()) return it->second;
static auto* name_factories =
new std::vector<std::unique_ptr<UniqueTypeName::Factory>>();
name_factories->emplace_back(std::make_unique<UniqueTypeName::Factory>(name));
auto unique_type_name = name_factories->back()->Create();
return filters return filters
->emplace(name, new grpc_channel_filter{nullptr, nullptr, 0, nullptr, ->emplace(name,
nullptr, nullptr, 0, nullptr, new grpc_channel_filter{nullptr, nullptr, 0, nullptr, nullptr,
nullptr, nullptr, nullptr, name}) nullptr, 0, nullptr, nullptr, nullptr,
nullptr, unique_type_name})
.first->second; .first->second;
} }
@ -51,7 +56,7 @@ std::vector<std::string> GetFilterNames(const ChannelInit& init,
if (!init.CreateStack(&b)) return {}; if (!init.CreateStack(&b)) return {};
std::vector<std::string> names; std::vector<std::string> names;
for (auto f : b.stack()) { for (auto f : b.stack()) {
names.push_back(f->name); names.push_back(std::string(f->name.name()));
} }
EXPECT_NE(names, std::vector<std::string>()); EXPECT_NE(names, std::vector<std::string>());
return names; return names;
@ -239,8 +244,9 @@ class TestFilter1 {
}; };
const grpc_channel_filter TestFilter1::kFilter = { const grpc_channel_filter TestFilter1::kFilter = {
nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr, 0, nullptr,
0, nullptr, nullptr, nullptr, nullptr, "test_filter1"}; nullptr, nullptr, 0, nullptr,
nullptr, nullptr, nullptr, GRPC_UNIQUE_TYPE_NAME_HERE("test_filter1")};
const NoInterceptor TestFilter1::Call::OnClientInitialMetadata; const NoInterceptor TestFilter1::Call::OnClientInitialMetadata;
const NoInterceptor TestFilter1::Call::OnServerInitialMetadata; const NoInterceptor TestFilter1::Call::OnServerInitialMetadata;
const NoInterceptor TestFilter1::Call::OnServerTrailingMetadata; const NoInterceptor TestFilter1::Call::OnServerTrailingMetadata;

@ -37,7 +37,7 @@ void test_unknown_scheme_target(void) {
grpc_channel* chan = grpc_channel_create("blah://blah", creds, nullptr); grpc_channel* chan = grpc_channel_create("blah://blah", creds, nullptr);
grpc_channel_element* elem = grpc_channel_stack_element( grpc_channel_element* elem = grpc_channel_stack_element(
grpc_core::Channel::FromC(chan)->channel_stack(), 0); grpc_core::Channel::FromC(chan)->channel_stack(), 0);
ASSERT_STREQ(elem->filter->name, "lame-client"); ASSERT_EQ(elem->filter->name.name(), "lame-client");
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
grpc_core::Channel::FromC(chan)->Unref(); grpc_core::Channel::FromC(chan)->Unref();
creds->Unref(); creds->Unref();
@ -51,7 +51,7 @@ void test_security_connector_already_in_arg(void) {
grpc_channel* chan = grpc_channel_create(nullptr, nullptr, &args); grpc_channel* chan = grpc_channel_create(nullptr, nullptr, &args);
grpc_channel_element* elem = grpc_channel_stack_element( grpc_channel_element* elem = grpc_channel_stack_element(
grpc_core::Channel::FromC(chan)->channel_stack(), 0); grpc_core::Channel::FromC(chan)->channel_stack(), 0);
ASSERT_STREQ(elem->filter->name, "lame-client"); ASSERT_EQ(elem->filter->name.name(), "lame-client");
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
grpc_core::Channel::FromC(chan)->Unref(); grpc_core::Channel::FromC(chan)->Unref();
} }
@ -60,7 +60,7 @@ void test_null_creds(void) {
grpc_channel* chan = grpc_channel_create(nullptr, nullptr, nullptr); grpc_channel* chan = grpc_channel_create(nullptr, nullptr, nullptr);
grpc_channel_element* elem = grpc_channel_stack_element( grpc_channel_element* elem = grpc_channel_stack_element(
grpc_core::Channel::FromC(chan)->channel_stack(), 0); grpc_core::Channel::FromC(chan)->channel_stack(), 0);
ASSERT_STREQ(elem->filter->name, "lame-client"); ASSERT_EQ(elem->filter->name.name(), "lame-client");
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
grpc_core::Channel::FromC(chan)->Unref(); grpc_core::Channel::FromC(chan)->Unref();
} }

@ -24,6 +24,8 @@ class FakeStatsClientFilter : public ChannelFilter {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "fake_stats_client"; }
explicit FakeStatsClientFilter( explicit FakeStatsClientFilter(
FakeClientCallTracerFactory* fake_client_call_tracer_factory); FakeClientCallTracerFactory* fake_client_call_tracer_factory);
@ -38,8 +40,7 @@ class FakeStatsClientFilter : public ChannelFilter {
}; };
const grpc_channel_filter FakeStatsClientFilter::kFilter = const grpc_channel_filter FakeStatsClientFilter::kFilter =
MakePromiseBasedFilter<FakeStatsClientFilter, FilterEndpoint::kClient>( MakePromiseBasedFilter<FakeStatsClientFilter, FilterEndpoint::kClient>();
"fake_stats_client");
absl::StatusOr<std::unique_ptr<FakeStatsClientFilter>> absl::StatusOr<std::unique_ptr<FakeStatsClientFilter>>
FakeStatsClientFilter::Create(const ChannelArgs& args, FakeStatsClientFilter::Create(const ChannelArgs& args,

@ -215,7 +215,7 @@ grpc_channel_filter TrailingMetadataRecordingFilter::kFilterVtable = {
// connected channel filter must be the last one. // connected channel filter must be the last one.
// Channel init code falls back to lexical ordering of filters if there are // Channel init code falls back to lexical ordering of filters if there are
// otherwise no dependencies, so we leverage that. // otherwise no dependencies, so we leverage that.
"zzzzzz_trailing-metadata-recording-filter", GRPC_UNIQUE_TYPE_NAME_HERE("zzzzzz_trailing-metadata-recording-filter"),
}; };
bool TrailingMetadataRecordingFilter::trailing_metadata_available_; bool TrailingMetadataRecordingFilter::trailing_metadata_available_;
absl::optional<GrpcStreamNetworkState::ValueType> absl::optional<GrpcStreamNetworkState::ValueType>

@ -50,6 +50,8 @@ class AddLabelsFilter : public grpc_core::ChannelFilter {
public: public:
static const grpc_channel_filter kFilter; static const grpc_channel_filter kFilter;
static absl::string_view TypeName() { return "add_service_labels_filter"; }
explicit AddLabelsFilter( explicit AddLabelsFilter(
std::map<grpc_core::ClientCallTracer::CallAttemptTracer::OptionalLabelKey, std::map<grpc_core::ClientCallTracer::CallAttemptTracer::OptionalLabelKey,
grpc_core::RefCountedStringValue> grpc_core::RefCountedStringValue>
@ -85,8 +87,7 @@ class AddLabelsFilter : public grpc_core::ChannelFilter {
const grpc_channel_filter AddLabelsFilter::kFilter = const grpc_channel_filter AddLabelsFilter::kFilter =
grpc_core::MakePromiseBasedFilter<AddLabelsFilter, grpc_core::MakePromiseBasedFilter<AddLabelsFilter,
grpc_core::FilterEndpoint::kClient>( grpc_core::FilterEndpoint::kClient>();
"add_service_labels_filter");
OpenTelemetryPluginEnd2EndTest::MetricsCollectorThread::MetricsCollectorThread( OpenTelemetryPluginEnd2EndTest::MetricsCollectorThread::MetricsCollectorThread(
OpenTelemetryPluginEnd2EndTest* test, grpc_core::Duration interval, OpenTelemetryPluginEnd2EndTest* test, grpc_core::Duration interval,

@ -77,6 +77,7 @@ IGNORED_FILES = [
"src/core/lib/gprpp/global_config_env.h", "src/core/lib/gprpp/global_config_env.h",
"src/core/lib/profiling/timers.h", "src/core/lib/profiling/timers.h",
"src/core/lib/gprpp/crash.h", "src/core/lib/gprpp/crash.h",
"src/core/lib/gprpp/unique_type_name.h",
# The grpc_core::Server redundant namespace qualification is required for # The grpc_core::Server redundant namespace qualification is required for
# older gcc versions. # older gcc versions.
"src/core/ext/transport/chttp2/server/chttp2_server.h", "src/core/ext/transport/chttp2/server/chttp2_server.h",

@ -45,6 +45,7 @@ _DEFAULT_PACKAGES = [
"grpcio-admin", "grpcio-admin",
"grpcio-csds", "grpcio-csds",
"grpcio-observability", "grpcio-observability",
"grpcio-csm-observability",
"xds-protos", "xds-protos",
] ]

Loading…
Cancel
Save