use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class TimeSeriesResource method getTimeseriesCompareData.
@GET
@Path("/compare/{metricId}/{currentStart}/{currentEnd}/{baselineStart}/{baselineEnd}")
public TimeSeriesCompareMetricView getTimeseriesCompareData(@PathParam("metricId") long metricId, @PathParam("currentStart") long currentStart, @PathParam("currentEnd") long currentEnd, @PathParam("baselineStart") long baselineStart, @PathParam("baselineEnd") long baselineEnd, @QueryParam("dimension") String dimension, @QueryParam("filters") String filters, @QueryParam("granularity") String granularity, // Auto Resize tries to limit the number of data points to 20
@DefaultValue("false") @QueryParam("limitDataPointNum") boolean limitDataPointNum, @DefaultValue("20") @QueryParam("dataPointNum") int dataPointNum) {
try {
if (Strings.isNullOrEmpty(dimension)) {
dimension = ALL;
}
MetricConfigDTO metricConfigDTO = metricConfigDAO.findById(metricId);
String dataset = metricConfigDTO.getDataset();
long maxDataTime = datasetMaxDataTimeCache.get(dataset);
if (currentEnd > maxDataTime) {
long delta = currentEnd - maxDataTime;
currentEnd = currentEnd - delta;
baselineEnd = baselineStart + (currentEnd - currentStart);
}
long analysisDuration = currentEnd - currentStart;
if (baselineEnd - baselineStart != analysisDuration) {
baselineEnd = baselineStart + analysisDuration;
}
if (baselineEnd > currentEnd) {
LOG.warn("Baseline time ranges are out of order, resetting as per current time ranges.");
baselineEnd = currentEnd - TimeUnit.DAYS.toMillis(7);
baselineStart = currentStart - TimeUnit.DAYS.toMillis(7);
}
if (StringUtils.isEmpty(granularity)) {
granularity = "DAYS";
}
if (limitDataPointNum) {
granularity = Utils.resizeTimeGranularity(analysisDuration, granularity, dataPointNum);
}
if (dimension.equalsIgnoreCase(ALL)) {
return getTabularData(metricId, currentStart, currentEnd, baselineStart, baselineEnd, filters, granularity);
} else {
// build contributor view request
return getContributorDataForDimension(metricId, currentStart, currentEnd, baselineStart, baselineEnd, dimension, filters, granularity);
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new WebApplicationException(e);
}
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class MetricConfigManagerImpl method findWhereNameLike.
@Override
public List<MetricConfigDTO> findWhereNameLike(String name) {
Map<String, Object> parameterMap = new HashMap<>();
parameterMap.put("name", name);
List<MetricConfigBean> list = genericPojoDao.executeParameterizedSQL(FIND_BY_NAME_LIKE, parameterMap, MetricConfigBean.class);
List<MetricConfigDTO> result = new ArrayList<>();
for (MetricConfigBean bean : list) {
result.add(MODEL_MAPPER.map(bean, MetricConfigDTO.class));
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class MetricConfigManagerImpl method findActiveByDataset.
@Override
public List<MetricConfigDTO> findActiveByDataset(String dataset) {
Predicate datasetPredicate = Predicate.EQ("dataset", dataset);
Predicate activePredicate = Predicate.EQ("active", true);
List<MetricConfigBean> list = genericPojoDao.get(Predicate.AND(datasetPredicate, activePredicate), MetricConfigBean.class);
List<MetricConfigDTO> result = new ArrayList<>();
for (MetricConfigBean abstractBean : list) {
MetricConfigDTO dto = MODEL_MAPPER.map(abstractBean, MetricConfigDTO.class);
result.add(dto);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.MetricConfigDTO in project pinot by linkedin.
the class MetricConfigManagerImpl method findByDataset.
@Override
public List<MetricConfigDTO> findByDataset(String dataset) {
Predicate predicate = Predicate.EQ("dataset", dataset);
List<MetricConfigBean> list = genericPojoDao.get(predicate, MetricConfigBean.class);
List<MetricConfigDTO> result = new ArrayList<>();
for (MetricConfigBean abstractBean : list) {
MetricConfigDTO dto = MODEL_MAPPER.map(abstractBean, MetricConfigDTO.class);
result.add(dto);
}
return result;
}
Aggregations