ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hurley" <jhur...@hortonworks.com>
Subject Re: Review Request 36190: Alerts: HDFS Capacity Utilization Alert Always Shows 0%
Date Mon, 06 Jul 2015 14:10:24 GMT


> On July 6, 2015, 10:04 a.m., Nate Cole wrote:
> > ambari-agent/src/main/python/ambari_agent/alerts/metric_alert.py, lines 265-271
> > <https://reviews.apache.org/r/36190/diff/1/?file=999572#file999572line265>
> >
> >     Oh yuck.  I'd rather cast the value to a float for math then do this

I went back and forth in my head over this one. I like just using a float to ensure that it
does the floating point division, but that only covers the case where you are doing a percent.
If there is an alert with the math `{0}/{1}` then it will silently fail and drive people nuts.
Case in point, this bug went undetected in 2 releases!

If you have a strong feeling against using the `from __future__ import division`, I can take
it out. But then we'll be forcing people to write they definitions like `({0}*1.0}/{1})` which
is not very intuitive.


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/36190/#review90482
-----------------------------------------------------------


On July 5, 2015, 11:58 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/36190/
> -----------------------------------------------------------
> 
> (Updated July 5, 2015, 11:58 p.m.)
> 
> 
> Review request for Ambari, Nate Cole and Tom Beerbower.
> 
> 
> Bugs: AMBARI-12285
>     https://issues.apache.org/jira/browse/AMBARI-12285
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Some alerts, such as the HDFS capacity or DataNode capacity always show a utilization
of 0%, preventing any alert from triggering since the state is always OK.
> 
> This is due to integer division which causes the float percentage to be rounded down
to 0.
> 
> 
> Diffs
> -----
> 
>   ambari-agent/src/main/python/ambari_agent/alerts/metric_alert.py fea2f6c 
>   ambari-agent/src/test/python/ambari_agent/TestAlerts.py 4570842 
>   ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
47ddd7a 
>   ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/alerts.json 4e62eab

>   ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json cee8209

> 
> Diff: https://reviews.apache.org/r/36190/diff/
> 
> 
> Testing
> -------
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 22.140 s
> [INFO] Finished at: 2015-07-05T22:34:46-04:00
> [INFO] Final Memory: 13M/245M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message