Bug 796983 - Database plugin: Improve discovery and use of column formatted metrics
Database plugin: Improve discovery and use of column formatted metrics
Product: RHQ Project
Classification: Other
Component: Plugins (Show other bugs)
Unspecified Unspecified
medium Severity unspecified (vote)
: ---
: RHQ 4.5.0
Assigned To: Heiko W. Rupp
Mike Foley
Depends On:
  Show dependency treegraph
Reported: 2012-02-23 19:34 EST by Elias Ross
Modified: 2013-09-01 06:11 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-09-01 06:11:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
based on commit 53715248896279279af299e56cdf6d7918a7dcb9 (21.01 KB, patch)
2012-03-16 13:29 EDT, Elias Ross
no flags Details | Diff
unit tests for database plugin using H2 Database (32.89 KB, patch)
2012-03-16 13:31 EDT, Elias Ross
no flags Details | Diff
Heiko's diff (53.34 KB, patch)
2012-07-04 10:01 EDT, Heiko W. Rupp
no flags Details | Diff

  None (edit)
Description Elias Ross 2012-02-23 19:34:44 EST
We use the RHQ database plugin to query for various metrics. However, it's missing some functionality and does not work against some specialty databases like Hive (for example) where 'count(*)' can take a long time.

1. Don't use count(*) for table discovery. It is much better to discover a table using a select statement that only considers the first row.
2. If a table name is not configured avoid discovery entirely.
3. Support for column data, where metrics can appear in a column format such as:

metric1  m2    m3
------- ---  ----
      2  42   9.0

4. Availability checks are skipped if the table name is not set.

This is a placeholder for a patch.
Comment 1 Mike Foley 2012-02-27 12:12:57 EST
triage 2/27/2012 mfoley, asantos, crouch, loleary
Comment 2 Elias Ross 2012-03-16 13:29:21 EDT
Created attachment 570666 [details]
based on commit 53715248896279279af299e56cdf6d7918a7dcb9
Comment 3 Elias Ross 2012-03-16 13:31:12 EDT
Created attachment 570667 [details]
unit tests for database plugin using H2 Database

This is another patch in a series of two.

You want to change the tests to use the new Arquillian setup. I would be curious to see how well Arquillian works compared to my test class.
Comment 4 Heiko W. Rupp 2012-07-04 10:00:09 EDT

I have applied the patches to my local repo. As you wrote the patch some time ago, the code diverged and the patch did not apply cleanly. Can you please
have a look at the code committed 

In the ComponentTest you shut down the PC in after()

    protected void after() throws Exception {
        for (ResourceComponent c : components.keySet())
        PluginContainer.getInstance().shutdown();  <<--- here

This makes the PC throw a NPE on next invocation of PC.shutdown(), as the PC_internal configuration object gets nulled out. When I disable above call, the test runs fine, but I fear this will only work as long as there is only one test. Could you have a look too?

I've attached my diff - check it?
Comment 5 Heiko W. Rupp 2012-07-04 10:01:02 EDT
Created attachment 596229 [details]
Heiko's diff
Comment 6 Elias Ross 2012-07-05 13:01:07 EDT
Looks great. I wrote this "ComponentTest" back when the Arquillian stuff wasn't available, so if you wanted to port it to that it might be better.
Comment 7 Heiko W. Rupp 2012-07-05 16:20:43 EDT
I committed above patch to master as rev 26959a31d8

Rewriting to Arquillian isn't in for me right now.

Thanks Elias!
Comment 8 Heiko W. Rupp 2013-09-01 06:11:30 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.

Note You need to log in before you can comment on or make changes to this bug.