[OTel] Set prometheus exporter option to populate otel scope (#38170)

Fix #38169

Closes #38170

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/38170 from yashykt:OpenTelMetricsOptions 8ea4ed82ed
PiperOrigin-RevId: 698849889
pull/34366/merge
Yash Tibrewal 1 week ago committed by Copybara-Service
parent a5703a0693
commit c333d60fcd
  1. 1
      examples/cpp/csm/csm_greeter_client.cc
  2. 1
      examples/cpp/csm/csm_greeter_server.cc
  3. 1
      examples/cpp/csm/observability/csm_greeter_client.cc
  4. 1
      examples/cpp/csm/observability/csm_greeter_server.cc
  5. 1
      examples/cpp/otel/greeter_callback_client.cc
  6. 1
      examples/cpp/otel/greeter_callback_server.cc
  7. 1
      test/cpp/interop/xds_interop_client.cc
  8. 1
      test/cpp/interop/xds_interop_server.cc

@ -161,6 +161,7 @@ absl::StatusOr<grpc::CsmObservability> InitializeObservability() {
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE pods // default was "localhost:9464" which causes connection issue across GKE pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -103,6 +103,7 @@ int main(int argc, char** argv) {
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE pods // default was "localhost:9464" which causes connection issue across GKE pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -45,6 +45,7 @@ absl::StatusOr<grpc::CsmObservability> InitializeObservability() {
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE pods // default was "localhost:9464" which causes connection issue across GKE pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -50,6 +50,7 @@ int main(int argc, char** argv) {
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
// default was "localhost:9464" which causes connection issue across GKE pods // default was "localhost:9464" which causes connection issue across GKE pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -49,6 +49,7 @@ int main(int argc, char** argv) {
// exporter. // exporter.
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
opts.url = absl::GetFlag(FLAGS_prometheus_endpoint); opts.url = absl::GetFlag(FLAGS_prometheus_endpoint);
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -52,6 +52,7 @@ int main(int argc, char** argv) {
// exporter. // exporter.
opentelemetry::exporter::metrics::PrometheusExporterOptions opts; opentelemetry::exporter::metrics::PrometheusExporterOptions opts;
opts.url = absl::GetFlag(FLAGS_prometheus_endpoint); opts.url = absl::GetFlag(FLAGS_prometheus_endpoint);
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -430,6 +430,7 @@ grpc::CsmObservability EnableCsmObservability() {
// default was "localhost:9464" which causes connection issue across GKE // default was "localhost:9464" which causes connection issue across GKE
// pods // pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

@ -49,6 +49,7 @@ grpc::CsmObservability EnableCsmObservability() {
// default was "localhost:9464" which causes connection issue across GKE // default was "localhost:9464" which causes connection issue across GKE
// pods // pods
opts.url = "0.0.0.0:9464"; opts.url = "0.0.0.0:9464";
opts.without_otel_scope = false;
auto prometheus_exporter = auto prometheus_exporter =
opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts); opentelemetry::exporter::metrics::PrometheusExporterFactory::Create(opts);
auto meter_provider = auto meter_provider =

Loading…
Cancel
Save