Bug 801167

Summary: postgres plugin Query resource cannot obtain metric
Product: [Other] RHQ Project Reporter: John Mazzitelli <mazz>
Component: PluginsAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.3CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 801186 (view as bug list) Environment:
Last Closed: 2013-09-01 15:19:43 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 801186    

Description John Mazzitelli 2012-03-07 15:05:58 EST
using the postgres Query resource type, I'm defining everything correctly, but the metric value isn't coming through.

I think its because the metric propery name is metricColumn (camel case) but hte jdbc metadata that gets returned is all the same case (metriccolumn) and when doing a case-sensitive search in a map for "metricColumn", it fails on lookup (and that's how it gets the value of the column data). This is a guess, but I think that's what is going on.
Comment 1 John Mazzitelli 2012-03-07 16:00:23 EST
I was totally wrong in my guess of what's going on.

Turns out, the metric query should return one row, TWO columns - in this case, the first column must have the value 'metricColumn' (literally) and the second is the numeric value.

select 'metricColumn', count(id) from my_table

is one example.

I did tweek the code slightly to support the use case where you don't want to supply a metric query and I allow for the name/description to be optional. I also added some debug log messages. But the core functionality was already there and working.

So, this should be considered a doc issue more than anything. We need better docs to explain how to use this resource.
Comment 2 John Mazzitelli 2012-03-07 16:07:00 EST
master git commit: 0910465
Comment 3 Heiko W. Rupp 2013-09-01 15:19:43 EDT
Bulk closing of BZs that have no target version set, but which are ON_QA for more than a year and thus are in production for a long time.