org.apache.kylin.rest.request.MetricsRequest Java Examples

The following examples show how to use org.apache.kylin.rest.request.MetricsRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CubeService.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: CubeService.java    From kylin with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: CubeService.java    From Kylin with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: AdminController.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/metrics/cubes", method = { RequestMethod.GET }, produces = { "application/json" })
@ResponseBody
public MetricsResponse cubeMetrics(MetricsRequest request) {
    return cubeMgmtService.calculateMetrics(request);
}
 
Example #5
Source File: AdminController.java    From kylin with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/metrics/cubes", method = { RequestMethod.GET }, produces = { "application/json" })
@ResponseBody
public MetricsResponse cubeMetrics(MetricsRequest request) {
    return cubeMgmtService.calculateMetrics(request);
}
 
Example #6
Source File: AdminController.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@RequestMapping(value = "/metrics/cubes", method = { RequestMethod.GET })
@ResponseBody
public MetricsResponse cubeMetrics(MetricsRequest request) {
    return cubeMgmtService.calculateMetrics(request);
}