Search in sources :

Example 11 with DashboardConfigDTO

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;
}
Also used : DashboardConfigBean(com.linkedin.thirdeye.datalayer.pojo.DashboardConfigBean) DashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 12 with DashboardConfigDTO

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;
}
Also used : DashboardConfigBean(com.linkedin.thirdeye.datalayer.pojo.DashboardConfigBean) ArrayList(java.util.ArrayList) DashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 13 with DashboardConfigDTO

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;
}
Also used : DashboardConfigBean(com.linkedin.thirdeye.datalayer.pojo.DashboardConfigBean) ArrayList(java.util.ArrayList) DashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 14 with DashboardConfigDTO

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;
}
Also used : DashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO)

Example 15 with 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
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) ArrayList(java.util.ArrayList) MetricFieldSpec(com.linkedin.pinot.common.data.MetricFieldSpec) DashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO)

Aggregations

DashboardConfigDTO (com.linkedin.thirdeye.datalayer.dto.DashboardConfigDTO)18 ArrayList (java.util.ArrayList)9 MetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO)8 MetricFieldSpec (com.linkedin.pinot.common.data.MetricFieldSpec)4 DatasetConfigDTO (com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO)4 DashboardConfigBean (com.linkedin.thirdeye.datalayer.pojo.DashboardConfigBean)4 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)3 IOException (java.io.IOException)2 Test (org.testng.annotations.Test)2 CacheBuilder (com.google.common.cache.CacheBuilder)1 LoadingCache (com.google.common.cache.LoadingCache)1 RemovalListener (com.google.common.cache.RemovalListener)1 RemovalNotification (com.google.common.cache.RemovalNotification)1 ResultSetGroup (com.linkedin.pinot.client.ResultSetGroup)1 DimensionFieldSpec (com.linkedin.pinot.common.data.DimensionFieldSpec)1 FieldSpec (com.linkedin.pinot.common.data.FieldSpec)1 TimeGranularitySpec (com.linkedin.pinot.common.data.TimeGranularitySpec)1 MetricExpression (com.linkedin.thirdeye.client.MetricExpression)1