24
24
import static com .google .common .truth .TruthJUnit .assume ;
25
25
26
26
import com .google .api .client .util .Lists ;
27
- import com .google .cloud .bigtable .admin .v2 .BigtableInstanceAdminClient ;
28
27
import 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 ;
31
28
import com .google .cloud .bigtable .admin .v2 .models .CreateTableRequest ;
32
29
import com .google .cloud .bigtable .admin .v2 .models .Table ;
33
30
import com .google .cloud .bigtable .data .v2 .BigtableDataClient ;
@@ -94,12 +91,9 @@ public class BuiltinMetricsIT {
94
91
private BigtableDataClient clientCustomOtel ;
95
92
private BigtableDataClient clientDefault ;
96
93
private BigtableTableAdminClient tableAdminClient ;
97
- private BigtableInstanceAdminClient instanceAdminClient ;
98
94
private MetricServiceClient metricClient ;
99
95
100
96
private InMemoryMetricReader metricReader ;
101
- private String appProfileCustomOtel ;
102
- private String appProfileDefault ;
103
97
104
98
public static String [] VIEWS = {
105
99
"operation_latencies" ,
@@ -131,19 +125,6 @@ public void setup() throws IOException {
131
125
metricClient = MetricServiceClient .create ();
132
126
133
127
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 )));
147
128
148
129
// When using the custom OTEL instance, we can also register a InMemoryMetricReader on the
149
130
// SdkMeterProvider to verify the data exported on Cloud Monitoring with the in memory metric
@@ -162,9 +143,8 @@ public void setup() throws IOException {
162
143
BigtableDataClient .create (
163
144
settings
164
145
.setMetricsProvider (CustomOpenTelemetryMetricsProvider .create (openTelemetry ))
165
- .setAppProfileId (appProfileCustomOtel )
166
146
.build ());
167
- clientDefault = BigtableDataClient .create (settings .setAppProfileId ( appProfileDefault ). build ());
147
+ clientDefault = BigtableDataClient .create (settings .build ());
168
148
}
169
149
170
150
@ After
@@ -178,12 +158,7 @@ public void tearDown() {
178
158
if (tableDefault != null ) {
179
159
tableAdminClient .deleteTable (tableDefault .getId ());
180
160
}
181
- if (instanceAdminClient != null ) {
182
- instanceAdminClient .deleteAppProfile (
183
- testEnvRule .env ().getInstanceId (), appProfileCustomOtel , true );
184
- instanceAdminClient .deleteAppProfile (
185
- testEnvRule .env ().getInstanceId (), appProfileDefault , true );
186
- }
161
+
187
162
if (clientCustomOtel != null ) {
188
163
clientCustomOtel .close ();
189
164
}
@@ -231,8 +206,8 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
231
206
String .format (
232
207
"metric.type=\" bigtable.googleapis.com/client/%s\" "
233
208
+ "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 ());
236
211
ListTimeSeriesRequest .Builder requestBuilder =
237
212
ListTimeSeriesRequest .newBuilder ()
238
213
.setName (name .toString ())
@@ -246,8 +221,8 @@ public void testBuiltinMetricsWithDefaultOTEL() throws Exception {
246
221
String .format (
247
222
"metric.type=\" bigtable.googleapis.com/client/%s\" "
248
223
+ "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 ());
251
226
requestBuilder .setFilter (metricFilter );
252
227
253
228
verifyMetricsArePublished (requestBuilder .build (), metricsPollingStopwatch , view );
@@ -299,11 +274,8 @@ public void testBuiltinMetricsWithCustomOTEL() throws Exception {
299
274
String .format (
300
275
"metric.type=\" bigtable.googleapis.com/client/%s\" "
301
276
+ "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 ());
307
279
ListTimeSeriesRequest .Builder requestBuilder =
308
280
ListTimeSeriesRequest .newBuilder ()
309
281
.setName (name .toString ())
@@ -320,11 +292,8 @@ public void testBuiltinMetricsWithCustomOTEL() throws Exception {
320
292
String .format (
321
293
"metric.type=\" bigtable.googleapis.com/client/%s\" "
322
294
+ "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 ());
328
297
requestBuilder .setFilter (metricFilter );
329
298
330
299
response = verifyMetricsArePublished (requestBuilder .build (), metricsPollingStopwatch , view );
0 commit comments