NaN values for WebApplicationContextComponent metrics

Ian Springer ian.springer at redhat.com
Thu Nov 10 14:27:49 UTC 2011


There are three ways a plugin can indicate in its 
MeasurementFacet.getValues() impl that there's no data currently 
available for a requested metric:

1) set the data value to null (measurementDataNumeric.setValue(null))

2) set the data value to Double.NaN 
(measurementDataNumeric.setValue(Double.NaN))

3) for that metric, do not add a measurementDataNumeric to the 
MeasurementReport

I personally prefer 3), but we have plugins that use each of the 
different ways, so we pretty much have to continue to support all three. 
I'll update the Javadoc of MeasurementFacet.getValues() to actually 
document this info.

Here's the snippet from MeasurementDataManagerBean.addNumericData() in 
server-jar that implements 1) and 2):

          for (MeasurementDataNumeric aData : data) {
                 if (aData.getValue() == null || 
Double.isNaN(aData.getValue())) {
                     expectedCount--;
                     continue;
                 }
                 ...

On 11/09/2011 07:09 PM, Larry O'Leary wrote:
> In Double
> org.rhq.plugins.jbossas5.WebApplicationContextComponent.getServletMetric(ManagementView managementView, String metricName) throws Exception[1] the metrics averageResponseTime[2], minimumResponseTime[3], and maximumResponseTime[4] are calculated. In some circumstances though, their value is set to Double.NaN. I am assuming this is because there is no data for this period? If this assumption is correct, wouldn't 0 have the same meaning?
>
>
>
>
>
> [1]:
> http://git.fedorahosted.org/git?p=rhq/rhq.git;a=blob;f=modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java;h=0d96b2b0563e628b5f5306768a6eae3a4bf487a3;hb=refs/heads/master#l177
> [2]:
> http://git.fedorahosted.org/git?p=rhq/rhq.git;a=blob;f=modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java;h=0d96b2b0563e628b5f5306768a6eae3a4bf487a3;hb=refs/heads/master#l222
> [3]:
> http://git.fedorahosted.org/git?p=rhq/rhq.git;a=blob;f=modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java;h=0d96b2b0563e628b5f5306768a6eae3a4bf487a3;hb=refs/heads/master#l224
> [4]:
> http://git.fedorahosted.org/git?p=rhq/rhq.git;a=blob;f=modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/WebApplicationContextComponent.java;h=0d96b2b0563e628b5f5306768a6eae3a4bf487a3;hb=refs/heads/master#l226
>
>


-- 
Ian Springer
Principal Software Developer
JBoss Operations Network
Red Hat
ian.springer at redhat.com



More information about the rhq-devel mailing list