From 8ea4ed82ede26552eb6d9381a621dad01bb8e0d7 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 21 Nov 2024 18:24:04 +0000 Subject: [PATCH] [OTel] Set prometheus exporter option to populate otel scope --- examples/cpp/csm/csm_greeter_client.cc | 1 + examples/cpp/csm/csm_greeter_server.cc | 1 + examples/cpp/csm/observability/csm_greeter_client.cc | 1 + examples/cpp/csm/observability/csm_greeter_server.cc | 1 + examples/cpp/otel/greeter_callback_client.cc | 1 + examples/cpp/otel/greeter_callback_server.cc | 1 + test/cpp/interop/xds_interop_client.cc | 1 + test/cpp/interop/xds_interop_server.cc | 1 + 8 files changed, 8 insertions(+) diff --git a/examples/cpp/csm/csm_greeter_client.cc b/examples/cpp/csm/csm_greeter_client.cc index 90d550a9928..3b006b55222 100644 --- a/examples/cpp/csm/csm_greeter_client.cc +++ b/examples/cpp/csm/csm_greeter_client.cc @@ -161,6 +161,7 @@ absl::StatusOr InitializeObservability() { opentelemetry::exporter::metrics::PrometheusExporterOptions opts; // default was "localhost:9464" which causes connection issue across GKE pods opts.url = "0.0.0.0:9464"; + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/examples/cpp/csm/csm_greeter_server.cc b/examples/cpp/csm/csm_greeter_server.cc index 0c6a47446b5..50a6bf1ef34 100644 --- a/examples/cpp/csm/csm_greeter_server.cc +++ b/examples/cpp/csm/csm_greeter_server.cc @@ -103,6 +103,7 @@ int main(int argc, char** argv) { opentelemetry::exporter::metrics::PrometheusExporterOptions opts; // default was "localhost:9464" which causes connection issue across GKE pods opts.url = "0.0.0.0:9464"; + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/examples/cpp/csm/observability/csm_greeter_client.cc b/examples/cpp/csm/observability/csm_greeter_client.cc index 6d08d901e5a..8fadac076f7 100644 --- a/examples/cpp/csm/observability/csm_greeter_client.cc +++ b/examples/cpp/csm/observability/csm_greeter_client.cc @@ -45,6 +45,7 @@ absl::StatusOr InitializeObservability() { opentelemetry::exporter::metrics::PrometheusExporterOptions opts; // default was "localhost:9464" which causes connection issue across GKE pods opts.url = "0.0.0.0:9464"; + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/examples/cpp/csm/observability/csm_greeter_server.cc b/examples/cpp/csm/observability/csm_greeter_server.cc index cfae25d4c3d..83c2537b7fc 100644 --- a/examples/cpp/csm/observability/csm_greeter_server.cc +++ b/examples/cpp/csm/observability/csm_greeter_server.cc @@ -50,6 +50,7 @@ int main(int argc, char** argv) { opentelemetry::exporter::metrics::PrometheusExporterOptions opts; // default was "localhost:9464" which causes connection issue across GKE pods opts.url = "0.0.0.0:9464"; + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/examples/cpp/otel/greeter_callback_client.cc b/examples/cpp/otel/greeter_callback_client.cc index 0e4cf644779..713b4c69068 100644 --- a/examples/cpp/otel/greeter_callback_client.cc +++ b/examples/cpp/otel/greeter_callback_client.cc @@ -49,6 +49,7 @@ int main(int argc, char** argv) { // exporter. opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opts.url = absl::GetFlag(FLAGS_prometheus_endpoint); + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/examples/cpp/otel/greeter_callback_server.cc b/examples/cpp/otel/greeter_callback_server.cc index 60fec863a4e..b92ddf40436 100644 --- a/examples/cpp/otel/greeter_callback_server.cc +++ b/examples/cpp/otel/greeter_callback_server.cc @@ -52,6 +52,7 @@ int main(int argc, char** argv) { // exporter. opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opts.url = absl::GetFlag(FLAGS_prometheus_endpoint); + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/test/cpp/interop/xds_interop_client.cc b/test/cpp/interop/xds_interop_client.cc index d2296032267..c76aac186e0 100644 --- a/test/cpp/interop/xds_interop_client.cc +++ b/test/cpp/interop/xds_interop_client.cc @@ -430,6 +430,7 @@ grpc::CsmObservability EnableCsmObservability() { // default was "localhost:9464" which causes connection issue across GKE // pods opts.url = "0.0.0.0:9464"; + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider = diff --git a/test/cpp/interop/xds_interop_server.cc b/test/cpp/interop/xds_interop_server.cc index 8d70944b4e7..6208f62dd52 100644 --- a/test/cpp/interop/xds_interop_server.cc +++ b/test/cpp/interop/xds_interop_server.cc @@ -49,6 +49,7 @@ grpc::CsmObservability EnableCsmObservability() { // default was "localhost:9464" which causes connection issue across GKE // pods opts.url = "0.0.0.0:9464"; + opts.without_otel_scope = false; auto prometheus_exporter = opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); auto meter_provider =