Skip to content

Commit 9601953

Browse files
committed
style: revert formatting on unrelated files
1 parent b22433d commit 9601953

File tree

3 files changed

+34
-49
lines changed

3 files changed

+34
-49
lines changed

sdk-platform-java/java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelGoldenMetrics.java

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,25 @@
3535

3636
import com.google.api.client.http.HttpTransport;
3737
import com.google.api.gax.core.NoCredentialsProvider;
38+
import com.google.api.gax.rpc.StatusCode;
3839
import com.google.api.gax.rpc.TransportChannelProvider;
3940
import com.google.api.gax.rpc.UnavailableException;
4041
import com.google.api.gax.tracing.GoldenSignalsMetricsTracerFactory;
4142
import com.google.api.gax.tracing.ObservabilityAttributes;
4243
import com.google.common.collect.ImmutableList;
44+
import com.google.rpc.Status;
4345
import com.google.showcase.v1beta1.EchoClient;
4446
import com.google.showcase.v1beta1.EchoRequest;
47+
import com.google.showcase.v1beta1.EchoResponse;
4548
import com.google.showcase.v1beta1.EchoSettings;
4649
import com.google.showcase.v1beta1.it.util.TestClientInitializer;
4750
import com.google.showcase.v1beta1.stub.EchoStubSettings;
4851
import io.grpc.CallOptions;
4952
import io.grpc.Channel;
5053
import io.grpc.ClientCall;
5154
import io.grpc.ClientInterceptor;
52-
import io.grpc.Metadata;
5355
import io.grpc.MethodDescriptor;
56+
import io.grpc.Metadata;
5457
import io.opentelemetry.api.common.AttributeKey;
5558
import io.opentelemetry.sdk.OpenTelemetrySdk;
5659
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
@@ -100,8 +103,7 @@ void testMetrics_successfulEcho_grpc() throws Exception {
100103

101104
// The end of an operation is tracked in a separate thread.
102105
// Add a small sleep to make sure the tracking is completed.
103-
// This is implemented by adding a TraceFinisher to ApiFuture as a callback in
104-
// TracedUnaryCallable,
106+
// This is implemented by adding a TraceFinisher to ApiFuture as a callback in TracedUnaryCallable,
105107
// which could be executed in a different thread.
106108
Thread.sleep(100);
107109
Collection<MetricData> metrics = metricReader.collectAllMetrics();
@@ -120,27 +122,22 @@ void testMetrics_successfulEcho_grpc() throws Exception {
120122
durationMetric.getHistogramData().getPoints().iterator().next().getAttributes();
121123

122124
assertThat(
123-
attributes.get(
124-
AttributeKey.stringKey(ObservabilityAttributes.SERVER_ADDRESS_ATTRIBUTE)))
125+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.SERVER_ADDRESS_ATTRIBUTE)))
125126
.isEqualTo(SHOWCASE_SERVER_ADDRESS);
126127
assertThat(
127128
attributes.get(AttributeKey.longKey(ObservabilityAttributes.SERVER_PORT_ATTRIBUTE)))
128129
.isEqualTo(SHOWCASE_SERVER_PORT);
129130
assertThat(
130-
attributes.get(
131-
AttributeKey.stringKey(ObservabilityAttributes.RPC_SYSTEM_NAME_ATTRIBUTE)))
131+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.RPC_SYSTEM_NAME_ATTRIBUTE)))
132132
.isEqualTo("grpc");
133133
assertThat(
134-
attributes.get(
135-
AttributeKey.stringKey(ObservabilityAttributes.GCP_CLIENT_SERVICE_ATTRIBUTE)))
134+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.GCP_CLIENT_SERVICE_ATTRIBUTE)))
136135
.isEqualTo("showcase");
137136
assertThat(
138-
attributes.get(
139-
AttributeKey.stringKey(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE)))
137+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE)))
140138
.isEqualTo("google.showcase.v1beta1.Echo/Echo");
141139
assertThat(
142-
attributes.get(
143-
AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
140+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
144141
.isEqualTo("OK");
145142
}
146143
}
@@ -204,8 +201,7 @@ public void sendMessage(ReqT message) {}
204201
durationMetric.getHistogramData().getPoints().iterator().next().getAttributes();
205202

206203
assertThat(
207-
attributes.get(
208-
AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
204+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
209205
.isEqualTo("UNAVAILABLE");
210206
assertThat(
211207
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.ERROR_TYPE_ATTRIBUTE)))
@@ -240,36 +236,29 @@ void testMetrics_successfulEcho_httpjson() throws Exception {
240236
durationMetric.getHistogramData().getPoints().iterator().next().getAttributes();
241237

242238
assertThat(
243-
attributes.get(
244-
AttributeKey.stringKey(ObservabilityAttributes.SERVER_ADDRESS_ATTRIBUTE)))
239+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.SERVER_ADDRESS_ATTRIBUTE)))
245240
.isEqualTo(SHOWCASE_SERVER_ADDRESS);
246241
assertThat(
247242
attributes.get(AttributeKey.longKey(ObservabilityAttributes.SERVER_PORT_ATTRIBUTE)))
248243
.isEqualTo(SHOWCASE_SERVER_PORT);
249244
assertThat(
250-
attributes.get(
251-
AttributeKey.stringKey(ObservabilityAttributes.RPC_SYSTEM_NAME_ATTRIBUTE)))
245+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.RPC_SYSTEM_NAME_ATTRIBUTE)))
252246
.isEqualTo("http");
253247
assertThat(
254-
attributes.get(
255-
AttributeKey.stringKey(ObservabilityAttributes.GCP_CLIENT_SERVICE_ATTRIBUTE)))
248+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.GCP_CLIENT_SERVICE_ATTRIBUTE)))
256249
.isEqualTo("showcase");
257250
assertThat(
258-
attributes.get(
259-
AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
251+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
260252
.isEqualTo("OK");
261253
assertThat(
262-
attributes.get(
263-
AttributeKey.longKey(ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE)))
254+
attributes.get(AttributeKey.longKey(ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE)))
264255
.isEqualTo(200L);
265256
assertThat(
266-
attributes.get(
267-
AttributeKey.stringKey(ObservabilityAttributes.URL_TEMPLATE_ATTRIBUTE)))
257+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.URL_TEMPLATE_ATTRIBUTE)))
268258
.isEqualTo("v1beta1/echo:echo");
269259
assertThat(
270-
attributes.get(
271-
AttributeKey.stringKey(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE)))
272-
.isEqualTo("google.showcase.v1beta1.Echo/Echo");
260+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.GRPC_RPC_METHOD_ATTRIBUTE)))
261+
.isEqualTo("google.showcase.v1beta1.Echo/Echo");
273262
}
274263
}
275264

@@ -380,12 +369,10 @@ public String getHeaderValue(int index) {
380369
durationMetric.getHistogramData().getPoints().iterator().next().getAttributes();
381370

382371
assertThat(
383-
attributes.get(
384-
AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
372+
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.RPC_RESPONSE_STATUS_ATTRIBUTE)))
385373
.isEqualTo("UNAVAILABLE");
386374
assertThat(
387-
attributes.get(
388-
AttributeKey.longKey(ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE)))
375+
attributes.get(AttributeKey.longKey(ObservabilityAttributes.HTTP_RESPONSE_STATUS_ATTRIBUTE)))
389376
.isEqualTo(503L);
390377
assertThat(
391378
attributes.get(AttributeKey.stringKey(ObservabilityAttributes.ERROR_TYPE_ATTRIBUTE)))

