Skip to content

Commit 565de8d

Browse files
committed
feat: Tag payloads even if there's no status code due to non HTTP function invoke.
1 parent 9dbfca7 commit 565de8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,16 @@ export function datadog<TEvent, TResult>(
136136
try {
137137
localResult = await promHandler(localEvent, localContext);
138138
} finally {
139+
if (traceListener.currentSpan && finalConfig.captureLambdaPayload) {
140+
tagObject(traceListener.currentSpan, "function.request", localEvent);
141+
tagObject(traceListener.currentSpan, "function.response", localResult);
142+
}
139143
if (traceListener.triggerTags) {
140144
const statusCode = extractHTTPStatusCodeTag(traceListener.triggerTags, localResult);
141145
if (statusCode) {
142146
// Store the status tag in the listener to send to Xray on invocation completion
143147
traceListener.triggerTags["http.status_code"] = statusCode;
144148
if (traceListener.currentSpan) {
145-
if (finalConfig.captureLambdaPayload) {
146-
tagObject(traceListener.currentSpan, "function.request", localEvent);
147-
tagObject(traceListener.currentSpan, "function.response", localResult);
148-
}
149149
traceListener.currentSpan.setTag("http.status_code", statusCode);
150150
}
151151
}

0 commit comments

Comments
 (0)