[CSM] Remaining cleanup from GSM to CSM renaming (#34352)

<!--

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

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

-->
pull/34226/merge
Yash Tibrewal 2 years ago committed by GitHub
parent f002863cef
commit 037979c0d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/cpp/ext/csm/metadata_exchange.cc
  2. 22
      test/cpp/ext/csm/metadata_exchange_test.cc

@ -70,23 +70,23 @@ constexpr absl::string_view kMetadataExchangeProjectIdKey = "project_id";
constexpr absl::string_view kMetadataExchangeCanonicalServiceKey =
"canonical_service";
// The keys that will be used for the local attributes when recording metrics.
constexpr absl::string_view kMeshIdAttribute = "gsm.mesh_id";
constexpr absl::string_view kMeshIdAttribute = "csm.mesh_id";
// The keys that will be used for the peer attributes when recording metrics.
constexpr absl::string_view kPeerTypeAttribute = "gsm.remote_workload_type";
constexpr absl::string_view kPeerTypeAttribute = "csm.remote_workload_type";
constexpr absl::string_view kPeerPodNameAttribute =
"gsm.remote_workload_pod_name";
"csm.remote_workload_pod_name";
constexpr absl::string_view kPeerContainerNameAttribute =
"gsm.remote_workload_container_name";
"csm.remote_workload_container_name";
constexpr absl::string_view kPeerNamespaceNameAttribute =
"gsm.remote_workload_namespace_name";
"csm.remote_workload_namespace_name";
constexpr absl::string_view kPeerClusterNameAttribute =
"gsm.remote_workload_cluster_name";
"csm.remote_workload_cluster_name";
constexpr absl::string_view kPeerLocationAttribute =
"gsm.remote_workload_location";
"csm.remote_workload_location";
constexpr absl::string_view kPeerProjectIdAttribute =
"gsm.remote_workload_project_id";
"csm.remote_workload_project_id";
constexpr absl::string_view kPeerCanonicalServiceAttribute =
"gsm.remote_workload_canonical_service";
"csm.remote_workload_canonical_service";
// Type values used by Google Cloud Resource Detector
constexpr absl::string_view kGkeType = "gcp_kubernetes_engine";

@ -150,37 +150,37 @@ class MetadataExchangeTest
const std::map<std::string,
opentelemetry::sdk::common::OwnedAttributeValue>&
attributes) {
EXPECT_EQ(absl::get<std::string>(attributes.at("gsm.mesh_id")), "mesh-id");
EXPECT_EQ(absl::get<std::string>(attributes.at("csm.mesh_id")), "mesh-id");
switch (GetParam().type()) {
case TestScenario::ResourceType::kGke:
EXPECT_EQ(
absl::get<std::string>(attributes.at("gsm.remote_workload_type")),
absl::get<std::string>(attributes.at("csm.remote_workload_type")),
"gcp_kubernetes_engine");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_pod_name")),
attributes.at("csm.remote_workload_pod_name")),
"pod");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_container_name")),
attributes.at("csm.remote_workload_container_name")),
"container");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_namespace_name")),
attributes.at("csm.remote_workload_namespace_name")),
"namespace");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_cluster_name")),
attributes.at("csm.remote_workload_cluster_name")),
"cluster");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_location")),
attributes.at("csm.remote_workload_location")),
"region");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_project_id")),
attributes.at("csm.remote_workload_project_id")),
"id");
EXPECT_EQ(absl::get<std::string>(
attributes.at("gsm.remote_workload_canonical_service")),
attributes.at("csm.remote_workload_canonical_service")),
"canonical_service");
break;
case TestScenario::ResourceType::kUnknown:
EXPECT_EQ(
absl::get<std::string>(attributes.at("gsm.remote_workload_type")),
absl::get<std::string>(attributes.at("csm.remote_workload_type")),
"random");
break;
}
@ -190,7 +190,7 @@ class MetadataExchangeTest
const std::map<std::string,
opentelemetry::sdk::common::OwnedAttributeValue>&
attributes) {
EXPECT_EQ(attributes.find("gsm.remote_workload_type"), attributes.end());
EXPECT_EQ(attributes.find("csm.remote_workload_type"), attributes.end());
}
private:

Loading…
Cancel
Save