Skip to content

Commit 486f392

Browse files
Add Response Status Number in http trace logs. (#16978) (#16986)
(cherry picked from commit 2c7d774) Signed-off-by: Rishikesh1159 <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent afb2f94 commit 486f392

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

server/src/main/java/org/opensearch/http/HttpTracer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,11 @@ void traceResponse(
116116
) {
117117
logger.trace(
118118
new ParameterizedMessage(
119-
"[{}][{}][{}][{}][{}] sent response to [{}] success [{}]",
119+
"[{}][{}][{}][{}][{}][{}] sent response to [{}] success [{}]",
120120
requestId,
121121
opaqueHeader,
122122
restResponse.status(),
123+
restResponse.status().getStatus(),
123124
restResponse.contentType(),
124125
contentLength,
125126
httpChannel,

server/src/test/java/org/opensearch/http/AbstractHttpServerTransportTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ public HttpStats stats() {
285285
+ opaqueId
286286
+ "\\]\\["
287287
+ (badRequest ? "BAD_REQUEST" : "OK")
288+
+ "\\]\\["
289+
+ (badRequest ? "400" : "200")
288290
+ "\\]\\[null\\]\\[0\\] sent response to \\[.*"
289291
)
290292
);

0 commit comments

Comments
 (0)