Java Code Examples for org.apache.kylin.rest.response.MetricsResponse#increase()
The following examples show how to use
org.apache.kylin.rest.response.MetricsResponse#increase() .
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: DashboardController.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/metric/query", method = RequestMethod.GET) @ResponseBody public MetricsResponse getQueryMetrics(@RequestParam(value = "projectName", required = false) String projectName, @RequestParam(value = "cubeName", required = false) String cubeName, @RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime) { checkAuthorization(projectName); MetricsResponse queryMetrics = new MetricsResponse(); PrepareSqlRequest sqlRequest = dashboardService.getQueryMetricsSQLRequest(startTime, endTime, projectName, cubeName); SQLResponse sqlResponse = queryService.doQueryWithCache(sqlRequest); if (!sqlResponse.getIsException()) { queryMetrics.increase("queryCount", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(0))); queryMetrics.increase("avgQueryLatency", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(1))); queryMetrics.increase("maxQueryLatency", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(2))); queryMetrics.increase("minQueryLatency", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(3))); } return queryMetrics; }
Example 2
Source File: DashboardController.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/metric/job", method = RequestMethod.GET) @ResponseBody public MetricsResponse getJobMetrics(@RequestParam(value = "projectName", required = false) String projectName, @RequestParam(value = "cubeName", required = false) String cubeName, @RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime) { checkAuthorization(projectName); MetricsResponse jobMetrics = new MetricsResponse(); PrepareSqlRequest sqlRequest = dashboardService.getJobMetricsSQLRequest(startTime, endTime, projectName, cubeName); SQLResponse sqlResponse = queryService.doQueryWithCache(sqlRequest); if (!sqlResponse.getIsException()) { jobMetrics.increase("jobCount", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(0))); jobMetrics.increase("avgJobBuildTime", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(1))); jobMetrics.increase("maxJobBuildTime", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(2))); jobMetrics.increase("minJobBuildTime", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(3))); } return jobMetrics; }
Example 3
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
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: DashboardController.java From kylin with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/metric/query", method = RequestMethod.GET) @ResponseBody public MetricsResponse getQueryMetrics(@RequestParam(value = "projectName", required = false) String projectName, @RequestParam(value = "cubeName", required = false) String cubeName, @RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime) { checkAuthorization(projectName); MetricsResponse queryMetrics = new MetricsResponse(); PrepareSqlRequest sqlRequest = dashboardService.getQueryMetricsSQLRequest(startTime, endTime, projectName, cubeName); SQLResponse sqlResponse = queryService.doQueryWithCache(sqlRequest); if (!sqlResponse.getIsException()) { queryMetrics.increase("queryCount", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(0))); queryMetrics.increase("avgQueryLatency", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(1))); queryMetrics.increase("maxQueryLatency", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(2))); queryMetrics.increase("minQueryLatency", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(3))); } return queryMetrics; }
Example 5
Source File: DashboardController.java From kylin with Apache License 2.0 | 6 votes |
@RequestMapping(value = "/metric/job", method = RequestMethod.GET) @ResponseBody public MetricsResponse getJobMetrics(@RequestParam(value = "projectName", required = false) String projectName, @RequestParam(value = "cubeName", required = false) String cubeName, @RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime) { checkAuthorization(projectName); MetricsResponse jobMetrics = new MetricsResponse(); PrepareSqlRequest sqlRequest = dashboardService.getJobMetricsSQLRequest(startTime, endTime, projectName, cubeName); SQLResponse sqlResponse = queryService.doQueryWithCache(sqlRequest); if (!sqlResponse.getIsException()) { jobMetrics.increase("jobCount", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(0))); jobMetrics.increase("avgJobBuildTime", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(1))); jobMetrics.increase("maxJobBuildTime", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(2))); jobMetrics.increase("minJobBuildTime", dashboardService.getMetricValue(sqlResponse.getResults().get(0).get(3))); } return jobMetrics; }
Example 6
Source File: CubeService.java From kylin with Apache License 2.0 | 6 votes |
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 7
Source File: CubeService.java From Kylin with Apache License 2.0 | 6 votes |
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 8
Source File: DashboardService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public MetricsResponse getCubeMetrics(String projectName, String cubeName) { MetricsResponse cubeMetrics = new MetricsResponse(); Float totalCubeSize = 0f; long totalRecoadSize = 0; List<CubeInstance> cubeInstances = cubeService.listAllCubes(cubeName, projectName, null, true); Integer totalCube = cubeInstances.size(); if (projectName == null) { totalCube += getHybridManager().listHybridInstances().size(); } else { ProjectInstance project = getProjectManager().getProject(projectName); totalCube += project.getRealizationCount(RealizationType.HYBRID); } Float minCubeExpansion = Float.POSITIVE_INFINITY; Float maxCubeExpansion = Float.NEGATIVE_INFINITY; cubeMetrics.increase("totalCube", totalCube.floatValue()); for (CubeInstance cubeInstance : cubeInstances) { if (cubeInstance.getInputRecordSizeBytes() > 0) { totalCubeSize += cubeInstance.getSizeKB(); totalRecoadSize += cubeInstance.getInputRecordSizeBytes(); Float cubeExpansion = new Float(cubeInstance.getSizeKB()) * 1024 / cubeInstance.getInputRecordSizeBytes(); if (cubeExpansion > maxCubeExpansion) { maxCubeExpansion = cubeExpansion; } if (cubeExpansion < minCubeExpansion) { minCubeExpansion = cubeExpansion; } } } Float avgCubeExpansion = 0f; if (totalRecoadSize != 0) { avgCubeExpansion = totalCubeSize * 1024 / totalRecoadSize; } cubeMetrics.increase("avgCubeExpansion", avgCubeExpansion); cubeMetrics.increase("maxCubeExpansion", maxCubeExpansion == Float.NEGATIVE_INFINITY ? 0 : maxCubeExpansion); cubeMetrics.increase("minCubeExpansion", minCubeExpansion == Float.POSITIVE_INFINITY ? 0 : minCubeExpansion); return cubeMetrics; }
Example 9
Source File: DashboardService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public MetricsResponse transformChartData(SQLResponse sqlResponse) { if (!sqlResponse.getIsException()) { MetricsResponse metrics = new MetricsResponse(); List<List<String>> results = sqlResponse.getResults(); for (List<String> result : results) { String dimension = result.get(0); if (dimension != null && !dimension.isEmpty()) { String metric = result.get(1); metrics.increase(dimension, getMetricValue(metric)); } } return metrics; } return null; }
Example 10
Source File: DashboardService.java From kylin with Apache License 2.0 | 5 votes |
public MetricsResponse getCubeMetrics(String projectName, String cubeName) { MetricsResponse cubeMetrics = new MetricsResponse(); Float totalCubeSize = 0f; long totalRecoadSize = 0; List<CubeInstance> cubeInstances = cubeService.listAllCubes(cubeName, projectName, null, true); Integer totalCube = cubeInstances.size(); if (projectName == null) { totalCube += getHybridManager().listHybridInstances().size(); } else { ProjectInstance project = getProjectManager().getProject(projectName); totalCube += project.getRealizationCount(RealizationType.HYBRID); } Float minCubeExpansion = Float.POSITIVE_INFINITY; Float maxCubeExpansion = Float.NEGATIVE_INFINITY; cubeMetrics.increase("totalCube", totalCube.floatValue()); for (CubeInstance cubeInstance : cubeInstances) { if (cubeInstance.getInputRecordSizeBytes() > 0) { totalCubeSize += cubeInstance.getSizeKB(); totalRecoadSize += cubeInstance.getInputRecordSizeBytes(); Float cubeExpansion = new Float(cubeInstance.getSizeKB()) * 1024 / cubeInstance.getInputRecordSizeBytes(); if (cubeExpansion > maxCubeExpansion) { maxCubeExpansion = cubeExpansion; } if (cubeExpansion < minCubeExpansion) { minCubeExpansion = cubeExpansion; } } } Float avgCubeExpansion = 0f; if (totalRecoadSize != 0) { avgCubeExpansion = totalCubeSize * 1024 / totalRecoadSize; } cubeMetrics.increase("avgCubeExpansion", avgCubeExpansion); cubeMetrics.increase("maxCubeExpansion", maxCubeExpansion == Float.NEGATIVE_INFINITY ? 0 : maxCubeExpansion); cubeMetrics.increase("minCubeExpansion", minCubeExpansion == Float.POSITIVE_INFINITY ? 0 : minCubeExpansion); return cubeMetrics; }
Example 11
Source File: DashboardService.java From kylin with Apache License 2.0 | 5 votes |
public MetricsResponse transformChartData(SQLResponse sqlResponse) { if (!sqlResponse.getIsException()) { MetricsResponse metrics = new MetricsResponse(); List<List<String>> results = sqlResponse.getResults(); for (List<String> result : results) { String dimension = result.get(0); if (dimension != null && !dimension.isEmpty()) { String metric = result.get(1); metrics.increase(dimension, getMetricValue(metric)); } } return metrics; } return null; }