use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class HistoricalAnomalyEventProvider method getAnomalyEvent.
private EventDTO getAnomalyEvent(MergedAnomalyResultDTO anomalyResultDTO) {
EventDTO eventDTO = new EventDTO();
eventDTO.setEventType(EventType.HISTORICAL_ANOMALY.name());
eventDTO.setStartTime(anomalyResultDTO.getStartTime());
eventDTO.setEndTime(anomalyResultDTO.getEndTime());
eventDTO.setMetric(anomalyResultDTO.getMetric());
eventDTO.setId(anomalyResultDTO.getId());
Map<String, List<String>> dimensionValuesMap = new HashMap<>();
if (anomalyResultDTO.getDimensions() != null && anomalyResultDTO.getDimensions().size() > 0) {
for (String dimension : anomalyResultDTO.getDimensions().keySet()) {
dimensionValuesMap.putIfAbsent(dimension, new ArrayList<>());
dimensionValuesMap.get(dimension).add(anomalyResultDTO.getDimensions().get(dimension));
}
}
eventDTO.setTargetDimensionMap(dimensionValuesMap);
return eventDTO;
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class HistoricalAnomalyEventProvider method getEvents.
@Override
public List<EventDTO> getEvents(EventFilter eventFilter) {
List<MergedAnomalyResultDTO> mergedAnomalies;
List<EventDTO> events = new ArrayList<>();
if (eventFilter.getMetricName() == null) {
mergedAnomalies = mergedAnomalyDAO.findByTime(eventFilter.getStartTime(), eventFilter.getStartTime());
} else {
mergedAnomalies = mergedAnomalyDAO.findByMetricTime(eventFilter.getMetricName(), eventFilter.getStartTime(), eventFilter.getStartTime(), false);
}
if (mergedAnomalies != null) {
for (MergedAnomalyResultDTO mergedAnomalyResultDTO : mergedAnomalies) {
events.add(getAnomalyEvent(mergedAnomalyResultDTO));
}
}
return events;
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class DefaultHolidayEventProvider method getEvents.
@Override
public List<EventDTO> getEvents(EventFilter eventFilter) {
List<EventDTO> allEventsBetweenTimeRange = eventDAO.findEventsBetweenTimeRange(EventType.HOLIDAY.name(), eventFilter.getStartTime(), eventFilter.getEndTime());
if (eventFilter.getTargetDimensionMap() == null || eventFilter.getTargetDimensionMap().size() == 0) {
return allEventsBetweenTimeRange;
}
List<EventDTO> qualifiedDeploymentEvents = new ArrayList<>();
for (Map.Entry<String, List<String>> dimensionValues : eventFilter.getTargetDimensionMap().entrySet()) {
String dimension = dimensionValues.getKey();
List<String> targetValues = dimensionValues.getValue();
if (dimension.startsWith("country")) {
for (EventDTO eventDTO : allEventsBetweenTimeRange) {
for (String target : targetValues) {
if (eventDTO.getTargetDimensionMap().get(COUNTRY_CODE).contains(target)) {
if (!qualifiedDeploymentEvents.contains(eventDTO)) {
qualifiedDeploymentEvents.add(eventDTO);
}
}
}
}
}
}
return qualifiedDeploymentEvents;
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class EventManagerImpl method findEventsBetweenTimeRange.
public List<EventDTO> findEventsBetweenTimeRange(String eventType, long start, long end) {
Predicate predicate = Predicate.AND(Predicate.EQ("eventType", eventType), Predicate.GT("endTime", start), Predicate.LT("startTime", end));
List<EventBean> list = genericPojoDao.get(predicate, EventBean.class);
List<EventDTO> results = new ArrayList<>();
for (EventBean event : list) {
EventDTO eventDTO = MODEL_MAPPER.map(event, EventDTO.class);
results.add(eventDTO);
}
return results;
}
use of com.linkedin.thirdeye.datalayer.dto.EventDTO in project pinot by linkedin.
the class EventManagerImpl method findEventsBetweenTimeRangeByName.
public List<EventDTO> findEventsBetweenTimeRangeByName(String eventType, String name, long start, long end) {
Predicate predicate = Predicate.AND(Predicate.EQ("eventType", eventType), Predicate.EQ("name", name), Predicate.GT("endTime", start), Predicate.LT("startTime", end));
List<EventBean> list = genericPojoDao.get(predicate, EventBean.class);
List<EventDTO> results = new ArrayList<>();
for (EventBean event : list) {
EventDTO eventDTO = MODEL_MAPPER.map(event, EventDTO.class);
results.add(eventDTO);
}
return results;
}
Aggregations