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 May 22, 2024
1 parent 1a99600 commit a55d4d0
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions google/cloud/storage/internal/grpc/metrics_exporter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +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::MetricPrefixOption>("workload.googleapis.com/")
.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 a55d4d0

Please sign in to comment.