use of com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO in project pinot by linkedin.
the class DashboardConfigManagerImpl method findByName.
@Override
public DashboardConfigDTO findByName(String name) {
Predicate predicate = Predicate.EQ("name", name);
List<DashboardConfigBean> list = genericPojoDao.get(predicate, DashboardConfigBean.class);
DashboardConfigDTO result = null;
if (CollectionUtils.isNotEmpty(list)) {
result = MODEL_MAPPER.map(list.get(0), DashboardConfigDTO.class);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO in project pinot by linkedin.
the class DashboardConfigManagerImpl method findByDataset.
@Override
public List<DashboardConfigDTO> findByDataset(String dataset) {
Predicate predicate = Predicate.EQ("dataset", dataset);
List<DashboardConfigBean> list = genericPojoDao.get(predicate, DashboardConfigBean.class);
List<DashboardConfigDTO> result = new ArrayList<>();
for (DashboardConfigBean abstractBean : list) {
DashboardConfigDTO dto = MODEL_MAPPER.map(abstractBean, DashboardConfigDTO.class);
result.add(dto);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO in project pinot by linkedin.
the class DashboardConfigManagerImpl method findActiveByDataset.
@Override
public List<DashboardConfigDTO> findActiveByDataset(String dataset) {
Predicate datasetPredicate = Predicate.EQ("dataset", dataset);
Predicate activePredicate = Predicate.EQ("active", true);
List<DashboardConfigBean> list = genericPojoDao.get(Predicate.AND(datasetPredicate, activePredicate), DashboardConfigBean.class);
List<DashboardConfigDTO> result = new ArrayList<>();
for (DashboardConfigBean abstractBean : list) {
DashboardConfigDTO dto = MODEL_MAPPER.map(abstractBean, DashboardConfigDTO.class);
result.add(dto);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO in project pinot by linkedin.
the class ConfigGenerator method generateDefaultDashboardConfig.
public static DashboardConfigDTO generateDefaultDashboardConfig(String dataset, List<Long> metricIds) {
DashboardConfigDTO dashboardConfigDTO = new DashboardConfigDTO();
String dashboardName = DashboardConfigBean.DEFAULT_DASHBOARD_PREFIX + dataset;
dashboardConfigDTO.setName(dashboardName);
dashboardConfigDTO.setDataset(dataset);
dashboardConfigDTO.setMetricIds(metricIds);
return dashboardConfigDTO;
}
use of com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO in project pinot by linkedin.
the class AutoLoadPinotMetricsService method checkMetricChanges.
private void checkMetricChanges(String dataset, DatasetConfigDTO datasetConfig, Schema schema) {
LOG.info("Checking for metric changes in {}", dataset);
List<MetricFieldSpec> schemaMetricSpecs = schema.getMetricFieldSpecs();
List<MetricConfigDTO> datasetMetricConfigs = DAO_REGISTRY.getMetricConfigDAO().findByDataset(dataset);
List<String> datasetMetricNames = new ArrayList<>();
for (MetricConfigDTO metricConfig : datasetMetricConfigs) {
datasetMetricNames.add(metricConfig.getName());
}
List<Long> metricsToAdd = new ArrayList<>();
for (MetricFieldSpec metricSpec : schemaMetricSpecs) {
// metrics which are new in pinot schema, create them
String metricName = metricSpec.getName();
if (!datasetMetricNames.contains(metricName)) {
MetricConfigDTO metricConfigDTO = ConfigGenerator.generateMetricConfig(metricSpec, dataset);
LOG.info("Creating metric {} for {}", metricName, dataset);
metricsToAdd.add(DAO_REGISTRY.getMetricConfigDAO().save(metricConfigDTO));
}
}
// add new metricIds to default dashboard
if (CollectionUtils.isNotEmpty(metricsToAdd)) {
LOG.info("Metrics to add {}", metricsToAdd);
String dashboardName = ThirdEyeUtils.getDefaultDashboardName(dataset);
DashboardConfigDTO dashboardConfig = DAO_REGISTRY.getDashboardConfigDAO().findByName(dashboardName);
List<Long> metricIds = dashboardConfig.getMetricIds();
metricIds.addAll(metricsToAdd);
DAO_REGISTRY.getDashboardConfigDAO().update(dashboardConfig);
}
// TODO: write a tool, which given a metric id, erases all traces of that metric from the database
// This will include:
// 1) delete the metric from metricConfigs
// 2) remove any derived metrics which use the deleted metric
// 3) remove the metric, and derived metrics from all dashboards
// 4) remove any anomaly functions associated with the metric
// 5) remove any alerts associated with these anomaly functions
}
Aggregations