Skip to content

Commit 65151cb

Browse files
committed
chore: spotless
1 parent bac29f7 commit 65151cb

2 files changed

Lines changed: 34 additions & 24 deletions

File tree

  • instrumentation/finagle-http-23.11/javaagent/src
    • main/java/io/opentelemetry/javaagent/instrumentation/finaglehttp/v23_11
    • test/java/io/opentelemetry/javaagent/instrumentation/finaglehttp/v23_11

instrumentation/finagle-http-23.11/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/finaglehttp/v23_11/Helpers.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535

3636
public class Helpers {
3737

38-
private static final VirtualField<FullHttpRequest, Context> FULL_HTTP_REQUEST_CONTEXT = VirtualField.find(
39-
FullHttpRequest.class, Context.class);
40-
private static final VirtualField<HttpRequest, Context> HTTP_REQUEST_CONTEXT = VirtualField.find(
41-
HttpRequest.class, Context.class);
38+
private static final VirtualField<FullHttpRequest, Context> FULL_HTTP_REQUEST_CONTEXT =
39+
VirtualField.find(FullHttpRequest.class, Context.class);
40+
private static final VirtualField<HttpRequest, Context> HTTP_REQUEST_CONTEXT =
41+
VirtualField.find(HttpRequest.class, Context.class);
4242

4343
public static final RecordSchema.Field<Context> OTEL_CONTEXT_KEY =
4444
Request$.MODULE$.Schema().newField();
@@ -135,10 +135,13 @@ public static void mutateHandlerPipeline(Channel ch) {
135135

136136
// h1 server handler || h2 server handler;
137137
// private class on a semi-private type -- not bothering to extract that any other way
138-
if (
139-
h1Handler instanceof HttpServerCodec || (h2Handler != null && h2Handler.getClass().getName()
140-
.equals(
141-
"com.twitter.finagle.http2.transport.common.Http2StreamMessageHandler$ServerHttp2StreamMessageHandler"))) {
138+
if (h1Handler instanceof HttpServerCodec
139+
|| (h2Handler != null
140+
&& h2Handler
141+
.getClass()
142+
.getName()
143+
.equals(
144+
"com.twitter.finagle.http2.transport.common.Http2StreamMessageHandler$ServerHttp2StreamMessageHandler"))) {
142145
// ensure we capture the server context and assign it to the outgoing request before offering
143146
// to the AsyncQueue;
144147
// not applicable to clients

instrumentation/finagle-http-23.11/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/finaglehttp/v23_11/ServerH2Test.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,20 @@ void h2ProtocolUpgrade() throws Exception {
7070
cleanup.deferCleanup(client::close);
7171

7272
Response response =
73-
testing.runWithSpan("h2-upgrade-client", () -> Await.result(
74-
client.apply(
75-
Utils.buildRequest(
76-
"GET",
77-
uri,
78-
ImmutableMap.of(
79-
HttpHeaderNames.USER_AGENT.toString(),
80-
TEST_USER_AGENT,
81-
HttpHeaderNames.X_FORWARDED_FOR.toString(),
82-
TEST_CLIENT_IP))),
83-
Duration.fromSeconds(20)));
73+
testing.runWithSpan(
74+
"h2-upgrade-client",
75+
() ->
76+
Await.result(
77+
client.apply(
78+
Utils.buildRequest(
79+
"GET",
80+
uri,
81+
ImmutableMap.of(
82+
HttpHeaderNames.USER_AGENT.toString(),
83+
TEST_USER_AGENT,
84+
HttpHeaderNames.X_FORWARDED_FOR.toString(),
85+
TEST_CLIENT_IP))),
86+
Duration.fromSeconds(20)));
8487

8588
assertThat(response.status().code()).isEqualTo(SUCCESS.getStatus());
8689
assertThat(response.contentString()).isEqualTo(SUCCESS.getBody());
@@ -96,13 +99,17 @@ void h2ProtocolUpgrade() throws Exception {
9699
s -> s.hasName("h2-upgrade-client").hasNoParent().hasKind(SpanKind.INTERNAL));
97100
// actual client netty span (including upgrade event)
98101
spanAssertions.add(
99-
s -> s.hasKind(SpanKind.CLIENT).hasName(method).hasParent(trace.getSpan(0))
100-
.hasEventsSatisfyingExactly(ServerH2Test::assertSwitchingProtocolsEvent));
102+
s ->
103+
s.hasKind(SpanKind.CLIENT)
104+
.hasName(method)
105+
.hasParent(trace.getSpan(0))
106+
.hasEventsSatisfyingExactly(ServerH2Test::assertSwitchingProtocolsEvent));
101107
// server netty span (including upgrade event)
102108
spanAssertions.add(
103-
span -> assertServerSpan(span, method, endpoint, endpoint.getStatus())
104-
.hasParent(trace.getSpan(1))
105-
.hasEventsSatisfyingExactly(ServerH2Test::assertSwitchingProtocolsEvent));
109+
span ->
110+
assertServerSpan(span, method, endpoint, endpoint.getStatus())
111+
.hasParent(trace.getSpan(1))
112+
.hasEventsSatisfyingExactly(ServerH2Test::assertSwitchingProtocolsEvent));
106113
// server controller span
107114
spanAssertions.add(
108115
span -> {

0 commit comments

Comments
 (0)