pull/36254/head
Yash Tibrewal 8 months ago
parent 52077095e9
commit c5390c99a1
  1. 1
      BUILD
  2. 3
      src/core/BUILD
  3. 4
      src/core/ext/xds/xds_cluster.cc
  4. 8
      src/core/ext/xds/xds_cluster.h
  5. 1
      src/core/lib/channel/call_tracer.h
  6. 6
      src/core/load_balancing/xds/xds_cluster_impl.cc
  7. 1
      src/core/load_balancing/xds/xds_wrr_locality.cc
  8. 2
      src/core/resolver/xds/xds_dependency_manager.cc
  9. 16
      test/core/xds/xds_cluster_resource_type_test.cc

@ -1720,6 +1720,7 @@ grpc_cc_library(
"//src/core:context",
"//src/core:error",
"//src/core:metadata_batch",
"//src/core:ref_counted_string",
"//src/core:slice_buffer",
],
)

@ -5348,10 +5348,12 @@ grpc_cc_library(
"match",
"pollset_set",
"ref_counted",
"ref_counted_string",
"resolved_address",
"subchannel_interface",
"validation_errors",
"xds_dependency_manager",
"//:call_tracer",
"//:config",
"//:debug_location",
"//:endpoint_addresses",
@ -5433,6 +5435,7 @@ grpc_cc_library(
"lb_policy_factory",
"lb_policy_registry",
"pollset_set",
"ref_counted_string",
"validation_errors",
"//:config",
"//:debug_location",

@ -724,11 +724,11 @@ absl::StatusOr<std::shared_ptr<const XdsClusterResource>> CdsResourceParse(
if (google_protobuf_Value_has_string_value(value)) {
if (UpbStringToAbsl(google_protobuf_Struct_FieldsEntry_key(
fields_entry)) == "service_name") {
cds_update->service_telemetry_label_ = RefCountedStringValue(
cds_update->service_telemetry_label = RefCountedStringValue(
UpbStringToAbsl(google_protobuf_Value_string_value(value)));
} else if (UpbStringToAbsl(google_protobuf_Struct_FieldsEntry_key(
fields_entry)) == "service_namespace") {
cds_update->namespace_telemetry_label_ = RefCountedStringValue(
cds_update->namespace_telemetry_label = RefCountedStringValue(
UpbStringToAbsl(google_protobuf_Value_string_value(value)));
}
}

@ -101,8 +101,8 @@ struct XdsClusterResource : public XdsResourceType::ResourceData {
XdsHealthStatusSet override_host_statuses;
RefCountedStringValue service_telemetry_label_;
RefCountedStringValue namespace_telemetry_label_;
RefCountedStringValue service_telemetry_label;
RefCountedStringValue namespace_telemetry_label;
bool operator==(const XdsClusterResource& other) const {
return type == other.type && lb_policy_config == other.lb_policy_config &&
@ -111,7 +111,9 @@ struct XdsClusterResource : public XdsResourceType::ResourceData {
connection_idle_timeout == other.connection_idle_timeout &&
max_concurrent_requests == other.max_concurrent_requests &&
outlier_detection == other.outlier_detection &&
override_host_statuses == other.override_host_statuses;
override_host_statuses == other.override_host_statuses &&
service_telemetry_label == other.service_telemetry_label &&
namespace_telemetry_label == other.namespace_telemetry_label;
}
std::string ToString() const;

@ -33,6 +33,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/channel/tcp_tracer.h"
#include "src/core/lib/gprpp/ref_counted_string.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_buffer.h"

@ -44,6 +44,7 @@
#include "src/core/ext/xds/xds_client_grpc.h"
#include "src/core/ext/xds/xds_client_stats.h"
#include "src/core/ext/xds/xds_endpoint.h"
#include "src/core/lib/channel/call_tracer.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/trace.h"
@ -52,6 +53,7 @@
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/ref_counted_string.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/validation_errors.h"
#include "src/core/lib/iomgr/pollset_set.h"
@ -387,9 +389,9 @@ XdsClusterImplLb::Picker::Picker(XdsClusterImplLb* xds_cluster_impl_lb,
max_concurrent_requests_(
xds_cluster_impl_lb->cluster_resource_->max_concurrent_requests),
service_telemetry_label_(
xds_cluster_impl_lb->cluster_resource_->service_telemetry_label_),
xds_cluster_impl_lb->cluster_resource_->service_telemetry_label),
namespace_telemetry_label_(
xds_cluster_impl_lb->cluster_resource_->namespace_telemetry_label_),
xds_cluster_impl_lb->cluster_resource_->namespace_telemetry_label),
drop_config_(xds_cluster_impl_lb->drop_config_),
drop_stats_(xds_cluster_impl_lb->drop_stats_),
picker_(std::move(picker)) {

@ -39,6 +39,7 @@
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/ref_counted_string.h"
#include "src/core/lib/gprpp/validation_errors.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/json/json.h"

@ -18,6 +18,8 @@
#include "src/core/resolver/xds/xds_dependency_manager.h"
#include <set>
#include "absl/strings/str_join.h"
#include "src/core/ext/xds/xds_routing.h"

@ -1635,8 +1635,8 @@ TEST_F(TelemetryLabelTest, ValidServiceLabelsConfig) {
ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status();
auto& resource =
static_cast<const XdsClusterResource&>(**decode_result.resource);
EXPECT_EQ(resource.service_telemetry_label_.as_string_view(), "abc");
EXPECT_EQ(resource.namespace_telemetry_label_.as_string_view(), "xyz");
EXPECT_EQ(resource.service_telemetry_label.as_string_view(), "abc");
EXPECT_EQ(resource.namespace_telemetry_label.as_string_view(), "xyz");
}
TEST_F(TelemetryLabelTest, MissingMetadataField) {
@ -1651,9 +1651,9 @@ TEST_F(TelemetryLabelTest, MissingMetadataField) {
ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status();
auto& resource =
static_cast<const XdsClusterResource&>(**decode_result.resource);
EXPECT_THAT(resource.service_telemetry_label_.as_string_view(),
EXPECT_THAT(resource.service_telemetry_label.as_string_view(),
::testing::IsEmpty());
EXPECT_THAT(resource.namespace_telemetry_label_.as_string_view(),
EXPECT_THAT(resource.namespace_telemetry_label.as_string_view(),
::testing::IsEmpty());
}
@ -1672,9 +1672,9 @@ TEST_F(TelemetryLabelTest, MissingCsmFilterMetadataField) {
ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status();
auto& resource =
static_cast<const XdsClusterResource&>(**decode_result.resource);
EXPECT_THAT(resource.service_telemetry_label_.as_string_view(),
EXPECT_THAT(resource.service_telemetry_label.as_string_view(),
::testing::IsEmpty());
EXPECT_THAT(resource.namespace_telemetry_label_.as_string_view(),
EXPECT_THAT(resource.namespace_telemetry_label.as_string_view(),
::testing::IsEmpty());
}
@ -1705,8 +1705,8 @@ TEST_F(TelemetryLabelTest, IgnoreNonServiceLabelEntries) {
ASSERT_TRUE(decode_result.resource.ok()) << decode_result.resource.status();
auto& resource =
static_cast<const XdsClusterResource&>(**decode_result.resource);
EXPECT_THAT(resource.service_telemetry_label_.as_string_view(), "service");
EXPECT_THAT(resource.namespace_telemetry_label_.as_string_view(),
EXPECT_THAT(resource.service_telemetry_label.as_string_view(), "service");
EXPECT_THAT(resource.namespace_telemetry_label.as_string_view(),
::testing::IsEmpty());
}

Loading…
Cancel
Save