3535
3636import com .google .api .client .http .HttpTransport ;
3737import com .google .api .gax .core .NoCredentialsProvider ;
38- import com .google .api .gax .rpc .StatusCode ;
3938import com .google .api .gax .rpc .TransportChannelProvider ;
4039import com .google .api .gax .rpc .UnavailableException ;
4140import com .google .api .gax .tracing .GoldenSignalsMetricsTracerFactory ;
4241import com .google .api .gax .tracing .ObservabilityAttributes ;
4342import com .google .common .collect .ImmutableList ;
44- import com .google .rpc .Status ;
4543import com .google .showcase .v1beta1 .EchoClient ;
4644import com .google .showcase .v1beta1 .EchoRequest ;
47- import com .google .showcase .v1beta1 .EchoResponse ;
4845import com .google .showcase .v1beta1 .EchoSettings ;
4946import com .google .showcase .v1beta1 .it .util .TestClientInitializer ;
5047import com .google .showcase .v1beta1 .stub .EchoStubSettings ;
5148import io .grpc .CallOptions ;
5249import io .grpc .Channel ;
5350import io .grpc .ClientCall ;
5451import io .grpc .ClientInterceptor ;
55- import io .grpc .MethodDescriptor ;
5652import io .grpc .Metadata ;
53+ import io .grpc .MethodDescriptor ;
5754import io .opentelemetry .api .common .AttributeKey ;
5855import io .opentelemetry .sdk .OpenTelemetrySdk ;
5956import io .opentelemetry .sdk .metrics .SdkMeterProvider ;
@@ -103,7 +100,8 @@ void testMetrics_successfulEcho_grpc() throws Exception {
103100
104101 // The end of an operation is tracked in a separate thread.
105102 // Add a small sleep to make sure the tracking is completed.
106- // This is implemented by adding a TraceFinisher to ApiFuture as a callback in TracedUnaryCallable,
103+ // This is implemented by adding a TraceFinisher to ApiFuture as a callback in
104+ // TracedUnaryCallable,
107105 // which could be executed in a different thread.
108106 Thread .sleep (100 );
109107 Collection <MetricData > metrics = metricReader .collectAllMetrics ();
@@ -122,22 +120,27 @@ void testMetrics_successfulEcho_grpc() throws Exception {
122120 durationMetric .getHistogramData ().getPoints ().iterator ().next ().getAttributes ();
123121
124122 assertThat (
125- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .SERVER_ADDRESS_ATTRIBUTE )))
123+ attributes .get (
124+ AttributeKey .stringKey (ObservabilityAttributes .SERVER_ADDRESS_ATTRIBUTE )))
126125 .isEqualTo (SHOWCASE_SERVER_ADDRESS );
127126 assertThat (
128127 attributes .get (AttributeKey .longKey (ObservabilityAttributes .SERVER_PORT_ATTRIBUTE )))
129128 .isEqualTo (SHOWCASE_SERVER_PORT );
130129 assertThat (
131- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .RPC_SYSTEM_NAME_ATTRIBUTE )))
130+ attributes .get (
131+ AttributeKey .stringKey (ObservabilityAttributes .RPC_SYSTEM_NAME_ATTRIBUTE )))
132132 .isEqualTo ("grpc" );
133133 assertThat (
134- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .GCP_CLIENT_SERVICE_ATTRIBUTE )))
134+ attributes .get (
135+ AttributeKey .stringKey (ObservabilityAttributes .GCP_CLIENT_SERVICE_ATTRIBUTE )))
135136 .isEqualTo ("showcase" );
136137 assertThat (
137- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .GRPC_RPC_METHOD_ATTRIBUTE )))
138+ attributes .get (
139+ AttributeKey .stringKey (ObservabilityAttributes .GRPC_RPC_METHOD_ATTRIBUTE )))
138140 .isEqualTo ("google.showcase.v1beta1.Echo/Echo" );
139141 assertThat (
140- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
142+ attributes .get (
143+ AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
141144 .isEqualTo ("OK" );
142145 }
143146 }
@@ -201,7 +204,8 @@ public void sendMessage(ReqT message) {}
201204 durationMetric .getHistogramData ().getPoints ().iterator ().next ().getAttributes ();
202205
203206 assertThat (
204- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
207+ attributes .get (
208+ AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
205209 .isEqualTo ("UNAVAILABLE" );
206210 assertThat (
207211 attributes .get (AttributeKey .stringKey (ObservabilityAttributes .ERROR_TYPE_ATTRIBUTE )))
@@ -236,29 +240,36 @@ void testMetrics_successfulEcho_httpjson() throws Exception {
236240 durationMetric .getHistogramData ().getPoints ().iterator ().next ().getAttributes ();
237241
238242 assertThat (
239- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .SERVER_ADDRESS_ATTRIBUTE )))
243+ attributes .get (
244+ AttributeKey .stringKey (ObservabilityAttributes .SERVER_ADDRESS_ATTRIBUTE )))
240245 .isEqualTo (SHOWCASE_SERVER_ADDRESS );
241246 assertThat (
242247 attributes .get (AttributeKey .longKey (ObservabilityAttributes .SERVER_PORT_ATTRIBUTE )))
243248 .isEqualTo (SHOWCASE_SERVER_PORT );
244249 assertThat (
245- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .RPC_SYSTEM_NAME_ATTRIBUTE )))
250+ attributes .get (
251+ AttributeKey .stringKey (ObservabilityAttributes .RPC_SYSTEM_NAME_ATTRIBUTE )))
246252 .isEqualTo ("http" );
247253 assertThat (
248- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .GCP_CLIENT_SERVICE_ATTRIBUTE )))
254+ attributes .get (
255+ AttributeKey .stringKey (ObservabilityAttributes .GCP_CLIENT_SERVICE_ATTRIBUTE )))
249256 .isEqualTo ("showcase" );
250257 assertThat (
251- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
258+ attributes .get (
259+ AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
252260 .isEqualTo ("OK" );
253261 assertThat (
254- attributes .get (AttributeKey .longKey (ObservabilityAttributes .HTTP_RESPONSE_STATUS_ATTRIBUTE )))
262+ attributes .get (
263+ AttributeKey .longKey (ObservabilityAttributes .HTTP_RESPONSE_STATUS_ATTRIBUTE )))
255264 .isEqualTo (200L );
256265 assertThat (
257- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .URL_TEMPLATE_ATTRIBUTE )))
266+ attributes .get (
267+ AttributeKey .stringKey (ObservabilityAttributes .URL_TEMPLATE_ATTRIBUTE )))
258268 .isEqualTo ("v1beta1/echo:echo" );
259269 assertThat (
260- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .GRPC_RPC_METHOD_ATTRIBUTE )))
261- .isEqualTo ("google.showcase.v1beta1.Echo/Echo" );
270+ attributes .get (
271+ AttributeKey .stringKey (ObservabilityAttributes .GRPC_RPC_METHOD_ATTRIBUTE )))
272+ .isEqualTo ("google.showcase.v1beta1.Echo/Echo" );
262273 }
263274 }
264275
@@ -369,10 +380,12 @@ public String getHeaderValue(int index) {
369380 durationMetric .getHistogramData ().getPoints ().iterator ().next ().getAttributes ();
370381
371382 assertThat (
372- attributes .get (AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
383+ attributes .get (
384+ AttributeKey .stringKey (ObservabilityAttributes .RPC_RESPONSE_STATUS_ATTRIBUTE )))
373385 .isEqualTo ("UNAVAILABLE" );
374386 assertThat (
375- attributes .get (AttributeKey .longKey (ObservabilityAttributes .HTTP_RESPONSE_STATUS_ATTRIBUTE )))
387+ attributes .get (
388+ AttributeKey .longKey (ObservabilityAttributes .HTTP_RESPONSE_STATUS_ATTRIBUTE )))
376389 .isEqualTo (503L );
377390 assertThat (
378391 attributes .get (AttributeKey .stringKey (ObservabilityAttributes .ERROR_TYPE_ATTRIBUTE )))
0 commit comments