summaryrefslogtreecommitdiffstats
path: root/reference
diff options
context:
space:
mode:
Diffstat (limited to 'reference')
-rw-r--r--reference/logging-filter/logging-filter-base/src/main/java/org/onap/logging/filter/base/AbstractMetricLogFilter.java5
-rw-r--r--reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java2
-rw-r--r--reference/logging-filter/logging-filter-spring/src/test/java/org/onap/logging/filter/spring/SpringClientFilterTest.java2
-rw-r--r--reference/logging-slf4j/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java4
-rw-r--r--reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java4
-rw-r--r--reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java2
6 files changed, 11 insertions, 8 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) {
diff --git a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java
index ed217aa..3729e92 100644
--- a/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java
+++ b/reference/logging-filter/logging-filter-base/src/test/java/org/onap/logging/filter/base/MetricLogClientFilterTest.java
@@ -68,7 +68,7 @@ public class MetricLogClientFilterTest {
assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.ECOMP_REQUEST_ID));
- assertEquals("8819bfb4-69d2-43fc-b0d6-81d2690533ea", headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
+ assertNotNull(headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
assertEquals("UNKNOWN", headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME));
}
diff --git a/reference/logging-filter/logging-filter-spring/src/test/java/org/onap/logging/filter/spring/SpringClientFilterTest.java b/reference/logging-filter/logging-filter-spring/src/test/java/org/onap/logging/filter/spring/SpringClientFilterTest.java
index 8a592d2..c9925eb 100644
--- a/reference/logging-filter/logging-filter-spring/src/test/java/org/onap/logging/filter/spring/SpringClientFilterTest.java
+++ b/reference/logging-filter/logging-filter-spring/src/test/java/org/onap/logging/filter/spring/SpringClientFilterTest.java
@@ -131,7 +131,7 @@ public class SpringClientFilterTest extends SpringClientFilter {
assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.TRANSACTION_ID));
assertEquals("0a908a5d-e774-4558-96ff-6edcbba65483", headers.getFirst(Constants.HttpHeaders.ECOMP_REQUEST_ID));
- assertEquals("8819bfb4-69d2-43fc-b0d6-81d2690533ea", headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
+ assertNotNull(headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID));
assertEquals("UNKNOWN", headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME));
}
diff --git a/reference/logging-slf4j/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java b/reference/logging-slf4j/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java
index 77ca084..5357f40 100644
--- a/reference/logging-slf4j/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java
+++ b/reference/logging-slf4j/src/main/java/org/onap/logging/ref/slf4j/ONAPLogConstants.java
@@ -205,8 +205,8 @@ public final class ONAPLogConstants {
/** HTTP <tt>X-ONAP-RequestID</tt> header. */
public static final String REQUEST_ID = "X-ONAP-RequestID";
- /** HTTP <tt>X-ONAP-InvocationID</tt> header. */
- public static final String INVOCATION_ID = "X-ONAP-InvocationID";
+ /** HTTP <tt>X-InvocationID</tt> header. */
+ public static final String INVOCATION_ID = "X-InvocationID";
/** HTTP <tt>X-ONAP-PartnerName</tt> header. */
public static final String PARTNER_NAME = "X-ONAP-PartnerName";
diff --git a/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java b/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java
index bc6d96d..e28c22f 100644
--- a/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java
+++ b/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogAdapterTest.java
@@ -140,7 +140,7 @@ public class ONAPLogAdapterTest {
http.setServerName("local123");
http.setRemoteAddr("remote123");
http.addHeader("X-ONAP-RequestID", "request123");
- http.addHeader("X-ONAP-InvocationID", "invocation123");
+ http.addHeader("X-InvocationID", "invocation123");
http.addHeader("X-ONAP-PartnerName", "partner123");
try {
@@ -180,7 +180,7 @@ public class ONAPLogAdapterTest {
http.setServerName("local123");
http.setRemoteAddr("remote123");
http.addHeader("X-ONAP-RequestID", "request123");
- http.addHeader("X-ONAP-InvocationID", "invocation123");
+ http.addHeader("X-InvocationID", "invocation123");
http.addHeader("X-ONAP-PartnerName", "partner123");
try {
diff --git a/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java b/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java
index 681b324..d63d2fd 100644
--- a/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java
+++ b/reference/logging-slf4j/src/test/java/org/onap/logging/ref/slf4j/ONAPLogConstantsTest.java
@@ -60,7 +60,7 @@ public class ONAPLogConstantsTest {
@Test
public void testHeaders() {
assertThat(ONAPLogConstants.Headers.REQUEST_ID, is("X-ONAP-RequestID"));
- assertThat(ONAPLogConstants.Headers.INVOCATION_ID, is("X-ONAP-InvocationID"));
+ assertThat(ONAPLogConstants.Headers.INVOCATION_ID, is("X-InvocationID"));
assertThat(ONAPLogConstants.Headers.PARTNER_NAME, is("X-ONAP-PartnerName"));
}