Bug 535809 (RHQ-2467) - MeasurementDataManagerBean.findDataForResource ignores numPoints argument
Summary: MeasurementDataManagerBean.findDataForResource ignores numPoints argument
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: RHQ-2467
Product: RHQ Project
Classification: Other
Component: No Component
Version: 1.3
Hardware: All
OS: All
low
medium
Target Milestone: ---
: ---
Assignee: Jay Shaughnessy
QA Contact: Corey Welton
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard: Branch RHQ_1_3_0_GA_CP
Depends On:
Blocks: JON231
TreeView+ depends on / blocked
 
Reported: 2009-10-16 00:12 UTC by James Livingston
Modified: 2018-10-20 04:28 UTC (History)
2 users (show)

Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
JON 2.3
Last Closed: 2010-08-12 16:56:21 UTC
Embargoed:


Attachments (Terms of Use)
rhq2467.patch (2.54 KB, text/x-patch)
2009-10-16 00:22 UTC, James Livingston
no flags Details

Description James Livingston 2009-10-16 00:12:00 UTC
MeasurementDataManagerBean.findDataForResource() takes numPoints as a parameter, but does not pass it to MeasurementDataManager.getMeasurementDataForResource() because that method hardcodes it to 60 rather than accepting a parameter. This means you can't change the number of points returned when used by the remote API.

The latter method should be changed to accept numPoints as a parameter rather than hard-coding it.

Comment 1 James Livingston 2009-10-16 00:12:57 UTC
Support case IT354894

Comment 2 James Livingston 2009-10-16 00:22:48 UTC
Potential patch. There is a method with the old signature which calls the one with the additional parameter, so it doesn't break any API that people might be using.

Comment 3 Jay Shaughnessy 2009-10-19 21:23:20 UTC
Applied suggested patch, expanded to cover some other code paths. Thanks.

Comment 4 Red Hat Bugzilla 2009-11-10 21:04:59 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2467
Imported an attachment (id=368804)


Comment 5 Jay Shaughnessy 2009-12-10 20:03:31 UTC
commit 15c5ab632360523f7ad37112700a1f2220163fb0

Comment 6 Jay Shaughnessy 2010-01-25 21:39:09 UTC
To test this use the CLI to ensure that MeasurementDataManager.findDataForResource acknowledges the numPoints arg.

1) log into a CLI session

2) find a resource that has been collecting data for some time.  If you don't have one the I suggest picking a CPU and set the collection interval to 30 seconds for System Load.  Then, wait about a 1/2 hour to collect some data.

Once you're ready:

> findResources( 'CPU' )

This will give you a resourceID for your CPU. Let's use 10040.

> var c = MeasurementDefinitionCriteria()
> c.addFilterDisplayName('System Load')

This will give you the measurement def id for System load. Let's use 10093.

> var defIds = new Array(1)
> defIds[0] = 10093

> var endTime = new Date().getTime()

Pick some time range for which you have data. Note that it should have at least enough data points as you're going to ask for. So, if you've been collecting every 30 seconds for an hour you'd have 120 data points.  On that assumption we'll use an hour interval.

> var beginTime = endTime - (60*60*1000)

Now, try a few different numPoints values:

> MeasurementDataManager.findDataForResource(10040,defIds, beginTime, endTime, 10)

> MeasurementDataManager.findDataForResource(10040,defIds, beginTime, endTime, 30)

> MeasurementDataManager.findDataForResource(10040,defIds, beginTime, endTime, 60)

> MeasurementDataManager.findDataForResource(10040,defIds, beginTime, endTime, 120)

Comment 7 Corey Welton 2010-01-26 13:53:21 UTC
qa -> cwelton

Comment 8 Corey Welton 2010-01-26 14:40:27 UTC
Test notes - per Comment #6:

> var c = MeasurementDefinitionCriteria()
> c.addFilterDisplayName('System Load')

This will give you the measurement def id for System load. Let's use 10093.

Need an extra statement here to get a usable id (i.e., '10093' equivalent)

MeasurementDefinitionManager.findMeasurementDefinitionsByCriteria(c)

Comment 9 Corey Welton 2010-01-26 14:41:41 UTC
QA Verified - user can get metrics for various different numPoints values.

Comment 10 Corey Welton 2010-08-12 16:56:21 UTC
Mass-closure of verified bugs against JON.


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