@@ -106,13 +106,13 @@ public static void setup() {
106106 .put (BuiltInMetricsConstant .CLIENT_NAME_KEY , client_name )
107107 .put (BuiltInMetricsConstant .CLIENT_UID_KEY , attributes .get ("client_uid" ))
108108 .put (BuiltInMetricsConstant .CLIENT_HASH_KEY , attributes .get ("client_hash" ))
109+ .put (BuiltInMetricsConstant .INSTANCE_ID_KEY , "i" )
110+ .put (BuiltInMetricsConstant .DATABASE_KEY , "d" )
111+ .put (BuiltInMetricsConstant .DIRECT_PATH_ENABLED_KEY , "false" )
109112 .build ();
110113
111114 expectedCommonRequestAttributes =
112115 Attributes .builder ()
113- .put (BuiltInMetricsConstant .INSTANCE_ID_KEY , "i" )
114- .put (BuiltInMetricsConstant .DATABASE_KEY , "d" )
115- .put (BuiltInMetricsConstant .DIRECT_PATH_ENABLED_KEY , "false" )
116116 .put (BuiltInMetricsConstant .DIRECT_PATH_USED_KEY , "false" )
117117 .build ();
118118 }
@@ -308,7 +308,7 @@ public void testNoNetworkConnection() {
308308 .setApiTracerFactory (metricsTracerFactory )
309309 .build ()
310310 .getService ();
311- String instance = "test-instance " ;
311+ String instance = "i " ;
312312 DatabaseClient client = spanner .getDatabaseClient (DatabaseId .of ("test-project" , instance , "d" ));
313313
314314 // Using this client will return UNAVAILABLE, as the server is not reachable and we have
@@ -319,29 +319,24 @@ public void testNoNetworkConnection() {
319319 assertEquals (ErrorCode .UNAVAILABLE , exception .getErrorCode ());
320320
321321 Attributes expectedAttributesCreateSessionOK =
322- expectedBaseAttributes
322+ expectedCommonBaseAttributes
323323 .toBuilder ()
324+ .putAll (expectedCommonRequestAttributes )
324325 .put (BuiltInMetricsConstant .STATUS_KEY , "OK" )
325326 .put (BuiltInMetricsConstant .METHOD_KEY , "Spanner.CreateSession" )
326327 // Include the additional attributes that are added by the HeaderInterceptor in the
327328 // filter. Note that the DIRECT_PATH_USED attribute is not added, as the request never
328329 // leaves the client.
329- .put (BuiltInMetricsConstant .INSTANCE_ID_KEY , instance )
330- .put (BuiltInMetricsConstant .DATABASE_KEY , "d" )
331- .put (BuiltInMetricsConstant .DIRECT_PATH_ENABLED_KEY , "false" )
332330 .build ();
333331
334332 Attributes expectedAttributesCreateSessionFailed =
335- expectedBaseAttributes
333+ expectedCommonBaseAttributes
336334 .toBuilder ()
337335 .put (BuiltInMetricsConstant .STATUS_KEY , "UNAVAILABLE" )
338336 .put (BuiltInMetricsConstant .METHOD_KEY , "Spanner.CreateSession" )
339337 // Include the additional attributes that are added by the HeaderInterceptor in the
340338 // filter. Note that the DIRECT_PATH_USED attribute is not added, as the request never
341339 // leaves the client.
342- .put (BuiltInMetricsConstant .INSTANCE_ID_KEY , instance )
343- .put (BuiltInMetricsConstant .DATABASE_KEY , "d" )
344- .put (BuiltInMetricsConstant .DIRECT_PATH_ENABLED_KEY , "false" )
345340 .build ();
346341
347342 MetricData attemptCountMetricData =
0 commit comments