Skip to content

Commit

Permalink
Revert "[PSM Interop] Add flag to enable CSM Observability in c++ ima…
Browse files Browse the repository at this point in the history
…ge" (grpc#34858)

Reverts grpc#34840
  • Loading branch information
stanley-cheung authored Nov 2, 2023
1 parent 4580cfd commit 9303b86
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
6 changes: 0 additions & 6 deletions test/cpp/interop/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,13 @@ grpc_cc_binary(
],
external_deps = [
"absl/flags:flag",
"otel/exporters/prometheus:prometheus_exporter",
"otel/sdk/src/metrics",
],
deps = [
":rpc_behavior_lb_policy",
":xds_stats_watcher",
"//:grpc++",
"//:grpc++_reflection",
"//:grpcpp_admin",
"//:grpcpp_csm_observability",
"//src/proto/grpc/testing:empty_proto",
"//src/proto/grpc/testing:messages_proto",
"//src/proto/grpc/testing:test_proto",
Expand Down Expand Up @@ -316,13 +313,10 @@ grpc_cc_binary(
],
external_deps = [
"absl/flags:flag",
"otel/exporters/prometheus:prometheus_exporter",
"otel/sdk/src/metrics",
],
deps = [
":xds_interop_server_lib",
"//:grpc++",
"//:grpcpp_csm_observability",
"//test/core/util:grpc_test_util",
"//test/cpp/end2end:test_health_check_service_impl",
"//test/cpp/util:test_config",
Expand Down
25 changes: 0 additions & 25 deletions test/cpp/interop/xds_interop_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@
#include "absl/algorithm/container.h"
#include "absl/flags/flag.h"
#include "absl/strings/str_split.h"
#include "opentelemetry/exporters/prometheus/exporter_factory.h"
#include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"

#include <grpcpp/ext/admin_services.h>
#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/ext/proto_server_reflection_plugin.h>
#include <grpcpp/grpcpp.h>
#include <grpcpp/server.h>
Expand Down Expand Up @@ -73,8 +69,6 @@ ABSL_FLAG(std::string, expect_status, "OK",
ABSL_FLAG(
bool, secure_mode, false,
"If true, XdsCredentials are used, InsecureChannelCredentials otherwise");
ABSL_FLAG(bool, enable_csm_observability, false,
"Whether to enable CSM Observability");

using grpc::Channel;
using grpc::ClientAsyncResponseReader;
Expand Down Expand Up @@ -392,22 +386,6 @@ void RunTestLoop(std::chrono::duration<double> duration_per_query,
GPR_UNREACHABLE_CODE(thread.join());
}

void EnableCsmObservability() {
gpr_log(GPR_DEBUG, "Registering Prometheus exporter");
opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE
// pods
opts.url = "0.0.0.0:9464";
auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto observability = grpc::experimental::CsmObservabilityBuilder();
observability.SetMeterProvider(std::move(meter_provider));
auto status = observability.BuildAndRegister();
}

void RunServer(const int port, StatsWatchers* stats_watchers,
RpcConfigurationsQueue* rpc_configs_queue) {
GPR_ASSERT(port != 0);
Expand Down Expand Up @@ -496,9 +474,6 @@ int main(int argc, char** argv) {
}

BuildRpcConfigsFromFlags(&rpc_config_queue);
if (absl::GetFlag(FLAGS_enable_csm_observability)) {
EnableCsmObservability();
}

std::chrono::duration<double> duration_per_query =
std::chrono::nanoseconds(std::chrono::seconds(1)) /
Expand Down
25 changes: 0 additions & 25 deletions test/cpp/interop/xds_interop_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
#include <iostream>

#include "absl/flags/flag.h"
#include "opentelemetry/exporters/prometheus/exporter_factory.h"
#include "opentelemetry/exporters/prometheus/exporter_options.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"

#include <grpc/grpc.h>
#include <grpcpp/ext/csm_observability.h>
#include <grpcpp/health_check_service_interface.h>

#include "src/core/lib/iomgr/gethostname.h"
Expand All @@ -40,24 +36,6 @@ ABSL_FLAG(std::string, server_id, "cpp_server",
ABSL_FLAG(bool, secure_mode, false,
"If true, XdsServerCredentials are used, InsecureServerCredentials "
"otherwise");
ABSL_FLAG(bool, enable_csm_observability, false,
"Whether to enable CSM Observability");

void EnableCsmObservability() {
gpr_log(GPR_DEBUG, "Registering Prometheus exporter");
opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE
// pods
opts.url = "0.0.0.0:9464";
auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider =
std::make_shared<opentelemetry::sdk::metrics::MeterProvider>();
meter_provider->AddMetricReader(std::move(prometheus_exporter));
auto observability = grpc::experimental::CsmObservabilityBuilder();
observability.SetMeterProvider(std::move(meter_provider));
auto status = observability.BuildAndRegister();
}

int main(int argc, char** argv) {
grpc::testing::TestEnvironment env(&argc, argv);
Expand All @@ -78,9 +56,6 @@ int main(int argc, char** argv) {
return 1;
}
grpc::EnableDefaultHealthCheckService(false);
if (absl::GetFlag(FLAGS_enable_csm_observability)) {
EnableCsmObservability();
}
grpc::testing::RunServer(
absl::GetFlag(FLAGS_secure_mode), port, maintenance_port, hostname,
absl::GetFlag(FLAGS_server_id), [](grpc::Server* /* unused */) {});
Expand Down

0 comments on commit 9303b86

Please sign in to comment.