Skip to content

Commit

Permalink
[OTel] Set prometheus exporter option to populate otel scope (grpc#38170
Browse files Browse the repository at this point in the history
)

Fix grpc#38169

Closes grpc#38170

COPYBARA_INTEGRATE_REVIEW=grpc#38170 from yashykt:OpenTelMetricsOptions 8ea4ed8
PiperOrigin-RevId: 698849889
  • Loading branch information
yashykt authored and copybara-github committed Nov 21, 2024
1 parent a5703a0 commit c333d60
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/cpp/csm/csm_greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ absl::StatusOr<grpc::CsmObservability> 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 =
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/csm/csm_greeter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/csm/observability/csm_greeter_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ absl::StatusOr<grpc::CsmObservability> 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 =
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/csm/observability/csm_greeter_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/otel/greeter_callback_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/otel/greeter_callback_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions test/cpp/interop/xds_interop_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions test/cpp/interop/xds_interop_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit c333d60

Please sign in to comment.