diff options
author | 2019-10-18 12:58:21 -0400 | |
---|---|---|
committer | 2019-10-18 12:58:21 -0400 | |
commit | 40d60912a2de47be35379c5fe786e1d2d0b180c8 (patch) | |
tree | aea4ea40cdbce183238cff741cff6dd1cd260b1b /reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging | |
parent | 1427488ec214a6605cbe2270206157710aa6f37e (diff) |
Generate InvocationID UUID on outgoing requests and use X-InvocationID
Issue-ID: LOG-1170
Change-Id: I89fd007bf80fbea1a743d6eb4776fddb07103b46
Signed-off-by: Brittany Plummer (bp896r) <bp896r@att.com>
Diffstat (limited to 'reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging')
-rw-r--r-- | reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java b/reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java index 79649a2..fc67460 100644 --- a/reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java +++ b/reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java @@ -64,12 +64,15 @@ public abstract class AbstractMetricLogFilter<Request, Response, RequestHeaders> protected void setupHeaders(Request clientRequest, RequestHeaders requestHeaders) { String requestId = extractRequestID(); + String invocationId = UUID.randomUUID().toString(); addHeader(requestHeaders, ONAPLogConstants.Headers.REQUEST_ID, requestId); addHeader(requestHeaders, Constants.HttpHeaders.HEADER_REQUEST_ID, requestId); addHeader(requestHeaders, Constants.HttpHeaders.TRANSACTION_ID, requestId); addHeader(requestHeaders, Constants.HttpHeaders.ECOMP_REQUEST_ID, requestId); - addHeader(requestHeaders, ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); addHeader(requestHeaders, ONAPLogConstants.Headers.PARTNER_NAME, partnerName); + logger.info("Setting X-InvocationID header for outgoing request: {}", invocationId); + addHeader(requestHeaders, ONAPLogConstants.Headers.INVOCATION_ID, invocationId); + } protected void setupMDC(Request request) { |