<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-analytics</artifactId>
<packaging>pom</packaging>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
<name>logging-analytics</name>
<url>http://maven.apache.org</url>
<modules>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-demo</artifactId>
<packaging>war</packaging>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-docker-root</artifactId>
<packaging>pom</packaging>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-parent</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-filter-base</artifactId>
protected void setupHeaders(Request clientRequest, RequestHeaders requestHeaders) {
String requestId = extractRequestID();
- String invocationId = UUID.randomUUID().toString();
+ String invocationId = setInvocationId();
addHeader(requestHeaders, ONAPLogConstants.Headers.REQUEST_ID, requestId);
addHeader(requestHeaders, Constants.HttpHeaders.HEADER_REQUEST_ID, requestId);
addHeader(requestHeaders, Constants.HttpHeaders.TRANSACTION_ID, requestId);
}
+ protected String setInvocationId() {
+ String invocationId = UUID.randomUUID().toString();
+ MDC.put(ONAPLogConstants.MDCs.CLIENT_INVOCATION_ID, invocationId);
+ return invocationId;
+ }
+
protected void setupMDC(Request request) {
MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, getTargetServiceName(request));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- setInvocationIdFromMDC();
if (MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY) == null) {
String targetEntity = getTargetEntity(request);
String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
if (invocationId == null || invocationId.isEmpty())
invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
- public void setInvocationIdFromMDC() {
- String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
+ MDC.put(ONAPLogConstants.MDCs.SERVER_INVOCATION_ID, invocationId);
}
public void setMDCPartnerName(SimpleMap headers) {
}
public void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
+ MDC.remove(ONAPLogConstants.MDCs.CLIENT_INVOCATION_ID);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
HashMap<String, String> headers = new HashMap<>();
headers.put(ONAPLogConstants.Headers.INVOCATION_ID, invocationId);
setInvocationId(new SimpleHashMap(headers));
- assertEquals(invocationId, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals(invocationId, MDC.get(ONAPLogConstants.MDCs.SERVER_INVOCATION_ID));
}
@Test
public void setInvocationIdNoHeaderTest() {
HashMap<String, String> headers = new HashMap<>();
setInvocationId(new SimpleHashMap(headers));
- assertNotNull(MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- }
-
- @Test
- public void setInvovationIdFromMDCTest() {
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, "7b77143c-9b50-410c-ac2f-05758a68e3e8");
- setInvocationIdFromMDC();
- assertEquals("7b77143c-9b50-410c-ac2f-05758a68e3e8", MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- }
-
- @Test
- public void setInvocationIdFromMDCNoInvocationIdTest() {
- setInvocationIdFromMDC();
- // InvocationId is set to a random UUID
- assertNotNull(MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertNotNull(MDC.get(ONAPLogConstants.MDCs.SERVER_INVOCATION_ID));
}
@Test
@Test
public void clearClientMDCsTest() {
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, "7b77143c-9b50-410c-ac2f-05758a68e3e9");
+ MDC.put(ONAPLogConstants.MDCs.CLIENT_INVOCATION_ID, "7b77143c-9b50-410c-ac2f-05758a68e3e9");
MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "Bad Gateway");
MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, "Bad Gateway");
MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, "502");
MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, "2019-06-18T02:09:06.024Z");
clearClientMDCs();
- assertNull(MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.CLIENT_INVOCATION_ID));
assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION));
assertNull(MDC.get(ONAPLogConstants.MDCs.ERROR_CODE));
assertNull(MDC.get(ONAPLogConstants.MDCs.ERROR_DESC));
@Test
public void setupHeadersTest() {
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, "8819bfb4-69d2-43fc-b0d6-81d2690533ea");
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>();
doReturn("0a908a5d-e774-4558-96ff-6edcbba65483").when(metricLogClientFilter).extractRequestID();
assertEquals("UNKNOWN", headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME));
}
+ @Test
+ public void setInvocationIdTest() {
+ String invocationId = metricLogClientFilter.setInvocationId();
+
+ assertEquals(invocationId, MDC.get(ONAPLogConstants.MDCs.CLIENT_INVOCATION_ID));
+ }
+
@Test
public void setupMDCTest() throws URISyntaxException {
// TODO ingest change from upstream
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-parent</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-filter-spring</artifactId>
@Test
public void setupHeadersTest() {
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, "8819bfb4-69d2-43fc-b0d6-81d2690533ea");
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, "0a908a5d-e774-4558-96ff-6edcbba65483");
HttpHeaders headers = new HttpHeaders();
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-filter-parent</artifactId>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-kubernetes</artifactId>
<packaging>pom</packaging>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-library</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-mock-service</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>logging-slf4j-demo</artifactId>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-slf4j</artifactId>
<name>logging-slf4j</name>
/** MDC correlating messages for an invocation. */
public static final String INVOCATION_ID = "InvocationID";
+
+ public static final String SERVER_INVOCATION_ID = "ServerInvocationId";
+
+ public static final String CLIENT_INVOCATION_ID = "ClientInvocationId";
/** MDC correlating messages for a logical transaction. */
public static final String REQUEST_ID = "RequestID";
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-analytics</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-reference</artifactId>
<packaging>pom</packaging>
<parent>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-reference</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.3-SNAPSHOT</version>
</parent>
<artifactId>logging-provider</artifactId>
<packaging>pom</packaging>
# 1.2.6-SNAPSHOT is off 1.2.5
major=1
minor=6
-patch=1
+patch=2
base_version=${major}.${minor}.${patch}