polishing previous commit

This commit is contained in:
Oleg Zhurakousky
2023-01-17 11:09:54 +01:00
parent 38b41dcd3e
commit 079234b021

View File

@@ -43,6 +43,7 @@ import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.messaging.Message; import org.springframework.messaging.Message;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@@ -147,20 +148,20 @@ public final class CustomRuntimeEventLoop implements SmartLifecycle {
.format(LAMBDA_INVOCATION_URL_TEMPLATE, runtimeApi, LAMBDA_VERSION_DATE, requestId); .format(LAMBDA_INVOCATION_URL_TEMPLATE, runtimeApi, LAMBDA_VERSION_DATE, requestId);
String traceId = response.getHeaders().getFirst("Lambda-Runtime-Trace-Id"); String traceId = response.getHeaders().getFirst("Lambda-Runtime-Trace-Id");
if (traceId != null) { if (StringUtils.hasText(traceId)) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Lambda-Runtime-Trace-Id: " + traceId); logger.debug("Lambda-Runtime-Trace-Id: " + traceId);
} }
try { try {
// The X-Ray SDK uses this value to connect trace data between services. // The X-Ray SDK uses this value to connect trace data between services.
System.setProperty("com.amazonaws.xray.traceHeader", traceId); System.setProperty("com.amazonaws.xray.traceHeader", traceId);
} catch (Exception e) { }
catch (Exception e) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Failed to set amazon x-ray trace id", e); logger.debug("Failed to set amazon x-ray trace id", e);
} }
} }
} }
try { try {
Message<byte[]> responseMessage = (Message<byte[]>) function.apply(eventMessage); Message<byte[]> responseMessage = (Message<byte[]>) function.apply(eventMessage);