Search in sources :

Example 1 with Statistics

use of org.cloudfoundry.client.v2.applications.Statistics in project cf-java-client by cloudfoundry.

the class DefaultApplications method toInstanceDetail.

private static InstanceDetail toInstanceDetail(Map.Entry<String, ApplicationInstanceInfo> entry, ApplicationStatisticsResponse statisticsResponse) {
    InstanceStatistics instanceStatistics = Optional.ofNullable(statisticsResponse.getInstances().get(entry.getKey())).orElse(emptyInstanceStats());
    Statistics stats = Optional.ofNullable(instanceStatistics.getStatistics()).orElse(emptyApplicationStatistics());
    Usage usage = Optional.ofNullable(stats.getUsage()).orElse(emptyApplicationUsage());
    return InstanceDetail.builder().index(entry.getKey()).state(entry.getValue().getState()).since(toDate(entry.getValue().getSince())).cpu(usage.getCpu()).memoryUsage(usage.getMemory()).diskUsage(usage.getDisk()).diskQuota(stats.getDiskQuota()).memoryQuota(stats.getMemoryQuota()).build();
}
Also used : Usage(org.cloudfoundry.client.v2.applications.Usage) InstanceStatistics(org.cloudfoundry.client.v2.applications.InstanceStatistics) Statistics(org.cloudfoundry.client.v2.applications.Statistics) InstanceStatistics(org.cloudfoundry.client.v2.applications.InstanceStatistics)

Aggregations

InstanceStatistics (org.cloudfoundry.client.v2.applications.InstanceStatistics)1 Statistics (org.cloudfoundry.client.v2.applications.Statistics)1 Usage (org.cloudfoundry.client.v2.applications.Usage)1