diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java index 79d27b7fa..2438d7e9c 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/it/BuiltinMetricsIT.java @@ -24,10 +24,7 @@ import static com.google.common.truth.TruthJUnit.assume; import com.google.api.client.util.Lists; -import com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient; import com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient; -import com.google.cloud.bigtable.admin.v2.models.AppProfile; -import com.google.cloud.bigtable.admin.v2.models.CreateAppProfileRequest; import com.google.cloud.bigtable.admin.v2.models.CreateTableRequest; import com.google.cloud.bigtable.admin.v2.models.Table; import com.google.cloud.bigtable.data.v2.BigtableDataClient; @@ -94,12 +91,9 @@ public class BuiltinMetricsIT { private BigtableDataClient clientCustomOtel; private BigtableDataClient clientDefault; private BigtableTableAdminClient tableAdminClient; - private BigtableInstanceAdminClient instanceAdminClient; private MetricServiceClient metricClient; private InMemoryMetricReader metricReader; - private String appProfileCustomOtel; - private String appProfileDefault; public static String[] VIEWS = { "operation_latencies", @@ -131,19 +125,6 @@ public void setup() throws IOException { metricClient = MetricServiceClient.create(); tableAdminClient = testEnvRule.env().getTableAdminClient(); - instanceAdminClient = testEnvRule.env().getInstanceAdminClient(); - appProfileCustomOtel = PrefixGenerator.newPrefix("test1"); - appProfileDefault = PrefixGenerator.newPrefix("test2"); - instanceAdminClient.createAppProfile( - CreateAppProfileRequest.of(testEnvRule.env().getInstanceId(), appProfileCustomOtel) - .setRoutingPolicy( - AppProfile.SingleClusterRoutingPolicy.of(testEnvRule.env().getPrimaryClusterId())) - .setIsolationPolicy(AppProfile.StandardIsolationPolicy.of(AppProfile.Priority.LOW))); - instanceAdminClient.createAppProfile( - CreateAppProfileRequest.of(testEnvRule.env().getInstanceId(), appProfileDefault) - .setRoutingPolicy( - AppProfile.SingleClusterRoutingPolicy.of(testEnvRule.env().getPrimaryClusterId())) - .setIsolationPolicy(AppProfile.StandardIsolationPolicy.of(AppProfile.Priority.LOW))); // When using the custom OTEL instance, we can also register a InMemoryMetricReader on the // SdkMeterProvider to verify the data exported on Cloud Monitoring with the in memory metric @@ -162,9 +143,8 @@ public void setup() throws IOException { BigtableDataClient.create( settings .setMetricsProvider(CustomOpenTelemetryMetricsProvider.create(openTelemetry)) - .setAppProfileId(appProfileCustomOtel) .build()); - clientDefault = BigtableDataClient.create(settings.setAppProfileId(appProfileDefault).build()); + clientDefault = BigtableDataClient.create(settings.build()); } @After @@ -178,12 +158,7 @@ public void tearDown() { if (tableDefault != null) { tableAdminClient.deleteTable(tableDefault.getId()); } - if (instanceAdminClient != null) { - instanceAdminClient.deleteAppProfile( - testEnvRule.env().getInstanceId(), appProfileCustomOtel, true); - instanceAdminClient.deleteAppProfile( - testEnvRule.env().getInstanceId(), appProfileDefault, true); - } + if (clientCustomOtel != null) { clientCustomOtel.close(); } @@ -231,8 +206,8 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception { String.format( "metric.type=\"bigtable.googleapis.com/client/%s\" " + "AND resource.labels.instance=\"%s\" AND metric.labels.method=\"Bigtable.MutateRow\"" - + " AND resource.labels.table=\"%s\" AND metric.labels.app_profile=\"%s\"", - view, testEnvRule.env().getInstanceId(), tableDefault.getId(), appProfileDefault); + + " AND resource.labels.table=\"%s\"", + view, testEnvRule.env().getInstanceId(), tableDefault.getId()); ListTimeSeriesRequest.Builder requestBuilder = ListTimeSeriesRequest.newBuilder() .setName(name.toString()) @@ -246,8 +221,8 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception { String.format( "metric.type=\"bigtable.googleapis.com/client/%s\" " + "AND resource.labels.instance=\"%s\" AND metric.labels.method=\"Bigtable.ReadRows\"" - + " AND resource.labels.table=\"%s\" AND metric.labels.app_profile=\"%s\"", - view, testEnvRule.env().getInstanceId(), tableDefault.getId(), appProfileDefault); + + " AND resource.labels.table=\"%s\"", + view, testEnvRule.env().getInstanceId(), tableDefault.getId()); requestBuilder.setFilter(metricFilter); verifyMetricsArePublished(requestBuilder.build(), metricsPollingStopwatch, view); @@ -299,11 +274,8 @@ public void testBuiltinMetricsWithCustomOTEL() throws Exception { String.format( "metric.type=\"bigtable.googleapis.com/client/%s\" " + "AND resource.labels.instance=\"%s\" AND metric.labels.method=\"Bigtable.MutateRow\"" - + " AND resource.labels.table=\"%s\" AND metric.labels.app_profile=\"%s\"", - view, - testEnvRule.env().getInstanceId(), - tableCustomOtel.getId(), - appProfileCustomOtel); + + " AND resource.labels.table=\"%s\"", + view, testEnvRule.env().getInstanceId(), tableCustomOtel.getId()); ListTimeSeriesRequest.Builder requestBuilder = ListTimeSeriesRequest.newBuilder() .setName(name.toString()) @@ -320,11 +292,8 @@ public void testBuiltinMetricsWithCustomOTEL() throws Exception { String.format( "metric.type=\"bigtable.googleapis.com/client/%s\" " + "AND resource.labels.instance=\"%s\" AND metric.labels.method=\"Bigtable.ReadRows\"" - + " AND resource.labels.table=\"%s\" AND metric.labels.app_profile=\"%s\"", - view, - testEnvRule.env().getInstanceId(), - tableCustomOtel.getId(), - appProfileCustomOtel); + + " AND resource.labels.table=\"%s\"", + view, testEnvRule.env().getInstanceId(), tableCustomOtel.getId()); requestBuilder.setFilter(metricFilter); response = verifyMetricsArePublished(requestBuilder.build(), metricsPollingStopwatch, view);