use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.
the class IngraphMetricConfigResource method updateMetricConfig.
@GET
@Path("/update")
public String updateMetricConfig(@NotNull @QueryParam("id") long ingraphMetricConfigId, @QueryParam("rrdName") String rrdName, @QueryParam("metricName") String metricName, @QueryParam("dashboardName") String dashboardName, @QueryParam("metricDataType") String metricDataType, @QueryParam("metricSourceType") String metricSourceType, @QueryParam("container") String container) {
try {
IngraphMetricConfigDTO ingraphMetricConfigDTO = ingraphMetricConfigDao.findById(ingraphMetricConfigId);
ingraphMetricConfigDTO.setRrdName(rrdName);
ingraphMetricConfigDTO.setMetricName(metricName);
ingraphMetricConfigDTO.setDashboardName(dashboardName);
ingraphMetricConfigDTO.setContainer(container);
ingraphMetricConfigDTO.setMetricDataType(metricDataType);
ingraphMetricConfigDTO.setMetricSourceType(metricSourceType);
int numRowsUpdated = ingraphMetricConfigDao.update(ingraphMetricConfigDTO);
if (numRowsUpdated == 1) {
return JsonResponseUtil.buildResponseJSON(ingraphMetricConfigDTO).toString();
} else {
return JsonResponseUtil.buildErrorResponseJSON("Failed to update metric id:" + ingraphMetricConfigId).toString();
}
} catch (Exception e) {
return JsonResponseUtil.buildErrorResponseJSON("Failed to update metric id:" + ingraphMetricConfigId + ". Exception:" + e.getMessage()).toString();
}
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.
the class IngraphMetricConfigManagerImpl method findByDashboard.
@Override
public List<IngraphMetricConfigDTO> findByDashboard(String dashboardName) {
Predicate predicate = Predicate.EQ("dashboardName", dashboardName);
List<IngraphMetricConfigBean> list = genericPojoDao.get(predicate, IngraphMetricConfigBean.class);
List<IngraphMetricConfigDTO> result = new ArrayList<>();
for (IngraphMetricConfigBean abstractBean : list) {
IngraphMetricConfigDTO dto = MODEL_MAPPER.map(abstractBean, IngraphMetricConfigDTO.class);
result.add(dto);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.
the class TestIngraphMetricConfigManager method testCreateIngraphMetric.
@Test
public void testCreateIngraphMetric() {
IngraphMetricConfigDTO ingraphMetricConfigDTO1 = getTestIngraphMetricConfig(rrd1, metric1, dashboard1);
ingraphMetricConfigId1 = ingraphMetricConfigDAO.save(ingraphMetricConfigDTO1);
Assert.assertNotNull(ingraphMetricConfigId1);
IngraphMetricConfigDTO ingraphMetricConfigDTO2 = getTestIngraphMetricConfig(rrd2, metric2, dashboard2);
ingraphMetricConfigId2 = ingraphMetricConfigDAO.save(ingraphMetricConfigDTO2);
Assert.assertNotNull(ingraphMetricConfigId2);
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.
the class IngraphMetricConfigManagerImpl method findByDashboardAndMetricName.
@Override
public IngraphMetricConfigDTO findByDashboardAndMetricName(String dashboardName, String metricName) {
Predicate dashboardPredicate = Predicate.EQ("dashboardName", dashboardName);
Predicate metricPredicate = Predicate.EQ("metricName", metricName);
List<IngraphMetricConfigBean> list = genericPojoDao.get(Predicate.AND(dashboardPredicate, metricPredicate), IngraphMetricConfigBean.class);
IngraphMetricConfigDTO result = null;
if (CollectionUtils.isNotEmpty(list)) {
result = MODEL_MAPPER.map(list.get(0), IngraphMetricConfigDTO.class);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphMetricConfigDTO in project pinot by linkedin.
the class IngraphMetricConfigManagerImpl method findByRrdName.
@Override
public IngraphMetricConfigDTO findByRrdName(String rrdName) {
Predicate dashboardPredicate = Predicate.EQ("rrdName", rrdName);
List<IngraphMetricConfigBean> list = genericPojoDao.get(dashboardPredicate, IngraphMetricConfigBean.class);
IngraphMetricConfigDTO result = null;
if (CollectionUtils.isNotEmpty(list)) {
result = MODEL_MAPPER.map(list.get(0), IngraphMetricConfigDTO.class);
}
return result;
}
Aggregations