diff --git a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java
index 543b4370f079..4acaacdec1ab 100644
--- a/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java
+++ b/instrumentation-api-semconv/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpCommonAttributesGetter.java
@@ -63,10 +63,14 @@ default Long requestContentLengthUncompressed(REQUEST request, @Nullable RESPONS
*
*
This is called from {@link Instrumenter#end(Context, Object, Object, Throwable)}, only when
* {@code response} is non-{@code null}.
+ *
+ * @deprecated This method is deprecated and will be removed in the next release.
*/
- // TODO: deprecate this method and use the new one everywhere
+ @Deprecated
@Nullable
- Integer statusCode(REQUEST request, RESPONSE response);
+ default Integer statusCode(REQUEST request, RESPONSE response) {
+ throw new UnsupportedOperationException("This method is deprecated and will be removed");
+ }
/**
* Extracts the {@code http.status_code} span attribute.
diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java
index 417ee2b1a25e..2624b26bf00c 100644
--- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java
+++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpClientAttributesExtractorTest.java
@@ -19,6 +19,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.annotation.Nullable;
import org.junit.jupiter.api.Test;
class HttpClientAttributesExtractorTest {
@@ -43,7 +44,8 @@ public List requestHeader(Map request, String name) {
}
@Override
- public Integer statusCode(Map request, Map response) {
+ public Integer statusCode(
+ Map request, Map response, @Nullable Throwable error) {
return Integer.parseInt(response.get("statusCode"));
}
diff --git a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java
index a4eb6bd725ec..4e1a066e722e 100644
--- a/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java
+++ b/instrumentation-api-semconv/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/http/HttpServerAttributesExtractorTest.java
@@ -20,6 +20,7 @@
import java.util.List;
import java.util.Map;
import java.util.function.Function;
+import javax.annotation.Nullable;
import org.junit.jupiter.api.Test;
class HttpServerAttributesExtractorTest {
@@ -59,7 +60,8 @@ public List requestHeader(Map request, String name) {
}
@Override
- public Integer statusCode(Map request, Map response) {
+ public Integer statusCode(
+ Map request, Map response, @Nullable Throwable error) {
String value = response.get("statusCode");
return value == null ? null : Integer.parseInt(value);
}
diff --git a/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java b/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java
index 51e0237bb461..784fa9ad4791 100644
--- a/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java
+++ b/instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java
@@ -86,7 +86,7 @@ public String flavor(Void unused, @Nullable Void unused2) {
}
@Override
- public Integer statusCode(Void unused, Void unused2) {
+ public Integer statusCode(Void unused, Void unused2, @Nullable Throwable error) {
return 200;
}
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientAttributesGetter.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientAttributesGetter.java
index 41c7596f85f0..0aa413285604 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientAttributesGetter.java
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/client/AkkaHttpClientAttributesGetter.java
@@ -36,7 +36,8 @@ public List requestHeader(HttpRequest httpRequest, String name) {
}
@Override
- public Integer statusCode(HttpRequest httpRequest, HttpResponse httpResponse) {
+ public Integer statusCode(
+ HttpRequest httpRequest, HttpResponse httpResponse, @Nullable Throwable error) {
return httpResponse.status().intValue();
}
diff --git a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerAttributesGetter.java b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerAttributesGetter.java
index a0c6bdf0ea53..859beb8f2f44 100644
--- a/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerAttributesGetter.java
+++ b/instrumentation/akka/akka-http-10.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/akkahttp/server/AkkaHttpServerAttributesGetter.java
@@ -27,7 +27,8 @@ public List requestHeader(HttpRequest request, String name) {
}
@Override
- public Integer statusCode(HttpRequest request, HttpResponse httpResponse) {
+ public Integer statusCode(
+ HttpRequest request, HttpResponse httpResponse, @Nullable Throwable error) {
return httpResponse.status().intValue();
}
diff --git a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java
index c31160fd9279..6ba84b3944e4 100644
--- a/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java
+++ b/instrumentation/apache-httpasyncclient-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpasyncclient/ApacheHttpAsyncClientHttpAttributesGetter.java
@@ -33,7 +33,8 @@ public List requestHeader(ApacheHttpClientRequest request, String name)
@Override
@Nullable
- public Integer statusCode(ApacheHttpClientRequest request, HttpResponse response) {
+ public Integer statusCode(
+ ApacheHttpClientRequest request, HttpResponse response, @Nullable Throwable error) {
StatusLine statusLine = response.getStatusLine();
return statusLine != null ? statusLine.getStatusCode() : null;
}
diff --git a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientHttpAttributesGetter.java b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientHttpAttributesGetter.java
index 6eb64519d45e..34bda395d4bf 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientHttpAttributesGetter.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientHttpAttributesGetter.java
@@ -39,7 +39,7 @@ public List requestHeader(HttpMethod request, String name) {
@Override
@Nullable
- public Integer statusCode(HttpMethod request, HttpMethod response) {
+ public Integer statusCode(HttpMethod request, HttpMethod response, @Nullable Throwable error) {
StatusLine statusLine = response.getStatusLine();
return statusLine == null ? null : statusLine.getStatusCode();
}
diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientHttpAttributesGetter.java b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientHttpAttributesGetter.java
index be10a1f1e27c..affdb348391c 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientHttpAttributesGetter.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientHttpAttributesGetter.java
@@ -31,7 +31,8 @@ public List requestHeader(ApacheHttpClientRequest request, String name)
}
@Override
- public Integer statusCode(ApacheHttpClientRequest request, HttpResponse response) {
+ public Integer statusCode(
+ ApacheHttpClientRequest request, HttpResponse response, @Nullable Throwable error) {
return response.getStatusLine().getStatusCode();
}
diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java
index 144472a181b8..c8717f310395 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-4.3/library/src/main/java/io/opentelemetry/instrumentation/apachehttpclient/v4_3/ApacheHttpClientHttpAttributesGetter.java
@@ -33,7 +33,8 @@ public List requestHeader(ApacheHttpClientRequest request, String name)
}
@Override
- public Integer statusCode(ApacheHttpClientRequest request, HttpResponse response) {
+ public Integer statusCode(
+ ApacheHttpClientRequest request, HttpResponse response, @Nullable Throwable error) {
return response.getStatusLine().getStatusCode();
}
diff --git a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientHttpAttributesGetter.java b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientHttpAttributesGetter.java
index b2df286563bc..a1f229763493 100644
--- a/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientHttpAttributesGetter.java
+++ b/instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientHttpAttributesGetter.java
@@ -69,7 +69,7 @@ public List requestHeader(HttpRequest request, String name) {
}
@Override
- public Integer statusCode(HttpRequest request, HttpResponse response) {
+ public Integer statusCode(HttpRequest request, HttpResponse response, @Nullable Throwable error) {
return response.getCode();
}
diff --git a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpClientAttributesGetter.java b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpClientAttributesGetter.java
index 7a6484baa6ed..fe91f25b3a9f 100644
--- a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpClientAttributesGetter.java
+++ b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpClientAttributesGetter.java
@@ -36,7 +36,7 @@ public List requestHeader(RequestContext ctx, String name) {
@Override
@Nullable
- public Integer statusCode(RequestContext ctx, RequestLog requestLog) {
+ public Integer statusCode(RequestContext ctx, RequestLog requestLog, @Nullable Throwable error) {
HttpStatus status = requestLog.responseHeaders().status();
if (!status.equals(HttpStatus.UNKNOWN)) {
return status.code();
diff --git a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java
index 29a754fdc82e..c8d1fc05210c 100644
--- a/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java
+++ b/instrumentation/armeria-1.3/library/src/main/java/io/opentelemetry/instrumentation/armeria/v1_3/ArmeriaHttpServerAttributesGetter.java
@@ -43,7 +43,7 @@ public List requestHeader(RequestContext ctx, String name) {
@Override
@Nullable
- public Integer statusCode(RequestContext ctx, RequestLog requestLog) {
+ public Integer statusCode(RequestContext ctx, RequestLog requestLog, @Nullable Throwable error) {
HttpStatus status = requestLog.responseHeaders().status();
if (!status.equals(HttpStatus.UNKNOWN)) {
return status.code();
diff --git a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientHttpAttributesGetter.java b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientHttpAttributesGetter.java
index 37f6cdba357a..d6e912a6e3e3 100644
--- a/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientHttpAttributesGetter.java
+++ b/instrumentation/async-http-client/async-http-client-1.9/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v1_9/AsyncHttpClientHttpAttributesGetter.java
@@ -32,7 +32,7 @@ public List requestHeader(Request request, String name) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatusCode();
}
diff --git a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java
index 4150fdc792d7..0605e1ac4806 100644
--- a/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java
+++ b/instrumentation/async-http-client/async-http-client-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientHttpAttributesGetter.java
@@ -30,7 +30,8 @@ public List requestHeader(RequestContext requestContext, String name) {
}
@Override
- public Integer statusCode(RequestContext requestContext, Response response) {
+ public Integer statusCode(
+ RequestContext requestContext, Response response, @Nullable Throwable error) {
return response.getStatusCode();
}
diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AwsSdkHttpAttributesGetter.java b/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AwsSdkHttpAttributesGetter.java
index 835d5653dcf0..80d02c9d91d9 100644
--- a/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AwsSdkHttpAttributesGetter.java
+++ b/instrumentation/aws-sdk/aws-sdk-1.11/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v1_11/AwsSdkHttpAttributesGetter.java
@@ -40,7 +40,7 @@ public List requestHeader(Request> request, String name) {
}
@Override
- public Integer statusCode(Request> request, Response> response) {
+ public Integer statusCode(Request> request, Response> response, @Nullable Throwable error) {
return response.getHttpResponse().getStatusCode();
}
diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpAttributesGetter.java b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpAttributesGetter.java
index 7e70b9fae657..dd9b4362f360 100644
--- a/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpAttributesGetter.java
+++ b/instrumentation/aws-sdk/aws-sdk-2.2/library/src/main/java/io/opentelemetry/instrumentation/awssdk/v2_2/AwsSdkHttpAttributesGetter.java
@@ -47,7 +47,8 @@ public List requestHeader(ExecutionAttributes request, String name) {
}
@Override
- public Integer statusCode(ExecutionAttributes request, SdkHttpResponse response) {
+ public Integer statusCode(
+ ExecutionAttributes request, SdkHttpResponse response, @Nullable Throwable error) {
return response.statusCode();
}
diff --git a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientHttpAttributesGetter.java b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientHttpAttributesGetter.java
index 3442585c1e1d..ac5abe259849 100644
--- a/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientHttpAttributesGetter.java
+++ b/instrumentation/google-http-client-1.19/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/googlehttpclient/GoogleHttpClientHttpAttributesGetter.java
@@ -37,7 +37,8 @@ public String flavor(HttpRequest httpRequest, @Nullable HttpResponse httpRespons
}
@Override
- public Integer statusCode(HttpRequest httpRequest, HttpResponse httpResponse) {
+ public Integer statusCode(
+ HttpRequest httpRequest, HttpResponse httpResponse, @Nullable Throwable error) {
return httpResponse.getStatusCode();
}
diff --git a/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java b/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java
index 320820dde4c6..399ead5fd56e 100644
--- a/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java
+++ b/instrumentation/grizzly-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grizzly/GrizzlyHttpAttributesGetter.java
@@ -37,7 +37,8 @@ private static List toHeaderList(Iterable values) {
}
@Override
- public Integer statusCode(HttpRequestPacket request, HttpResponsePacket response) {
+ public Integer statusCode(
+ HttpRequestPacket request, HttpResponsePacket response, @Nullable Throwable error) {
return response.getStatus();
}
diff --git a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlHttpAttributesGetter.java b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlHttpAttributesGetter.java
index 38a75d074efc..56499b72f292 100644
--- a/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlHttpAttributesGetter.java
+++ b/instrumentation/http-url-connection/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpurlconnection/HttpUrlHttpAttributesGetter.java
@@ -39,7 +39,8 @@ public String flavor(HttpURLConnection connection, @Nullable Integer statusCode)
}
@Override
- public Integer statusCode(HttpURLConnection connection, Integer statusCode) {
+ public Integer statusCode(
+ HttpURLConnection connection, Integer statusCode, @Nullable Throwable error) {
return statusCode;
}
diff --git a/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpAttributesGetter.java b/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpAttributesGetter.java
index 79ed356f7c08..86c0cc3db3e5 100644
--- a/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpAttributesGetter.java
+++ b/instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/httpclient/JdkHttpAttributesGetter.java
@@ -31,7 +31,8 @@ public List requestHeader(HttpRequest httpRequest, String name) {
}
@Override
- public Integer statusCode(HttpRequest httpRequest, HttpResponse> httpResponse) {
+ public Integer statusCode(
+ HttpRequest httpRequest, HttpResponse> httpResponse, @Nullable Throwable error) {
return httpResponse.statusCode();
}
diff --git a/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientHttpAttributesGetter.java b/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientHttpAttributesGetter.java
index cfc4e4df410a..b9a8cee2e897 100644
--- a/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientHttpAttributesGetter.java
+++ b/instrumentation/jaxrs-client/jaxrs-client-1.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrsclient/v1_1/JaxRsClientHttpAttributesGetter.java
@@ -48,7 +48,8 @@ public String flavor(ClientRequest httpRequest, @Nullable ClientResponse httpRes
}
@Override
- public Integer statusCode(ClientRequest httpRequest, ClientResponse httpResponse) {
+ public Integer statusCode(
+ ClientRequest httpRequest, ClientResponse httpResponse, @Nullable Throwable error) {
return httpResponse.getStatus();
}
diff --git a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyClientHttpAttributesGetter.java b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyClientHttpAttributesGetter.java
index 6b6114af5301..cbef35f70605 100644
--- a/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyClientHttpAttributesGetter.java
+++ b/instrumentation/jetty-httpclient/jetty-httpclient-9.2/library/src/main/java/io/opentelemetry/instrumentation/jetty/httpclient/v9_2/internal/JettyClientHttpAttributesGetter.java
@@ -61,7 +61,7 @@ public String flavor(Request request, @Nullable Response response) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatus();
}
diff --git a/instrumentation/jetty/jetty-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/common/JettyHelper.java b/instrumentation/jetty/jetty-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/common/JettyHelper.java
index 865ede7b7509..aef567e3f9a6 100644
--- a/instrumentation/jetty/jetty-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/common/JettyHelper.java
+++ b/instrumentation/jetty/jetty-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jetty/common/JettyHelper.java
@@ -40,8 +40,7 @@ public void end(
throwable = errorException(request);
}
- ServletResponseContext responseContext =
- new ServletResponseContext<>(response, throwable);
+ ServletResponseContext responseContext = new ServletResponseContext<>(response);
if (throwable != null || mustEndOnHandlerMethodExit(request)) {
instrumenter.end(context, requestContext, responseContext, throwable);
}
diff --git a/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt b/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt
index 15c80e32714c..15e38cdfcfbe 100644
--- a/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt
+++ b/instrumentation/ktor/ktor-1.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v1_0/KtorHttpServerAttributesGetter.kt
@@ -23,7 +23,7 @@ internal enum class KtorHttpServerAttributesGetter :
return request.headers.getAll(name) ?: emptyList()
}
- override fun statusCode(request: ApplicationRequest, response: ApplicationResponse): Int? {
+ override fun statusCode(request: ApplicationRequest, response: ApplicationResponse, error: Throwable?): Int? {
return response.status()?.value
}
diff --git a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/KtorHttpServerAttributesGetter.kt b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/KtorHttpServerAttributesGetter.kt
index 0ac0656b1021..09f17875d9fe 100644
--- a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/KtorHttpServerAttributesGetter.kt
+++ b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/KtorHttpServerAttributesGetter.kt
@@ -23,7 +23,7 @@ internal enum class KtorHttpServerAttributesGetter :
return request.headers.getAll(name) ?: emptyList()
}
- override fun statusCode(request: ApplicationRequest, response: ApplicationResponse): Int? {
+ override fun statusCode(request: ApplicationRequest, response: ApplicationResponse, error: Throwable?): Int? {
return response.status()?.value
}
diff --git a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesHttpAttributesGetter.java b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesHttpAttributesGetter.java
index 125fa5a0bd23..de72bb4ef5bb 100644
--- a/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesHttpAttributesGetter.java
+++ b/instrumentation/kubernetes-client-7.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/kubernetesclient/KubernetesHttpAttributesGetter.java
@@ -38,7 +38,8 @@ public String flavor(Request request, @Nullable ApiResponse> apiResponse) {
}
@Override
- public Integer statusCode(Request request, ApiResponse> apiResponse) {
+ public Integer statusCode(
+ Request request, ApiResponse> apiResponse, @Nullable Throwable error) {
return apiResponse.getStatusCode();
}
diff --git a/instrumentation/liberty/liberty-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/LibertyHelper.java b/instrumentation/liberty/liberty-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/LibertyHelper.java
index 7d8f5a2232f1..0688e70ba098 100644
--- a/instrumentation/liberty/liberty-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/LibertyHelper.java
+++ b/instrumentation/liberty/liberty-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/LibertyHelper.java
@@ -39,8 +39,7 @@ public void end(
throwable = AppServerBridge.getException(context);
}
- ServletResponseContext responseContext =
- new ServletResponseContext<>(response, throwable);
+ ServletResponseContext responseContext = new ServletResponseContext<>(response);
if (throwable != null || mustEndOnHandlerMethodExit(request)) {
instrumenter.end(context, requestContext, responseContext, throwable);
}
diff --git a/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java b/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java
index c418c9c8fa32..6d290a456bef 100644
--- a/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java
+++ b/instrumentation/liberty/liberty-dispatcher-20.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/liberty/dispatcher/LibertyDispatcherHttpAttributesGetter.java
@@ -38,7 +38,8 @@ public String flavor(LibertyRequest libertyRequest) {
@Override
@Nullable
- public Integer statusCode(LibertyRequest libertyRequest, LibertyResponse libertyResponse) {
+ public Integer statusCode(
+ LibertyRequest libertyRequest, LibertyResponse libertyResponse, @Nullable Throwable error) {
return libertyResponse.getStatus();
}
diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java
index 1caadb47d706..d61477eb8a58 100644
--- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java
+++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/NettyHttpClientAttributesGetter.java
@@ -59,7 +59,8 @@ public List requestHeader(HttpRequestAndChannel requestAndChannel, Strin
}
@Override
- public Integer statusCode(HttpRequestAndChannel requestAndChannel, HttpResponse response) {
+ public Integer statusCode(
+ HttpRequestAndChannel requestAndChannel, HttpResponse response, @Nullable Throwable error) {
return response.getStatus().getCode();
}
diff --git a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java
index 8f8223a9308e..956bc0c8c30e 100644
--- a/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java
+++ b/instrumentation/netty/netty-3.8/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/server/NettyHttpServerAttributesGetter.java
@@ -27,7 +27,8 @@ public List requestHeader(HttpRequestAndChannel requestAndChannel, Strin
}
@Override
- public Integer statusCode(HttpRequestAndChannel requestAndChannel, HttpResponse response) {
+ public Integer statusCode(
+ HttpRequestAndChannel requestAndChannel, HttpResponse response, @Nullable Throwable error) {
return response.getStatus().getCode();
}
diff --git a/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/client/NettyHttpClientAttributesGetter.java b/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/client/NettyHttpClientAttributesGetter.java
index 95198e423a14..d29ed2231964 100644
--- a/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/client/NettyHttpClientAttributesGetter.java
+++ b/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/client/NettyHttpClientAttributesGetter.java
@@ -59,7 +59,8 @@ public List requestHeader(HttpRequestAndChannel requestAndChannel, Strin
}
@Override
- public Integer statusCode(HttpRequestAndChannel requestAndChannel, HttpResponse response) {
+ public Integer statusCode(
+ HttpRequestAndChannel requestAndChannel, HttpResponse response, @Nullable Throwable error) {
return response.getStatus().code();
}
diff --git a/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/server/NettyHttpServerAttributesGetter.java b/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/server/NettyHttpServerAttributesGetter.java
index cd7799367ea2..af20b0f37505 100644
--- a/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/server/NettyHttpServerAttributesGetter.java
+++ b/instrumentation/netty/netty-4-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/netty/v4/common/server/NettyHttpServerAttributesGetter.java
@@ -27,7 +27,8 @@ public List requestHeader(HttpRequestAndChannel requestAndChannel, Strin
}
@Override
- public Integer statusCode(HttpRequestAndChannel requestAndChannel, HttpResponse response) {
+ public Integer statusCode(
+ HttpRequestAndChannel requestAndChannel, HttpResponse response, @Nullable Throwable error) {
return response.getStatus().code();
}
diff --git a/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2HttpAttributesGetter.java b/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2HttpAttributesGetter.java
index 3aebcfb1a381..a4468c4791e3 100644
--- a/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2HttpAttributesGetter.java
+++ b/instrumentation/okhttp/okhttp-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/okhttp/v2_2/OkHttp2HttpAttributesGetter.java
@@ -30,7 +30,7 @@ public List requestHeader(Request request, String name) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.code();
}
diff --git a/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpAttributesGetter.java b/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpAttributesGetter.java
index 1801dfd299b4..3c9fff91da13 100644
--- a/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpAttributesGetter.java
+++ b/instrumentation/okhttp/okhttp-3.0/library/src/main/java/io/opentelemetry/instrumentation/okhttp/v3_0/OkHttpAttributesGetter.java
@@ -53,7 +53,7 @@ public String flavor(Request request, @Nullable Response response) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.code();
}
diff --git a/instrumentation/opentelemetry-instrumentation-api/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/testing/MockHttpServerAttributesGetter.java b/instrumentation/opentelemetry-instrumentation-api/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/testing/MockHttpServerAttributesGetter.java
index 7010bbbf0d02..0e8cbbfb8520 100644
--- a/instrumentation/opentelemetry-instrumentation-api/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/testing/MockHttpServerAttributesGetter.java
+++ b/instrumentation/opentelemetry-instrumentation-api/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/testing/MockHttpServerAttributesGetter.java
@@ -29,7 +29,7 @@ public List requestHeader(String s, String name) {
@Nullable
@Override
- public Integer statusCode(String s, Void unused) {
+ public Integer statusCode(String s, Void unused, @Nullable Throwable error) {
return null;
}
diff --git a/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java b/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java
index 0621d94c0647..f6cf8a064286 100644
--- a/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java
+++ b/instrumentation/play/play-ws/play-ws-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/playws/PlayWsClientHttpAttributesGetter.java
@@ -31,7 +31,7 @@ public List requestHeader(Request request, String name) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatusCode();
}
diff --git a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpAttributesGetter.java b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpAttributesGetter.java
index b9e0c47d1d99..335a56a00c7f 100644
--- a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpAttributesGetter.java
+++ b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpAttributesGetter.java
@@ -77,7 +77,7 @@ public String serverName(Request request) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatus().getCode();
}
diff --git a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpClientAttributesGetter.java b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpClientAttributesGetter.java
index 4ceb3ccf1f32..d06c96d95786 100644
--- a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpClientAttributesGetter.java
+++ b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/RatpackHttpClientAttributesGetter.java
@@ -39,7 +39,8 @@ public List requestHeader(RequestSpec requestSpec, String name) {
}
@Override
- public Integer statusCode(RequestSpec requestSpec, HttpResponse httpResponse) {
+ public Integer statusCode(
+ RequestSpec requestSpec, HttpResponse httpResponse, @Nullable Throwable error) {
return httpResponse.getStatusCode();
}
diff --git a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java
index de1be63cd0b6..b20577946a51 100644
--- a/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java
+++ b/instrumentation/reactor/reactor-netty/reactor-netty-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyHttpClientAttributesGetter.java
@@ -75,7 +75,8 @@ public List requestHeader(HttpClientConfig request, String name) {
}
@Override
- public Integer statusCode(HttpClientConfig request, HttpClientResponse response) {
+ public Integer statusCode(
+ HttpClientConfig request, HttpClientResponse response, @Nullable Throwable error) {
return response.status().code();
}
diff --git a/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletHttpAttributesGetter.java b/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletHttpAttributesGetter.java
index c7f4aca1aed3..68bef9fc1cbc 100644
--- a/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletHttpAttributesGetter.java
+++ b/instrumentation/restlet/restlet-1.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v1_0/RestletHttpAttributesGetter.java
@@ -81,7 +81,7 @@ public String serverName(Request request) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatus().getCode();
}
diff --git a/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java b/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java
index 547427bc69f4..7c1f7de91ffe 100644
--- a/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java
+++ b/instrumentation/restlet/restlet-2.0/library/src/main/java/io/opentelemetry/instrumentation/restlet/v2_0/internal/RestletHttpAttributesGetter.java
@@ -82,7 +82,7 @@ public String serverName(Request request) {
}
@Override
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatus().getCode();
}
diff --git a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2Helper.java b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2Helper.java
index ea87f8363678..a8207c6601a9 100644
--- a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2Helper.java
+++ b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2Helper.java
@@ -31,7 +31,7 @@ public void end(
Throwable throwable) {
ServletResponseContext responseContext =
- new ServletResponseContext<>(response, throwable);
+ new ServletResponseContext<>(response);
responseContext.setStatus(statusCode);
instrumenter.end(context, requestContext, responseContext, throwable);
diff --git a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2HttpAttributesGetter.java b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2HttpAttributesGetter.java
index 78157933d97b..b7faef8d1aaf 100644
--- a/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2HttpAttributesGetter.java
+++ b/instrumentation/servlet/servlet-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/v2_2/Servlet2HttpAttributesGetter.java
@@ -25,10 +25,11 @@ public Servlet2HttpAttributesGetter(
@Nullable
public Integer statusCode(
ServletRequestContext requestContext,
- ServletResponseContext responseContext) {
+ ServletResponseContext responseContext,
+ @Nullable Throwable error) {
HttpServletResponse response = responseContext.response();
- if (!accessor.isResponseCommitted(response) && responseContext.error() != null) {
+ if (!accessor.isResponseCommitted(response) && error != null) {
// if response is not committed and there is a throwable set status to 500 /
// INTERNAL_SERVER_ERROR, due to servlet spec
// https://javaee.github.io/servlet-spec/downloads/servlet-4.0/servlet-4_0_FINAL.pdf:
diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AsyncRequestCompletionListener.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AsyncRequestCompletionListener.java
index 0e279620e314..1314ac9fee71 100644
--- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AsyncRequestCompletionListener.java
+++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/AsyncRequestCompletionListener.java
@@ -32,8 +32,7 @@ public AsyncRequestCompletionListener(
@Override
public void onComplete(RESPONSE response) {
if (responseHandled.compareAndSet(false, true)) {
- ServletResponseContext responseContext =
- new ServletResponseContext<>(response, null);
+ ServletResponseContext responseContext = new ServletResponseContext<>(response);
Throwable throwable = servletHelper.getAsyncException(requestContext.request());
instrumenter.end(context, requestContext, responseContext, throwable);
}
@@ -43,8 +42,7 @@ public void onComplete(RESPONSE response) {
public void onTimeout(long timeout) {
if (responseHandled.compareAndSet(false, true)) {
RESPONSE response = servletHelper.getAsyncListenerResponse(requestContext.request());
- ServletResponseContext responseContext =
- new ServletResponseContext<>(response, null);
+ ServletResponseContext responseContext = new ServletResponseContext<>(response);
responseContext.setTimeout(timeout);
Throwable throwable = servletHelper.getAsyncException(requestContext.request());
instrumenter.end(context, requestContext, responseContext, throwable);
@@ -54,8 +52,7 @@ public void onTimeout(long timeout) {
@Override
public void onError(Throwable throwable, RESPONSE response) {
if (responseHandled.compareAndSet(false, true)) {
- ServletResponseContext responseContext =
- new ServletResponseContext<>(response, throwable);
+ ServletResponseContext responseContext = new ServletResponseContext<>(response);
instrumenter.end(context, requestContext, responseContext, throwable);
}
}
diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHelper.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHelper.java
index e4dc1332998f..55dcec6ece91 100644
--- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHelper.java
+++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHelper.java
@@ -57,8 +57,7 @@ public void end(
return;
}
- ServletResponseContext responseContext =
- new ServletResponseContext<>(response, throwable);
+ ServletResponseContext responseContext = new ServletResponseContext<>(response);
if (throwable != null || mustEndOnHandlerMethodExit(request)) {
instrumenter.end(context, requestContext, responseContext, throwable);
}
diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java
index d686337d13dd..de7657bc34dd 100644
--- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java
+++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletHttpAttributesGetter.java
@@ -65,10 +65,11 @@ public String flavor(ServletRequestContext requestContext) {
@Nullable
public Integer statusCode(
ServletRequestContext requestContext,
- ServletResponseContext responseContext) {
+ ServletResponseContext responseContext,
+ @Nullable Throwable error) {
RESPONSE response = responseContext.response();
- if (!accessor.isResponseCommitted(response) && responseContext.error() != null) {
+ if (!accessor.isResponseCommitted(response) && error != null) {
// if response is not committed and there is a throwable set status to 500 /
// INTERNAL_SERVER_ERROR, due to servlet spec
// https://javaee.github.io/servlet-spec/downloads/servlet-4.0/servlet-4_0_FINAL.pdf:
diff --git a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletResponseContext.java b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletResponseContext.java
index d186549b53d1..12a8fade7f93 100644
--- a/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletResponseContext.java
+++ b/instrumentation/servlet/servlet-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/servlet/ServletResponseContext.java
@@ -7,24 +7,18 @@
public class ServletResponseContext {
private final T response;
- private final Throwable error;
// used for servlet 2.2 where request status can't be extracted from HttpServletResponse
private Integer status;
private Long timeout;
- public ServletResponseContext(T response, Throwable error) {
+ public ServletResponseContext(T response) {
this.response = response;
- this.error = error;
}
public T response() {
return response;
}
- public Throwable error() {
- return error;
- }
-
public void setStatus(int status) {
this.status = status;
}
diff --git a/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebHttpAttributesGetter.java b/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebHttpAttributesGetter.java
index a64982903861..50eaf7062f04 100644
--- a/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebHttpAttributesGetter.java
+++ b/instrumentation/spring/spring-web-3.1/library/src/main/java/io/opentelemetry/instrumentation/spring/web/SpringWebHttpAttributesGetter.java
@@ -42,7 +42,8 @@ public String flavor(HttpRequest httpRequest, @Nullable ClientHttpResponse clien
}
@Override
- public Integer statusCode(HttpRequest httpRequest, ClientHttpResponse clientHttpResponse) {
+ public Integer statusCode(
+ HttpRequest httpRequest, ClientHttpResponse clientHttpResponse, @Nullable Throwable error) {
try {
return clientHttpResponse.getStatusCode().value();
} catch (IOException e) {
diff --git a/instrumentation/spring/spring-webflux-5.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/client/SpringWebfluxHttpAttributesGetter.java b/instrumentation/spring/spring-webflux-5.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/client/SpringWebfluxHttpAttributesGetter.java
index c39f77f71d19..47933ed91b4b 100644
--- a/instrumentation/spring/spring-webflux-5.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/client/SpringWebfluxHttpAttributesGetter.java
+++ b/instrumentation/spring/spring-webflux-5.0/library/src/main/java/io/opentelemetry/instrumentation/spring/webflux/client/SpringWebfluxHttpAttributesGetter.java
@@ -56,7 +56,8 @@ public List requestHeader(ClientRequest request, String name) {
}
@Override
- public Integer statusCode(ClientRequest request, ClientResponse response) {
+ public Integer statusCode(
+ ClientRequest request, ClientResponse response, @Nullable Throwable error) {
if (RAW_STATUS_CODE != null) {
// rawStatusCode() method was introduced in webflux 5.1
try {
diff --git a/instrumentation/spring/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java b/instrumentation/spring/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java
index 48411036505e..d0b436f539ca 100644
--- a/instrumentation/spring/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java
+++ b/instrumentation/spring/spring-webmvc-5.3/library/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/v5_3/SpringWebMvcHttpAttributesGetter.java
@@ -44,13 +44,6 @@ public String flavor(HttpServletRequest request) {
return flavor;
}
- @Nullable
- @Override
- public Integer statusCode(HttpServletRequest request, HttpServletResponse httpServletResponse) {
- // this method is never used
- return null;
- }
-
@Override
public Integer statusCode(
HttpServletRequest request, HttpServletResponse response, @Nullable Throwable error) {
diff --git a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java
index fc674eed1e61..f8d39487d95b 100644
--- a/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java
+++ b/instrumentation/tomcat/tomcat-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tomcat/common/TomcatHttpAttributesGetter.java
@@ -58,7 +58,7 @@ public String flavor(Request request) {
@Override
@Nullable
- public Integer statusCode(Request request, Response response) {
+ public Integer statusCode(Request request, Response response, @Nullable Throwable error) {
return response.getStatus();
}
diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java
index 7250f8f7dde2..e6c1d9047926 100644
--- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java
+++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowHttpAttributesGetter.java
@@ -37,7 +37,8 @@ public String flavor(HttpServerExchange exchange) {
}
@Override
- public Integer statusCode(HttpServerExchange exchange, HttpServerExchange unused) {
+ public Integer statusCode(
+ HttpServerExchange exchange, HttpServerExchange unused, @Nullable Throwable error) {
return exchange.getStatusCode();
}
diff --git a/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/AbstractVertxHttpAttributesGetter.java b/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/AbstractVertxHttpAttributesGetter.java
index 542c8cd28e36..dd9a9ec221c9 100644
--- a/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/AbstractVertxHttpAttributesGetter.java
+++ b/instrumentation/vertx/vertx-http-client/vertx-http-client-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/client/AbstractVertxHttpAttributesGetter.java
@@ -26,7 +26,8 @@ public List requestHeader(HttpClientRequest request, String name) {
}
@Override
- public Integer statusCode(HttpClientRequest request, HttpClientResponse response) {
+ public Integer statusCode(
+ HttpClientRequest request, HttpClientResponse response, @Nullable Throwable error) {
return response.statusCode();
}