sdk-platform-java/java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelTracePropagation.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.google.api.gax.httpjson.ApiMethodDescriptor;
2222
import com.google.api.gax.httpjson.ForwardingHttpJsonClientCall;
23+
import com.google.api.gax.httpjson.ForwardingHttpJsonClientCallListener;
2324
import com.google.api.gax.httpjson.HttpJsonCallOptions;
2425
import com.google.api.gax.httpjson.HttpJsonChannel;
2526
import com.google.api.gax.httpjson.HttpJsonClientCall;
@@ -76,8 +77,7 @@ public <RequestT, ResponseT> ClientCall<RequestT, ResponseT> interceptCall(
7677
public void start(ClientCall.Listener<ResponseT> responseListener, Metadata headers) {
7778
requestHeaders = headers;
7879
ClientCall.Listener<ResponseT> forwardingResponseListener =
79-
new ForwardingClientCallListener.SimpleForwardingClientCallListener<ResponseT>(
80-
responseListener) {
80+
new ForwardingClientCallListener.SimpleForwardingClientCallListener<ResponseT>(responseListener) {
8181
@Override
8282
public void onClose(io.grpc.Status status, Metadata trailers) {
8383
responseTrailers = trailers;
@@ -90,8 +90,7 @@ public void onClose(io.grpc.Status status, Metadata trailers) {
9090
}
9191
}
9292

93-
private static class HttpJsonResponseCapturingClientInterceptor
94-
implements HttpJsonClientInterceptor {
93+
private static class HttpJsonResponseCapturingClientInterceptor implements HttpJsonClientInterceptor {
9594
private HttpJsonMetadata requestHeaders;
9695

9796
@Override
@@ -204,8 +203,7 @@ void testTracePropagation_grpc() {
204203
String expectedTraceId = attemptSpan.getSpanContext().getTraceId();
205204
String expectedSpanId = attemptSpan.getSpanContext().getSpanId();
206205
String expectedTraceFlags = attemptSpan.getSpanContext().getTraceFlags().asHex();
207-
String expectedTraceparent =
208-
"00-" + expectedTraceId + "-" + expectedSpanId + "-" + expectedTraceFlags;
206+
String expectedTraceparent = "00-" + expectedTraceId + "-" + expectedSpanId + "-" + expectedTraceFlags;
209207

210208
String headerValue = grpcInterceptor.requestHeaders.get(TRACEPARENT_GRPC_HEADER_KEY);
211209
assertThat(headerValue).isNotNull();
@@ -230,8 +228,7 @@ void testTracePropagation_httpjson() {
230228
String expectedTraceId = attemptSpan.getSpanContext().getTraceId();
231229
String expectedSpanId = attemptSpan.getSpanContext().getSpanId();
232230
String expectedTraceFlags = attemptSpan.getSpanContext().getTraceFlags().asHex();
233-
String expectedTraceparent =
234-
"00-" + expectedTraceId + "-" + expectedSpanId + "-" + expectedTraceFlags;
231+
String expectedTraceparent = "00-" + expectedTraceId + "-" + expectedSpanId + "-" + expectedTraceFlags;
235232

236233
assertThat(httpJsonInterceptor.requestHeaders).isNotNull();
237234
Map<String, Object> headers = httpJsonInterceptor.requestHeaders.getHeaders();
@@ -240,12 +237,12 @@ void testTracePropagation_httpjson() {
240237

241238
Object headerVal = headers.get(expectedHttpHeaderKey);
242239
if (headerVal instanceof List) {
243-
@SuppressWarnings("unchecked")
244-
List<String> traceparentHeaders = (List<String>) headerVal;
245-
assertThat(traceparentHeaders).hasSize(1);
246-
assertThat(traceparentHeaders.get(0)).isEqualTo(expectedTraceparent);
240+
@SuppressWarnings("unchecked")
241+
List<String> traceparentHeaders = (List<String>) headerVal;
242+
assertThat(traceparentHeaders).hasSize(1);
243+
assertThat(traceparentHeaders.get(0)).isEqualTo(expectedTraceparent);
247244
} else {
248-
assertThat(String.valueOf(headerVal)).isEqualTo(expectedTraceparent);
245+
assertThat(String.valueOf(headerVal)).isEqualTo(expectedTraceparent);
249246
}
250247
}
251248
}

sdk-platform-java/java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/util/TestClientInitializer.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.google.showcase.v1beta1.stub.EchoStubSettings;
3939
import io.grpc.ClientInterceptor;
4040
import io.grpc.ManagedChannelBuilder;
41+
4142
import java.io.IOException;
4243
import java.util.List;
4344
import java.util.Set;
@@ -370,9 +371,9 @@ public static IdentityClient createHttpJsonIdentityClientOpentelemetry(
370371
}
371372

372373
private static EchoStub createStubWithServiceName(
373-
EchoSettings settings, ApiTracerFactory tracingFactory) throws IOException {
374+
EchoSettings settings, ApiTracerFactory tracingFactory) throws IOException {
374375
EchoStubSettings.Builder builder =
375-
(EchoStubSettings.Builder) settings.getStubSettings().toBuilder();
376+
(EchoStubSettings.Builder) settings.getStubSettings().toBuilder();
376377
builder.setTracerFactory(tracingFactory);
377378
return new ExtendedEchoStubSettings(builder).createStub();
378379
}

0 commit comments

Comments
 (0)