CZ Haung created AMBARI-25125:
---------------------------------

             Summary: Bugs in port_alert.py prevent alerts from being generated 
correctly
                 Key: AMBARI-25125
                 URL: https://issues.apache.org/jira/browse/AMBARI-25125
             Project: Ambari
          Issue Type: Bug
          Components: alerts
    Affects Versions: 2.6.2
            Reporter: CZ Haung


We have observed bugs in port_alerrt.py, which prevent alerts from being 
generated correctly.

Specially, the highlighted code below has bugs.

end_time = time.time()
{color:#FF0000}milliseconds = end_time - start_time{color}
{color:#FF0000}seconds = milliseconds / 1000.0{color}

It should be
{color:#FF0000}seconds = end_time - start_time{color}
{color:#FF0000}milliseconds = seconds * 1000.0 ### Not referenced anymore and 
can be removed{color}

{color:#333333}{color}So to have ambari agent report a 1-second response time, 
the actual response time need to be 1000 seconds!

Here is what Python time.time() does:
Help on built-in function time in module time:

time(...)
 time() -> floating point number

Return the current time {color:#d04437}*in seconds*{color} since the Epoch.
 Fractions of a second may be present if the system clock provides them.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to