Bug 659152

Summary: JON241: traits that have non-null values show values of "?" in the CLI
Product: [Other] RHQ Project Reporter: Charles Crouch <ccrouch>
Component: CLIAssignee: Lukas Krejci <lkrejci>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: high    
Version: 3.0.0CC: hbrock, ian.springer, jsanda, jshaughn, kbaker, skondkar, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 614251 Environment:
Last Closed: 2011-05-24 01:11:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 614251    
Bug Blocks: 616081    

Description Charles Crouch 2010-12-02 01:24:30 UTC
+++ This bug was initially created as a clone of Bug #614251 +++

Inventory an AS or EAP server that is running the 'all' or 'production' configuration. In the GUI, go to the server Resource and wait until its traits (buildDate, startDate, partitionName, etc.) have been collected - i.e. verify values are displayed for the traits in the Resource's Summary header. Now run the CLI and connect to the same RHQ Server. Retrieve the same AS server Resource, e.g.:

var jvmProxy = ProxyFactory.getResource(12345);

(in this example, its Resource id is 12345)

Print the Resource's attributes:

jvmProxy

You should notice that all of the attributes corresponding to traits have values of "?", e.g.:

ResourceClientProxy_$$_javassist_0:
	                  JVMFreeMemory: ?
	                   JVMMaxMemory: ?
	                 JVMTotalMemory: ?
	              activeThreadCount: ?
	         activeThreadGroupCount: ?
	                      buildDate: ?
	                       children: 
	           clusterPartitionName: ?
	                   contentTypes: {library=JAR Library, cumulativePatch=Cumulative Patch}
	                    createdDate: Tue Jul 13 14:57:20 EDT 2010
	                    description: JBoss Enterprise Application Platform
	                        handler: 
	                             id: 10004
	                   measurements: [Start Date, Cluster Partition Name, JVM Free Memory, Transactions Committed per Minute, Total Transactions, Server Home Dir, Transactions Rolledback, Transactions Committed, Active Thread Group Count, Version Name, Server Name, Total Transactions per Minute, Active Thread Count, Transactions Rolledback per Minute, Transactions Rolled Back per Minute, JVM Total Memory, JVM Max Memory, Build Date, Transactions Rolled Back, Partition Name]
	                   modifiedDate: Tue Jul 13 14:57:20 EDT 2010
	                           name: 127.0.0.52:1099
	                     operations: [org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@31e46a68, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@b05eb6f, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@31a3ca10]
	                  partitionName: ?
	            pluginConfiguration: 
	  pluginConfigurationDefinition: ConfigurationDefinition[id=10061, name=JBossAS Server]
	                   resourceType: JBossAS Server
	                  serverHomeDir: ?
	                     serverName: ?
	                      startDate: ?
	              totalTransactions: ?
	     totalTransactionsperMinute: ?
	          transactionsCommitted: ?
	 transactionsCommittedperMinute: ?
	         transactionsRolledBack: 0.0
	transactionsRolledBackperMinute: 0.0
	         transactionsRolledback: ?
	transactionsRolledbackperMinute: ?
	                        version: 5.1.0.Branch
	                    versionName: ?

--- Additional comment from ccrouch on 2010-07-23 13:46:31 EDT ---

Dropping the priority on getting this included in the 2.4 release

--- Additional comment from jsanda on 2010-10-12 10:52:16 EDT ---

There are actually a couple of things contributing to this behavior. First, in the CLI, the ResourceProxy class is using a criteria query that is too broad, at least when the jboss-as and jboss-as-5 plugins are involved. Secondly, the server/agent API used to get the metric data accepts a variable number of measurement names but only a single data type for those measurements. This is problematic because there is nothing to guarantee that all of the metrics are of the same type. In fact, in the manual testing I have done while working on this, I frequently see both TRAIT and METRIC for the data type. On the server side, we are using a hard-coded value of METRIC for the data type argument. The method(s) MeasurementManagerLocal.findLiveData and MeasurementManagerRemote.findLiveData will fail any time one of the measurement definitions has a data type other than METRIC.

--- Additional comment from jsanda on 2010-10-12 11:03:52 EDT ---

I have committed fixes for both of the issues described in the previous comment.

commit hash: ca289182efed696e10cbda5c8ad2b53ff2bc5acb

--- Additional comment from jsanda on 2010-10-12 11:06:50 EDT ---

I am still not able to get values for the partitionName metric in either the jboss-as or jboss-as-5 plugins. I did some additional debugging with the jboss-as-5 plugin, and the issue does not appear to be related to this bug. I get the following exception in my agent log when trying to get the value for the paritionName metric:

