aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2019-07-18 16:20:38 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2019-07-19 17:59:19 -0400
commitabe6e93f284c06b999ef1510ea06b14da93117fb (patch)
treeb00e4805f023ea5750f536152e04698294b63d32 /adapters/mso-openstack-adapters/src
parent97ad3ad656f2cdefb9606654b5ceacc12694fddb (diff)
Added servicename to MDC so that it gets logged
Added servicename to MDC so that it gets logged and added enter and exit markers. Issue-ID: SO-2122 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I63ff5e5de21d851c989ffa5db2051755751d9ead
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java4
5 files changed, 20 insertions, 4 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 7500097b6a..8edce124ec 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -87,9 +87,12 @@ public abstract class AbstractAuditService {
}
protected void setupMDC(ExternalTask externalTask) {
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty())
+ if (msoRequestId != null && !msoRequestId.isEmpty()) {
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
}
protected long calculateRetryDelay(int currentRetries) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
index 77229919cd..1e5b6de857 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.objects.audit.AAIObjectAuditList;
@@ -48,9 +49,9 @@ public class AuditCreateStackService extends AbstractAuditService {
public Environment environment;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
- setupMDC(externalTask);
boolean success = false;
try {
logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
@@ -71,6 +72,7 @@ public class AuditCreateStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -80,6 +82,7 @@ public class AuditCreateStackService extends AbstractAuditService {
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
index b99eaa98d9..0aa4f9bdc3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
@@ -25,6 +25,7 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.objects.audit.AAIObjectAuditList;
@@ -52,9 +53,9 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected Environment env;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
- setupMDC(externalTask);
boolean success = false;
try {
logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries());
@@ -79,6 +80,7 @@ public class AuditDeleteStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
@@ -88,6 +90,7 @@ public class AuditDeleteStackService extends AbstractAuditService {
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
index c8ac9d1a58..2ef7d5b325 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
@@ -5,6 +5,7 @@ import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
@@ -24,8 +25,8 @@ public class AuditQueryStackService extends AbstractAuditService {
protected AuditDataService auditDataService;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- AuditInventory auditInventory = externalTask.getVariable("auditInventory");
setupMDC(externalTask);
+ AuditInventory auditInventory = externalTask.getVariable("auditInventory");
boolean success = false;
Map<String, Object> variables = new HashMap<>();
try {
@@ -42,6 +43,7 @@ public class AuditQueryStackService extends AbstractAuditService {
if (success) {
externalTaskService.complete(externalTask, variables);
logger.debug("The External Task {} was Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
if (externalTask.getRetries() == null) {
logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}",
@@ -51,6 +53,7 @@ public class AuditQueryStackService extends AbstractAuditService {
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId());
externalTaskService.complete(externalTask, variables);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index c106591b25..a6c61704ad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -77,6 +77,7 @@ public class CreateInventoryTask {
if (success) {
externalTaskService.complete(externalTask);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else if (inventoryException) {
logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId());
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
@@ -89,6 +90,7 @@ public class CreateInventoryTask {
} else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTask.getId(), externalTask.getRetries() - 1,
@@ -107,6 +109,8 @@ public class CreateInventoryTask {
private void setupMDC(ExternalTask externalTask) {
try {
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
String msoRequestId = externalTask.getVariable("mso-request-id");
if (msoRequestId != null && !msoRequestId.isEmpty())
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);