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.
Support case IT354894
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.
Applied suggested patch, expanded to cover some other code paths. Thanks.
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2467 Imported an attachment (id=368804)
commit 15c5ab632360523f7ad37112700a1f2220163fb0
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)
qa -> cwelton
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)
QA Verified - user can get metrics for various different numPoints values.
Mass-closure of verified bugs against JON.