ERROR [ResourceContainer.invoker.daemon-16] (org.rhq.plugins.jbossas5.ApplicationServerComponent)- Failed to obtain metric 'MCBean|ServerConfig|*|partitionName'.
java.lang.NullPointerException
	at org.rhq.plugins.jbossas5.util.ManagedComponentUtils.getSimplePropertyValue(ManagedComponentUtils.java:83)
	at org.rhq.plugins.jbossas5.ApplicationServerComponent.getMetric(ApplicationServerComponent.java:544)
	at org.rhq.plugins.jbossas5.ApplicationServerComponent.getValues(ApplicationServerComponent.java:248)
	at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

--- Additional comment from ian.springer on 2010-10-12 14:08:15 EDT ---

John,

Can you open a new BZ issue for the partitionName bug?

--- Additional comment from skondkar on 2010-10-22 06:19:02 EDT ---

Verified on RHQ build#442

Inventoried an JBoss EAP running the 'production' configuration. Installed the Command Line Client. Started the CLI and connected to the RHQ Server. Retrieved the same JBoss EAP server Resource. 

After running the 'jvmProxy' on cli, observed that the traits does not display ? for non-null values as below:

rhqadmin.193.104:7080$ jvmProxy
ResourceClientProxy_$$_javassist_0:
                          JVMFreeMemory: 211.5MB
                           JVMMaxMemory: 499.2MB
                         JVMTotalMemory: 499.2MB
                      activeThreadCount: 137.0
                 activeThreadGroupCount: 15.0
                              buildDate: 20091020
                               children: 
                   clusterPartitionName: DefaultPartition
                           contentTypes: {library=JAR Library, cumulativePatch=Cumulative Patch}
                            createdDate: Fri Oct 22 15:30:17 IST 2010
                            description: JBoss Enterprise Application Platform
                                handler: 
                                     id: 10601
                           measurements: [Start Date, Cluster Partition Name, JVM Free Memory, Transactions Committed per Minute, Total Transactions, Server Home Dir, Transactions Committed, Active Thread Group Count, Version Name, Server Name, Total Transactions per Minute, Active Thread Count, Transactions Rolled Back per Minute, JVM Total Memory, JVM Max Memory, Build Date, Transactions Rolled Back]
                           modifiedDate: Fri Oct 22 15:30:17 IST 2010
                                   name: sunillaptop.usersys.redhat.com:1099 production
                             operations: [org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@108f8e0, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@b6ef8, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@a29c6e]
                    pluginConfiguration: 
          pluginConfigurationDefinition: ConfigurationDefinition[id=10135, name=JBossAS Server]
                           resourceType: JBossAS Server
                          serverHomeDir: /NotBackedUp/jon3.1/eap5/jboss-eap-5.0/jboss-as/server/production
                             serverName: production
                              startDate: Fri Oct 22 15:25:27 IST 2010
                      totalTransactions: 0.0
             totalTransactionsperMinute: 0.0
                  transactionsCommitted: 0.0
         transactionsCommittedperMinute: 0.0
                 transactionsRolledBack: 0.0
        transactionsRolledBackperMinute: 0.0
                                version: 5.0.0.GA
                            versionName: EAP

--- Additional comment from skondkar on 2010-11-22 09:10:11 EST ---

Retested this on Build #24 (jon241-release/24)

Inventoried an JBoss EAP running the 'production' configuration.

Navigated to the server Resource and waited until its traits values are displayed in the Resource's Summary header.
Installed the Command Line Client. Started the CLI and connected to the RHQ Server. Retrieved the same JBoss EAP server Resource.

After running the 'jvmProxy' on cli, noticed that all of the attributes corresponding to traits have values of "?" as below:

rhqadmin.193.104:7080$ jvmProxy
ResourceClientProxy_$$_javassist_0:
                          JVMFreeMemory: ?
                           JVMMaxMemory: ?
                         JVMTotalMemory: ?
                      activeThreadCount: ?
                 activeThreadGroupCount: ?
                              buildDate: ?
                               children: 
                   clusterPartitionName: ?
                           contentTypes: {library=JAR Library, cumulativePatch=Cumulative Patch}
                            createdDate: Mon Nov 22 18:19:01 IST 2010
                            description: JBoss Enterprise Application Platform
                                handler: 
                                     id: 11701
                           measurements: [Start Date, Cluster Partition Name, JVM Free Memory, Transactions Committed per Minute, Total Transactions, Server Home Dir, Transactions Rolledback, Transactions Committed, Active Thread Group Count, Version Name, Server Name, Total Transactions per Minute, Active Thread Count, Transactions Rolledback per Minute, Transactions Rolled Back per Minute, JVM Total Memory, JVM Max Memory, Build Date, Transactions Rolled Back, Partition Name]
                           modifiedDate: Mon Nov 22 18:19:01 IST 2010
                                   name: localhost.localdomain:1099 production
                             operations: [org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@1b994de, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@dc9766, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@57e787]
                          partitionName: ?
                    pluginConfiguration: 
          pluginConfigurationDefinition: ConfigurationDefinition[id=10125, name=JBossAS Server]
                           resourceType: JBossAS Server
                          serverHomeDir: ?
                             serverName: ?
                              startDate: ?
                      totalTransactions: ?
             totalTransactionsperMinute: ?
                  transactionsCommitted: ?
         transactionsCommittedperMinute: ?
                 transactionsRolledBack: 0.0
        transactionsRolledBackperMinute: 0.0
                 transactionsRolledback: ?
        transactionsRolledbackperMinute: ?
                                version: 5.0.0.GA
                            versionName: ?

Comment 1 Charles Crouch 2010-12-02 01:25:51 UTC
Lukas please move the fix over from master into the release30 branch.

Comment 2 Lukas Krejci 2010-12-03 11:45:59 UTC
commit a48b635436d08a1412a4b6894635309e281c979c
Author: John Sanda <jsanda>
Date:   Tue Oct 12 11:11:48 2010 -0400

    [BZ 614251] Forgot to include updated interface in previous commit

commit 813b652727f525a2f03748d15a6edaec1db6a097
Author: John Sanda <jsanda>
Date:   Tue Oct 12 10:55:23 2010 -0400

    [BZ 614251] Making multiple changes so that live metric data can be fetched and displayed
    
    There are two changes with this commit. First, in the CLI the ResourceProxy class
    was using a criteria query that is too broad, at least when the jboss-as and
    jboss-as-5 plugins are involved.
    
    Secondly, the server/agent API used to get the
    metric data is inadequate. It accepts a variable number of measurement names but
    only a single data type for those measurements.  This is problematic because
    there is nothing to guarantee that all of the metrics are of the same type.
    On the server side, we were using a hard-coded value of METRIC for the data
    type argument. The method(s) MeasurementManagerLocal.findLiveData and
    MeasurementManagerRemote.findLiveData will fail any time one of the
    measurement definitions has a data type other than METRIC.
    MeasurementManager.getRealTimeMeasurementValue has been refactored to take a list
    of MeasurementDataRequest objects. Each request specifies the metric name along
    with its corresponding data type.

Comment 3 Sunil Kondkar 2010-12-06 07:15:27 UTC
Verified on Jon241 build#35


Inventoried an JBoss EAP running the 'production' configuration. Installed the
Command Line Client. Started the CLI and connected to the RHQ Server. Retrieved
the same JBoss EAP server Resource. 

After running the 'jvmProxy' on cli, observed that the traits does not display
? for non-null values as below:

rhqadmin.193.104:7080$ jvmProxy
ResourceClientProxy_$$_javassist_0:
                          JVMFreeMemory: 219.9MB
                           JVMMaxMemory: 499.2MB
                         JVMTotalMemory: 499.2MB
                      activeThreadCount: 118.0
                 activeThreadGroupCount: 8.0
                              buildDate: 20100618
                               children: 
                   clusterPartitionName: DefaultPartition
                           contentTypes: {library=JAR Library, cumulativePatch=Cumulative Patch}
                            createdDate: Mon Dec 06 12:17:30 IST 2010
                            description: JBoss Enterprise Application Platform
                                handler: 
                                     id: 11851
                           measurements: [Start Date, Cluster Partition Name, JVM Free Memory, Transactions Committed per Minute, Total Transactions, Server Home Dir, Transactions Committed, Active Thread Group Count, Version Name, Server Name, Total Transactions per Minute, Active Thread Count, Transactions Rolled Back per Minute, JVM Total Memory, JVM Max Memory, Build Date, Transactions Rolled Back]
                           modifiedDate: Mon Dec 06 12:17:30 IST 2010
                                   name: localhost.localdomain:1099 production
                             operations: [org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@53c3f5, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@166340c, org.rhq.enterprise.client.proxy.ResourceClientProxy$Operation@e33e18]
                    pluginConfiguration: 
          pluginConfigurationDefinition: ConfigurationDefinition[id=10126, name=JBossAS Server]
                           resourceType: JBossAS Server
                          serverHomeDir: /NotBackedUp/jon3.1/eap5.1/jboss-5.1.0.Branch/server/production
                             serverName: production
                              startDate: Mon Dec 06 12:14:48 IST 2010
                      totalTransactions: 0.0
             totalTransactionsperMinute: 0.0
                  transactionsCommitted: 0.0
         transactionsCommittedperMinute: 0.0
                 transactionsRolledBack: 0.0
        transactionsRolledBackperMinute: 0.0
                                version: 5.1.0.Branch
                            versionName: EAP

Comment 4 Corey Welton 2011-05-24 01:11:42 UTC
Bookkeeping - closing bug - fixed in recent release.

Comment 5 Corey Welton 2011-05-24 01:11:42 UTC
Bookkeeping - closing bug - fixed in recent release.