Search in sources :

Example 1 with MetricConfigManager

use of com.linkedin.thirdeye.datalayer.bao.MetricConfigManager in project pinot by linkedin.

the class ThirdEyeUtils method substituteMetricIdsForMetrics.

// TODO: Write parser instead of looking for occurrence of every metric
public static String substituteMetricIdsForMetrics(String metricExpression, String dataset) {
    MetricConfigManager metricConfigDAO = DAO_REGISTRY.getMetricConfigDAO();
    List<MetricConfigDTO> metricConfigs = metricConfigDAO.findByDataset(dataset);
    for (MetricConfigDTO metricConfig : metricConfigs) {
        if (metricConfig.isDerived()) {
            continue;
        }
        String metricName = metricConfig.getName();
        metricExpression = metricExpression.replaceAll(metricName, MetricConfigBean.DERIVED_METRIC_ID_PREFIX + metricConfig.getId());
    }
    return metricExpression;
}
Also used : MetricConfigDTO(com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO) MetricConfigManager(com.linkedin.thirdeye.datalayer.bao.MetricConfigManager)

Aggregations

MetricConfigManager (com.linkedin.thirdeye.datalayer.bao.MetricConfigManager)1 MetricConfigDTO (com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO)1