Skip to content

Commit

Permalink
feat: servlet 5.0 body capture fix (#411)
Browse files Browse the repository at this point in the history
* flush to get all headers

* spotless apply
  • Loading branch information
thugrock7 authored Jan 2, 2025
1 parent 40c54bf commit 974191e
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public static void exit(

if (!request.isAsyncStarted()) {
if (instrumentationConfig.httpHeaders().response()) {
if (throwable == null && !httpResponse.isCommitted()) {
httpResponse.flushBuffer();
}
for (String headerName : httpResponse.getHeaderNames()) {
String headerValue = httpResponse.getHeader(headerName);
currentSpan.setAttribute(
Expand Down Expand Up @@ -216,6 +219,7 @@ public static void exit(
urlEncodedMapContextStore);
}
}
} catch (IOException ignored) {
} finally {
Throwable tmp = throwable;
while (tmp != null) { // loop in case our exception is nested (eg. springframework)
Expand Down

0 comments on commit 974191e

Please sign in to comment.