From 45b6c0b4cd5f567975690fab6595ef91f043f34e Mon Sep 17 00:00:00 2001
From: luiscal4a <l.delacal@alumnos.upm.es>
Date: Wed, 28 Sep 2022 15:06:28 +0200
Subject: [PATCH] Changed timestamp attribute of the monitored KPIs in the
 Centralized Attack Detector

---
 .../l3_centralizedattackdetectorServiceServicerImpl.py        | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py
index 4386e6726..fd1387655 100644
--- a/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py
+++ b/src/l3_centralizedattackdetector/service/l3_centralizedattackdetectorServiceServicerImpl.py
@@ -32,7 +32,7 @@ from common.proto.kpi_sample_types_pb2 import KpiSampleType
 # from monitoring.client.MonitoringClient import MonitoringClient
 from monitoring.client.MonitoringClient import MonitoringClient
 from common.proto.monitoring_pb2 import Kpi
-from common.proto.context_pb2 import Timestamp
+from common.tools.timestamp.Converters import timestamp_utcnow_to_float
 
 LOGGER = logging.getLogger(__name__)
 here = os.path.dirname(os.path.abspath(__file__))
@@ -159,7 +159,7 @@ class l3_centralizedattackdetectorServiceServicerImpl(L3Centralizedattackdetecto
         kpi_prob.kpi_id.kpi_id.uuid = self.class_probability_kpi_id.uuid
         kpi_prob.kpi_value.floatVal = request.confidence
 
-        kpi_class.timestamp = kpi_prob.timestamp = Timestamp()
+        kpi_class.timestamp = kpi_prob.timestamp = timestamp_utcnow_to_float()
 
         self.monitoring_client.IncludeKpi(kpi_class)
         self.monitoring_client.IncludeKpi(kpi_prob)
-- 
GitLab