Uploaded image for project: 'Data Collection, Analytics, and Events'
  1. Data Collection, Analytics, and Events
  2. DCAEGEN2-3263

Heartbeat MS - db_monitoring.py never update DB CL_flag to 0 if the HB peroid missed

XMLWordPrintable

      Hi,

      I've found the problem with the logic of HB microservice.

      db_monitoring.py has infinite cycle that raise 'ONSET' ControlLoopEvent in case heartbeat messages are not coming for configurated period (by default 3*60 sec - 180 seconds).

      In case of missing heartbeats the message is sent to DmaaP from db_monitoring function. This works OK.

      But then, when heartbeats are back the logic of the cycle is the following:

      "elif (epoc_time - epoc_time_sec) < comparision_time and cl_flag == 1:
                                  sendControlLoopEvent(
                                      "ABATED",

                                   .........

                                  cl_flag = 0
                                  cur.execute(
                                      "UPDATE vnf_table_2 SET CL_FLAG = %s WHERE EVENT_NAME = %s AND " "source_name_key = %s",
                                      (cl_flag, event_name, (source_name_key + 1)),

      "

      As you may see this "ABATED" message and update to cl_flag=0 happens only if "epoc_time (current time) - epoc_time_sec (time from DB with time of last heartbeat)) < comparision_time (180 seconds)"

      So if next heartbeat will come after 180 seconds from last heartbeat stored in DB the 'ABATED' message will not be sent and table will not be updated.

       

      Looks like this is not correct behaviour. And condition should be changed from

      "elif (epoc_time - epoc_time_sec) < comparision_time and cl_flag == 1:"

      to

      "elif (epoc_time - epoc_time_sec) > 0 and cl_flag == 1:"

       

       

            vv770d vv770d
            vladislavlh vladislavlh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: