use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class ThirdEyeUtils method getMetricNameFromFunction.
public static String getMetricNameFromFunction(MetricFunction metricFunction) {
String metricId = metricFunction.getMetricName().replace(MetricConfigBean.DERIVED_METRIC_ID_PREFIX, "");
MetricConfigDTO metricConfig = DAO_REGISTRY.getMetricConfigDAO().findById(Long.valueOf(metricId));
return metricConfig.getName();
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class ThirdEyeUtils method getDerivedMetricExpression.
public static String getDerivedMetricExpression(String metricExpressionName, String dataset) throws ExecutionException {
String derivedMetricExpression = null;
MetricDataset metricDataset = new MetricDataset(metricExpressionName, dataset);
MetricConfigDTO metricConfig = CACHE_REGISTRY.getMetricConfigCache().get(metricDataset);
if (metricConfig.isDerived()) {
derivedMetricExpression = metricConfig.getDerivedMetricExpression();
} else {
derivedMetricExpression = MetricConfigBean.DERIVED_METRIC_ID_PREFIX + metricConfig.getId();
}
return derivedMetricExpression;
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class AbstractManagerTestBase method getTestMetricConfig.
protected MetricConfigDTO getTestMetricConfig(String collection, String metric, Long id) {
MetricConfigDTO metricConfigDTO = new MetricConfigDTO();
if (id != null) {
metricConfigDTO.setId(id);
}
metricConfigDTO.setDataset(collection);
metricConfigDTO.setDatatype(MetricType.LONG);
metricConfigDTO.setName(metric);
metricConfigDTO.setAlias(ThirdEyeUtils.constructMetricAlias(collection, metric));
return metricConfigDTO;
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class TestMetricConfigManager method testUpdate.
@Test(dependsOnMethods = { "testFindLike" })
public void testUpdate() {
MetricConfigDTO metricConfig = metricConfigDAO.findById(metricConfigId1);
Assert.assertNotNull(metricConfig);
Assert.assertFalse(metricConfig.isInverseMetric());
metricConfig.setInverseMetric(true);
metricConfigDAO.update(metricConfig);
metricConfig = metricConfigDAO.findById(metricConfigId1);
Assert.assertNotNull(metricConfig);
Assert.assertTrue(metricConfig.isInverseMetric());
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class AnomaliesResource method getExternalURL.
private String getExternalURL(MergedAnomalyResultDTO mergedAnomaly) {
String metric = mergedAnomaly.getMetric();
String dataset = mergedAnomaly.getCollection();
Long startTime = mergedAnomaly.getStartTime();
Long endTime = mergedAnomaly.getEndTime();
MetricConfigDTO metricConfigDTO = metricConfigDAO.findByMetricAndDataset(metric, dataset);
Map<String, String> context = new HashMap<>();
context.put(MetricConfigBean.URL_TEMPLATE_START_TIME, String.valueOf(startTime));
context.put(MetricConfigBean.URL_TEMPLATE_END_TIME, String.valueOf(endTime));
StrSubstitutor strSubstitutor = new StrSubstitutor(context);
Map<String, String> urlTemplates = metricConfigDTO.getExtSourceLinkInfo();
if (urlTemplates == null) {
return "";
}
for (Map.Entry<String, String> entry : urlTemplates.entrySet()) {
String sourceName = entry.getKey();
String urlTemplate = entry.getValue();
String extSourceUrl = strSubstitutor.replace(urlTemplate);
urlTemplates.put(sourceName, extSourceUrl);
}
return new JSONObject(urlTemplates).toString();
}
Aggregations