本文整理汇总了Java中org.apache.kylin.rest.request.MetricsRequest类的典型用法代码示例。如果您正苦于以下问题:Java MetricsRequest类的具体用法?Java MetricsRequest怎么用?Java MetricsRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetricsRequest类属于org.apache.kylin.rest.request包,在下文中一共展示了MetricsRequest类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateMetrics
import org.apache.kylin.rest.request.MetricsRequest; //导入依赖的package包/类
public MetricsResponse calculateMetrics(MetricsRequest request) {
List<CubeInstance> cubes = this.getCubeManager().listAllCubes();
MetricsResponse metrics = new MetricsResponse();
Date startTime = (null == request.getStartTime()) ? new Date(-1) : request.getStartTime();
Date endTime = (null == request.getEndTime()) ? new Date() : request.getEndTime();
metrics.increase("totalCubes", (float) 0);
metrics.increase("totalStorage", (float) 0);
for (CubeInstance cube : cubes) {
Date createdDate = new Date(-1);
createdDate = (cube.getCreateTimeUTC() == 0) ? createdDate : new Date(cube.getCreateTimeUTC());
if (createdDate.getTime() > startTime.getTime() && createdDate.getTime() < endTime.getTime()) {
metrics.increase("totalCubes");
}
}
metrics.increase("aveStorage",
(metrics.get("totalCubes") == 0) ? 0 : metrics.get("totalStorage") / metrics.get("totalCubes"));
return metrics;
}
示例2: calculateMetrics
import org.apache.kylin.rest.request.MetricsRequest; //导入依赖的package包/类
public MetricsResponse calculateMetrics(MetricsRequest request) {
List<CubeInstance> cubes = this.getCubeManager().listAllCubes();
MetricsResponse metrics = new MetricsResponse();
Date startTime = (null == request.getStartTime()) ? new Date(-1) : request.getStartTime();
Date endTime = (null == request.getEndTime()) ? new Date() : request.getEndTime();
metrics.increase("totalCubes", (float) 0);
metrics.increase("totalStorage", (float) 0);
for (CubeInstance cube : cubes) {
Date createdDate = new Date(-1);
createdDate = (cube.getCreateTimeUTC() == 0) ? createdDate : new Date(cube.getCreateTimeUTC());
if (createdDate.getTime() > startTime.getTime() && createdDate.getTime() < endTime.getTime()) {
metrics.increase("totalCubes");
}
}
metrics.increase("aveStorage", (metrics.get("totalCubes") == 0) ? 0 : metrics.get("totalStorage") / metrics.get("totalCubes"));
return metrics;
}
示例3: cubeMetrics
import org.apache.kylin.rest.request.MetricsRequest; //导入依赖的package包/类
@RequestMapping(value = "/metrics/cubes", method = { RequestMethod.GET }, produces = { "application/json" })
@ResponseBody
public MetricsResponse cubeMetrics(MetricsRequest request) {
return cubeMgmtService.calculateMetrics(request);
}
示例4: cubeMetrics
import org.apache.kylin.rest.request.MetricsRequest; //导入依赖的package包/类
@RequestMapping(value = "/metrics/cubes", method = { RequestMethod.GET })
@ResponseBody
public MetricsResponse cubeMetrics(MetricsRequest request) {
return cubeMgmtService.calculateMetrics(request);
}