Bug 796983 - Database plugin: Improve discovery and use of column formatted metrics
Summary: Database plugin: Improve discovery and use of column formatted metrics
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.3
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: RHQ 4.5.0
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-24 00:34 UTC by Elias Ross
Modified: 2013-09-01 10:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-01 10:11:30 UTC
Embargoed:


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

Description Elias Ross 2012-02-24 00:34:44 UTC
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.

Changes:
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 17:12:57 UTC
triage 2/27/2012 mfoley, asantos, crouch, loleary

Comment 2 Elias Ross 2012-03-16 17:29:21 UTC
Created attachment 570666 [details]
based on commit 53715248896279279af299e56cdf6d7918a7dcb9

Comment 3 Elias Ross 2012-03-16 17:31:12 UTC
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 14:00:09 UTC
Elias,

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()

    @AfterTest
    protected void after() throws Exception {
        for (ResourceComponent c : components.keySet())
            c.stop();
        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 14:01:02 UTC
Created attachment 596229 [details]
Heiko's diff

Comment 6 Elias Ross 2012-07-05 17:01:07 UTC
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 20:20:43 UTC
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 10:11:30 UTC
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.