Skip to content

Commit d9c7a76

Browse files
committed
flush to get all headers
1 parent aca5f12 commit d9c7a76

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

instrumentation/servlet/servlet-5.0/src/main/java/io/opentelemetry/javaagent/instrumentation/hypertrace/servlet/v5_0/Servlet50AndFilterInstrumentation.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ public static void exit(
187187

188188
if (!request.isAsyncStarted()) {
189189
if (instrumentationConfig.httpHeaders().response()) {
190+
httpResponse.flushBuffer();
190191
for (String headerName : httpResponse.getHeaderNames()) {
191192
String headerValue = httpResponse.getHeader(headerName);
192193
currentSpan.setAttribute(
@@ -216,7 +217,8 @@ public static void exit(
216217
urlEncodedMapContextStore);
217218
}
218219
}
219-
} finally {
220+
} catch (IOException ignored) {}
221+
finally {
220222
Throwable tmp = throwable;
221223
while (tmp != null) { // loop in case our exception is nested (eg. springframework)
222224
if (tmp instanceof HypertraceEvaluationException) {

0 commit comments

Comments
 (0)