mirror of https://github.com/apache/jclouds.git
Issue 695: Refactored getDailyCpuPerformanceStatistics into getPerformanceStatistics as it works for daily/hourly+memory/cpu
This commit is contained in:
parent
e4fdcbbeb1
commit
f6c606e631
|
@ -123,11 +123,11 @@ public interface ResourceAsyncClient {
|
||||||
ListenableFuture<ComputePoolPerformanceStatistics> getComputePoolPerformanceStatistics(@EndpointParam URI uri);
|
ListenableFuture<ComputePoolPerformanceStatistics> getComputePoolPerformanceStatistics(@EndpointParam URI uri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ResourceClient#getDailyCpuPerformanceStatistics
|
* @see ResourceClient#getPerformanceStatistics
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
@Consumes("application/vnd.tmrk.cloud.performanceStatistics")
|
@Consumes("application/vnd.tmrk.cloud.performanceStatistics")
|
||||||
@JAXBResponseParser
|
@JAXBResponseParser
|
||||||
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
@ExceptionParser(ReturnNullOnNotFoundOr404.class)
|
||||||
ListenableFuture<PerformanceStatistics> getDailyCpuPerformanceStatistics(@EndpointParam URI uri);
|
ListenableFuture<PerformanceStatistics> getPerformanceStatistics(@EndpointParam URI uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,18 +155,28 @@ public interface ResourceClient {
|
||||||
ComputePoolPerformanceStatistics getComputePoolPerformanceStatistics(URI uri);
|
ComputePoolPerformanceStatistics getComputePoolPerformanceStatistics(URI uri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Get Resources Performance Statistics Processor Daily call returns daily
|
* The getPerformanceStatistics call returns information regarding performance for a specified compute pool.
|
||||||
* information regarding processor performance for a specified compute pool
|
* There are 2 time periods available: daily and hourly
|
||||||
|
* There is information for cpu (processor) and memory.
|
||||||
|
* To determine the correct URI to use, first call {@code getComputePoolPerformanceStatistics}
|
||||||
|
* then select the desired statistic from the result (e.g. hourly or daily then cpu or memory)
|
||||||
*
|
*
|
||||||
* returns statistics for the previous seven days.
|
* Daily statistics return results for the previous seven days.
|
||||||
*
|
*
|
||||||
* The default endTime is midnight the beginning of the current day and the default
|
* The default endTime is midnight the beginning of the current day
|
||||||
* startTime is midnight seven days prior to the endTime.
|
* and the default startTime is midnight seven days prior to the endTime.
|
||||||
* For example, if the call is made at 2011-07-12T14:48:00Z, then startTime is 2011-07-05T00:00:00Z
|
* For example, if the call is made at 2011-07-12T14:48:00Z,
|
||||||
* and endTime is 2011-07-12T00:00:00Z.
|
* then startTime is 2011-07-05T00:00:00Z and endTime is 2011-07-12T00:00:00Z.
|
||||||
* @param uri uri the uri of the call based upon the compute pool
|
*
|
||||||
* e.g. /cloudapi/ecloud/computepools/{id}/usage/cpu/performanceStatistics/daily
|
* Hourly statistics return results for the previous 24 hours
|
||||||
* @return
|
*
|
||||||
|
* The default endTime is the end of the hour prior to the current time
|
||||||
|
* and the default startTime is the beginning of the hour 24 hours prior to the endTime.
|
||||||
|
* For example, if the call is made at 2011-07- 12T14:48:00Z,
|
||||||
|
* then startTime is 2011-07-11T13:00:00Z and endTime is 2011-07-12T14:00:00Z.
|
||||||
|
*
|
||||||
|
* @param uri uri the uri of the call.
|
||||||
|
* @return the performance statistics for the desired period and metric
|
||||||
*/
|
*/
|
||||||
PerformanceStatistics getDailyCpuPerformanceStatistics(URI uri);
|
PerformanceStatistics getPerformanceStatistics(URI uri);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,8 +158,8 @@ public class ResourceAsyncClientTest extends BaseTerremarkEnterpriseCloudAsyncCl
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDailyCpuPerformanceStatistics() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
|
public void testGetPerformanceStatistics() throws SecurityException, NoSuchMethodException, IOException, URISyntaxException {
|
||||||
Method method = ResourceAsyncClient.class.getMethod("getDailyCpuPerformanceStatistics", URI.class);
|
Method method = ResourceAsyncClient.class.getMethod("getPerformanceStatistics", URI.class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, URI.create("/cloudapi/ecloud/computepools/89/usage/cpu/performancestatistics/daily"));
|
HttpRequest httpRequest = processor.createRequest(method, URI.create("/cloudapi/ecloud/computepools/89/usage/cpu/performancestatistics/daily"));
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud/computepools/89/usage/cpu/performancestatistics/daily HTTP/1.1");
|
assertRequestLineEquals(httpRequest, "GET https://services-beta.enterprisecloud.terremark.com/cloudapi/ecloud/computepools/89/usage/cpu/performancestatistics/daily HTTP/1.1");
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.tmrk.enterprisecloud.features;
|
||||||
|
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.Link;
|
import org.jclouds.tmrk.enterprisecloud.domain.Link;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
import org.jclouds.tmrk.enterprisecloud.domain.internal.ResourceCapacity;
|
||||||
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolPerformanceStatistics;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.PerformanceStatistics;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.PerformanceStatistics;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.ComputePoolCpuUsage;
|
||||||
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
import org.jclouds.tmrk.enterprisecloud.domain.resource.ComputePoolResourceSummary;
|
||||||
|
@ -122,8 +123,17 @@ public class ResourceClientLiveTest extends BaseTerremarkEnterpriseCloudClientLi
|
||||||
assertNotNull(usage);
|
assertNotNull(usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetDailyCpuPerformanceStatistics() throws Exception {
|
public void testGetPerformanceStatistics() throws Exception {
|
||||||
PerformanceStatistics stats = client.getDailyCpuPerformanceStatistics(URI.create("/cloudapi/ecloud/computepools/89/usage/cpu/performancestatistics/daily"));
|
ComputePoolPerformanceStatistics statistics = client.getComputePoolPerformanceStatistics(URI.create("/cloudapi/ecloud/computepools/89/performancestatistics"));
|
||||||
|
assertNotNull(statistics);
|
||||||
|
testPerformanceStatistic(statistics.getDaily().getCpu().getHref());
|
||||||
|
testPerformanceStatistic(statistics.getDaily().getMemory().getHref());
|
||||||
|
testPerformanceStatistic(statistics.getHourly().getCpu().getHref());
|
||||||
|
testPerformanceStatistic(statistics.getHourly().getMemory().getHref());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testPerformanceStatistic(URI uri) {
|
||||||
|
PerformanceStatistics stats = client.getPerformanceStatistics(uri);
|
||||||
assertNotNull(stats);
|
assertNotNull(stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -95,7 +95,7 @@ public class PerformanceStatisticsJAXBParsingTest extends BaseRestClientTest {
|
||||||
|
|
||||||
public void testParseWithJAXB() throws Exception {
|
public void testParseWithJAXB() throws Exception {
|
||||||
|
|
||||||
Method method = ResourceAsyncClient.class.getMethod("getDailyCpuPerformanceStatistics", URI.class);
|
Method method = ResourceAsyncClient.class.getMethod("getPerformanceStatistics", URI.class);
|
||||||
HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method,new URI("/1"));
|
HttpRequest request = factory(ResourceAsyncClient.class).createRequest(method,new URI("/1"));
|
||||||
assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
|
assertResponseParserClassEquals(method, request, ParseXMLWithJAXB.class);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue