2424import static com .google .common .truth .TruthJUnit .assume ;
2525
2626import com .google .api .client .util .Lists ;
27- import com .google .cloud .bigtable .admin .v2 .BigtableInstanceAdminClient ;
2827import com .google .cloud .bigtable .admin .v2 .BigtableTableAdminClient ;
29- import com .google .cloud .bigtable .admin .v2 .models .AppProfile ;
30- import com .google .cloud .bigtable .admin .v2 .models .CreateAppProfileRequest ;
3128import com .google .cloud .bigtable .admin .v2 .models .CreateTableRequest ;
3229import com .google .cloud .bigtable .admin .v2 .models .Table ;
3330import com .google .cloud .bigtable .data .v2 .BigtableDataClient ;
@@ -94,12 +91,9 @@ public class BuiltinMetricsIT {
9491 private BigtableDataClient clientCustomOtel ;
9592 private BigtableDataClient clientDefault ;
9693 private BigtableTableAdminClient tableAdminClient ;
97- private BigtableInstanceAdminClient instanceAdminClient ;
9894 private MetricServiceClient metricClient ;
9995
10096 private InMemoryMetricReader metricReader ;
101- private String appProfileCustomOtel ;
102- private String appProfileDefault ;
10397
10498 public static String [] VIEWS = {
10599 "operation_latencies" ,
@@ -131,19 +125,6 @@ public void setup() throws IOException {
131125 metricClient = MetricServiceClient .create ();
132126
133127 tableAdminClient = testEnvRule .env ().getTableAdminClient ();
134- instanceAdminClient = testEnvRule .env ().getInstanceAdminClient ();
135- appProfileCustomOtel = PrefixGenerator .newPrefix ("test1" );
136- appProfileDefault = PrefixGenerator .newPrefix ("test2" );
137- instanceAdminClient .createAppProfile (
138- CreateAppProfileRequest .of (testEnvRule .env ().getInstanceId (), appProfileCustomOtel )
139- .setRoutingPolicy (
140- AppProfile .SingleClusterRoutingPolicy .of (testEnvRule .env ().getPrimaryClusterId ()))
141- .setIsolationPolicy (AppProfile .StandardIsolationPolicy .of (AppProfile .Priority .LOW )));
142- instanceAdminClient .createAppProfile (
143- CreateAppProfileRequest .of (testEnvRule .env ().getInstanceId (), appProfileDefault )
144- .setRoutingPolicy (
145- AppProfile .SingleClusterRoutingPolicy .of (testEnvRule .env ().getPrimaryClusterId ()))
146- .setIsolationPolicy (AppProfile .StandardIsolationPolicy .of (AppProfile .Priority .LOW )));
147128
148129 // When using the custom OTEL instance, we can also register a InMemoryMetricReader on the
149130 // SdkMeterProvider to verify the data exported on Cloud Monitoring with the in memory metric
@@ -162,9 +143,8 @@ public void setup() throws IOException {
162143 BigtableDataClient .create (
163144 settings
164145 .setMetricsProvider (CustomOpenTelemetryMetricsProvider .create (openTelemetry ))
165- .setAppProfileId (appProfileCustomOtel )
166146 .build ());
167- clientDefault = BigtableDataClient .create (settings .setAppProfileId ( appProfileDefault ). build ());
147+ clientDefault = BigtableDataClient .create (settings .build ());
168148 }
169149
170150 @ After
@@ -178,12 +158,7 @@ public void tearDown() {
178158 if (tableDefault != null ) {
179159 tableAdminClient .deleteTable (tableDefault .getId ());
180160 }
181- if (instanceAdminClient != null ) {
182- instanceAdminClient .deleteAppProfile (
183- testEnvRule .env ().getInstanceId (), appProfileCustomOtel , true );
184- instanceAdminClient .deleteAppProfile (
185- testEnvRule .env ().getInstanceId (), appProfileDefault , true );
186- }
161+
187162 if (clientCustomOtel != null ) {
188163 clientCustomOtel .close ();
189164 }
@@ -231,8 +206,8 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
231206 String .format (
232207 "metric.type=\" bigtable.googleapis.com/client/%s\" "
233208 + "AND resource.labels.instance=\" %s\" AND metric.labels.method=\" Bigtable.MutateRow\" "
234- + " AND resource.labels.table=\" %s\" AND metric.labels.app_profile= \" %s \" " ,
235- view , testEnvRule .env ().getInstanceId (), tableDefault .getId (), appProfileDefault );
209+ + " AND resource.labels.table=\" %s\" " ,
210+ view , testEnvRule .env ().getInstanceId (), tableDefault .getId ());
236211 ListTimeSeriesRequest .Builder requestBuilder =
237212 ListTimeSeriesRequest .newBuilder ()
238213 .setName (name .toString ())
@@ -246,8 +221,8 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
246221 String .format (
247222 "metric.type=\" bigtable.googleapis.com/client/%s\" "
248223 + "AND resource.labels.instance=\" %s\" AND metric.labels.method=\" Bigtable.ReadRows\" "
249- + " AND resource.labels.table=\" %s\" AND metric.labels.app_profile= \" %s \" " ,
250- view , testEnvRule .env ().getInstanceId (), tableDefault .getId (), appProfileDefault );
224+ + " AND resource.labels.table=\" %s\" " ,
225+ view , testEnvRule .env ().getInstanceId (), tableDefault .getId ());
251226 requestBuilder .setFilter (metricFilter );
252227
253228 verifyMetricsArePublished (requestBuilder .build (), metricsPollingStopwatch , view );
@@ -299,11 +274,8 @@ public void testBuiltinMetricsWithCustomOTEL() throws Exception {
299274 String .format (
300275 "metric.type=\" bigtable.googleapis.com/client/%s\" "
301276 + "AND resource.labels.instance=\" %s\" AND metric.labels.method=\" Bigtable.MutateRow\" "
302- + " AND resource.labels.table=\" %s\" AND metric.labels.app_profile=\" %s\" " ,
303- view ,
304- testEnvRule .env ().getInstanceId (),
305- tableCustomOtel .getId (),
306- appProfileCustomOtel );
277+ + " AND resource.labels.table=\" %s\" " ,
278+ view , testEnvRule .env ().getInstanceId (), tableCustomOtel .getId ());
307279 ListTimeSeriesRequest .Builder requestBuilder =
308280 ListTimeSeriesRequest .newBuilder ()
309281 .setName (name .toString ())
@@ -320,11 +292,8 @@ public void testBuiltinMetricsWithCustomOTEL() throws Exception {
320292 String .format (
321293 "metric.type=\" bigtable.googleapis.com/client/%s\" "
322294 + "AND resource.labels.instance=\" %s\" AND metric.labels.method=\" Bigtable.ReadRows\" "
323- + " AND resource.labels.table=\" %s\" AND metric.labels.app_profile=\" %s\" " ,
324- view ,
325- testEnvRule .env ().getInstanceId (),
326- tableCustomOtel .getId (),
327- appProfileCustomOtel );
295+ + " AND resource.labels.table=\" %s\" " ,
296+ view , testEnvRule .env ().getInstanceId (), tableCustomOtel .getId ());
328297 requestBuilder .setFilter (metricFilter );
329298
330299 response = verifyMetricsArePublished (requestBuilder .build (), metricsPollingStopwatch , view );
0 commit comments