Skip to content

Commit 3c14fe6

Browse files
authored
Review fixes for async-http-client-1-common:javaagent (open-telemetry#17268)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
1 parent 9e38d84 commit 3c14fe6

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

instrumentation/async-http-client/async-http-client-1-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/common/AsyncHttpClientHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public interface AsyncHttpClientHelper {
3333
* @param request the HTTP request
3434
* @return the server port
3535
*/
36+
@Nullable
3637
Integer getServerPort(Request request);
3738

3839
/**

instrumentation/async-http-client/async-http-client-1-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/common/AsyncHttpClientHttpAttributesGetter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public String getServerAddress(Request request) {
5555
}
5656

5757
@Override
58+
@Nullable
5859
public Integer getServerPort(Request request) {
5960
return helper.getServerPort(request);
6061
}

instrumentation/async-http-client/async-http-client-1-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/common/ResponseInstrumentation.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import io.opentelemetry.context.Scope;
1818
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
1919
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
20+
import javax.annotation.Nullable;
2021
import net.bytebuddy.asm.Advice;
2122
import net.bytebuddy.description.type.TypeDescription;
2223
import net.bytebuddy.matcher.ElementMatcher;
@@ -63,7 +64,7 @@ public static Scope onEnter(
6364
}
6465

6566
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
66-
public static void onExit(@Advice.Enter Scope scope) {
67+
public static void onExit(@Advice.Enter @Nullable Scope scope) {
6768
if (null != scope) {
6869
scope.close();
6970
}
@@ -88,7 +89,7 @@ public static Scope onEnter(
8889
}
8990

9091
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
91-
public static void onExit(@Advice.Enter Scope scope) {
92+
public static void onExit(@Advice.Enter @Nullable Scope scope) {
9293
if (null != scope) {
9394
scope.close();
9495
}

0 commit comments

Comments
 (0)