Less logging during registration 22/140022/1
authordanielhanrahan <daniel.hanrahan@est.tech>
Fri, 24 Jan 2025 15:40:13 +0000 (15:40 +0000)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Fri, 24 Jan 2025 17:04:59 +0000 (17:04 +0000)
During investigation of CPS-2576 bug, stack traces were added to log
output (by logging the exception object). This produces massive log
output during registration, since all CM-handles fail to sync and go
to LOCKED state initially due to initial DMI delay.

This patch logs exception details at warning level but not stacktrace

Issue-ID: CPS-2576
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ibb55991e75c058e9f4983bd876285b48917ee28e

cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncService.java
cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasks.java
docs/api/swagger/cps/openapi.yaml

index 6c1dc73..017995e 100644 (file)
@@ -36,7 +36,6 @@ import org.onap.cps.api.CpsAnchorService;
 import org.onap.cps.api.CpsDataService;
 import org.onap.cps.api.CpsModuleService;
 import org.onap.cps.api.exceptions.AlreadyDefinedException;
-import org.onap.cps.api.exceptions.DuplicatedYangResourceException;
 import org.onap.cps.api.model.ModuleReference;
 import org.onap.cps.ncmp.impl.inventory.models.YangModelCmHandle;
 import org.onap.cps.utils.ContentType;
@@ -73,8 +72,8 @@ public class ModuleSyncService {
         try {
             cpsAnchorService.createAnchor(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, schemaSetName, cmHandleId);
         } catch (final AlreadyDefinedException alreadyDefinedException) {
-            log.warn("Ignoring (anchor) already exist exception for {}. Exception details: ",
-                yangModelCmHandle.getId(), alreadyDefinedException);
+            log.warn("Ignoring (Anchor) already exists exception for {}. Exception details: {}", cmHandleId,
+                    alreadyDefinedException.getDetails());
         }
     }
 
@@ -105,9 +104,10 @@ public class ModuleSyncService {
 
     private void syncAndCreateSchemaSet(final YangModelCmHandle yangModelCmHandle, final String schemaSetName) {
         if (isNewSchemaSet(schemaSetName)) {
+            final String cmHandleId = yangModelCmHandle.getId();
             final ModuleDelta moduleDelta = getModuleDelta(yangModelCmHandle);
             try {
-                log.info("Creating Schema Set {} for CM Handle {}", schemaSetName, yangModelCmHandle.getId());
+                log.info("Creating Schema Set {} for CM Handle {}", schemaSetName, cmHandleId);
                 cpsModuleService.createSchemaSetFromModules(
                     NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME,
                     schemaSetName,
@@ -117,15 +117,8 @@ public class ModuleSyncService {
                 log.info("Successfully created Schema Set {} for CM Handle {}", schemaSetName,
                     yangModelCmHandle.getId());
             } catch (final AlreadyDefinedException alreadyDefinedException) {
-                log.warn("Ignoring already exist (schema set) exception for {}. Exception details: ",
-                     yangModelCmHandle.getId(), alreadyDefinedException);
-            } catch (final DuplicatedYangResourceException duplicatedYangResourceException) {
-                log.warn("Duplicate Yang Resource {} creation for {}. "
-                        + "CM Handle will be LOCKED (for retry). Exception details: ",
-                    duplicatedYangResourceException.getName(),
-                    yangModelCmHandle.getId(),
-                    duplicatedYangResourceException);
-                throw duplicatedYangResourceException;
+                log.warn("Ignoring (Schema Set) already exists exception for {}. Exception details: {}", cmHandleId,
+                        alreadyDefinedException.getDetails());
             }
         }
     }
index b634967..f039cf3 100644 (file)
@@ -114,7 +114,7 @@ public class ModuleSyncTasks {
             compositeState.setLockReason(null);
             return CmHandleState.READY;
         } catch (final Exception e) {
-            log.warn("Processing of {} failed,reason : ", yangModelCmHandle.getId(), e);
+            log.warn("Processing of {} failed, reason: {}.", yangModelCmHandle.getId(), e.getMessage());
             final LockReasonCategory lockReasonCategory = inUpgrade
                     ? LockReasonCategory.MODULE_UPGRADE_FAILED
                     : LockReasonCategory.MODULE_SYNC_FAILED;
index 330c2ca..f6baadc 100644 (file)
@@ -332,7 +332,7 @@ paths:
       - cps-admin
   /{apiVersion}/admin/dataspaces/{dataspace-name}/actions/clean:
     post:
-      description: Clean the dataspace (remove orphaned modules)
+      description: Clean the dataspace (remove orphaned schema sets and modules)
       operationId: cleanDataspace
       parameters:
       - description: apiVersion