Skip to content

Commit

Permalink
impl(GCS+gRPC): export metrics with desired monitored resource
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan committed Jun 27, 2024
1 parent 8d01ae3 commit ca3e8ef
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions google/cloud/storage/internal/grpc/metrics_exporter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,6 @@ absl::optional<ExporterConfig> MakeMeterProviderConfig(
void EnableGrpcMetricsImpl(ExporterConfig config) {
if (!ExporterRegistry::Singleton().Register(config.authority)) return;

// TODO(#13998) - the service is not ready to receive the monitored resource
// and metrics defined for Google Cloud Storage clients. Erase this code
// when it is.
auto monitored_resource =
config.exporter_options.get<otel_internal::MonitoredResourceOption>();
monitored_resource.set_type("generic_task");
auto& labels = *monitored_resource.mutable_labels();
// project_id untouched
// location untouched
labels["namespace"] = "storage_client";
labels["job"] = labels["host_id"];
labels["task_id"] = labels["instance_id"];
labels.erase("cloud_platform");
labels.erase("host_id");
labels.erase("instance_id");
labels.erase("api");
config.exporter_options.set<otel_internal::ServiceTimeSeriesOption>(false)
.set<otel_internal::MetricNameFormatterOption>([](std::string s) {
return "workload.googleapis.com/" + std::move(s);
})
.set<otel_internal::MonitoredResourceOption>(
std::move(monitored_resource));
// END TODO(#13998) - end of code to erase.

auto exporter = otel_internal::MakeMonitoringExporter(
std::move(config.project),
monitoring_v3::MakeMetricServiceConnection(
Expand Down

0 comments on commit ca3e8ef

Please sign in to comment.