From 1ce041490b2b4aafb700c905b23d17037e42f153 Mon Sep 17 00:00:00 2001 From: jhh Date: Wed, 9 Feb 2022 21:09:30 -0600 Subject: transaction records cleanup Issue-ID: POLICY-3761 Signed-off-by: jhh Change-Id: Id842d8ca5773d0c1104ae387519375fb914bdf4f Signed-off-by: jhh --- .../trans/CacheBasedControlLoopMetricsManager.java | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'controlloop/common/feature-controlloop-trans/src/main') diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java index d0b79125b..66a975024 100644 --- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java +++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/CacheBasedControlLoopMetricsManager.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -248,9 +248,22 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics { protected void evicted(VirtualControlLoopNotification notification) { MdcTransaction .newTransaction(notification.getRequestId().toString(), notification.getFrom()) - .setServiceName(notification.getClosedLoopControlName()).setTargetEntity(notification.getTarget()) - .setStartTime(notification.getNotificationTime().toInstant()).setEndTime(Instant.now()) - .setResponseDescription("EVICTED").setStatusCode(false).metric().resetTransaction(); + .setServiceName(notification.getClosedLoopControlName()) + .setServiceInstanceId(notification.getPolicyName() + ":" + notification.getPolicyVersion()) + .setProcessKey("" + notification.getAai()) + .setTargetEntity(notification.getTargetType() + "." + notification.getTarget()) + .setResponseCode(UNKNOWN_RESPONSE_CODE) + .setStartTime(notification.getNotificationTime().toInstant()) + .setEndTime(Instant.now()) + .setResponseDescription("EVICTED") + .setStatusCode(false) + .setCustomField1((notification.getNotification() != null) + ? notification.getNotification().name() : "") + .setCustomField2(notification.getPolicyScope()) + .setClientIpAddress(notification.getClosedLoopEventClient()) + .metric() + .resetTransaction(); + } @Override @@ -291,8 +304,7 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics { return MdcTransaction .newTransaction(notification.getRequestId().toString(), notification.getFrom()) .setServiceName(notification.getClosedLoopControlName()) - .setServiceInstanceId(notification.getPolicyScope() - + ":" + notification.getPolicyName() + ":" + notification.getPolicyVersion()) + .setServiceInstanceId(notification.getPolicyName() + ":" + notification.getPolicyVersion()) .setProcessKey("" + notification.getAai()) .setTargetEntity(notification.getTargetType() + "." + notification.getTarget()) .setResponseCode((notification.getNotification() != null) @@ -300,6 +312,7 @@ class CacheBasedControlLoopMetricsManager implements ControlLoopMetrics { : UNKNOWN_RESPONSE_CODE) .setCustomField1((notification.getNotification() != null) ? notification.getNotification().name() : "") + .setCustomField2(notification.getPolicyScope()) .setResponseDescription(notification.getMessage()) .setClientIpAddress(notification.getClosedLoopEventClient()); } -- cgit 1.2.3-korg