Search in sources :

Example 1 with CorrelatedEventsGrouper

use of com.hortonworks.streamline.streams.common.event.correlation.CorrelatedEventsGrouper in project streamline by hortonworks.

the class TopologyTestRunResource method getRootEventsOfTestRunTopologyHistory.

@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/root")
public Response getRootEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
    File eventLogFile = getEventLogFile(topologyId, historyId);
    List<EventInformation> events = eventLogFileReader.loadEventLogFile(eventLogFile);
    List<com.hortonworks.registries.common.QueryParam> qps = com.hortonworks.registries.common.QueryParam.params(TopologySource.TOPOLOGYID, topologyId.toString(), TopologySource.VERSIONID, catalogService.getCurrentVersionId(topologyId).toString());
    Set<String> sourceNames = catalogService.listTopologySources(qps).stream().map(TopologyComponent::getName).collect(Collectors.toSet());
    return WSUtils.respondEntities(new CorrelatedEventsGrouper(events).groupByRelatedSourceEvents(sourceNames), OK);
}
Also used : CorrelatedEventsGrouper(com.hortonworks.streamline.streams.common.event.correlation.CorrelatedEventsGrouper) EventInformation(com.hortonworks.streamline.streams.common.event.EventInformation) QueryParam(javax.ws.rs.QueryParam) File(java.io.File) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 2 with CorrelatedEventsGrouper

use of com.hortonworks.streamline.streams.common.event.correlation.CorrelatedEventsGrouper in project streamline by hortonworks.

the class TopologyTestRunResource method getGroupedCorrelatedEventsOfTestRunTopologyHistory.

@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/correlated/{rootEventId}")
public Response getGroupedCorrelatedEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @PathParam("rootEventId") String rootEventId, @Context SecurityContext securityContext) throws Exception {
    SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
    File eventLogFile = getEventLogFile(topologyId, historyId);
    List<EventInformation> events = eventLogFileReader.loadEventLogFile(eventLogFile);
    GroupedCorrelationEvents groupedEvents = new CorrelatedEventsGrouper(events).groupByComponent(rootEventId);
    if (!groupedEvents.getAllEvents().containsKey(rootEventId)) {
        throw BadRequestException.message("Can't find provided root event " + rootEventId + " from events.");
    }
    return WSUtils.respondEntity(groupedEvents, OK);
}
Also used : CorrelatedEventsGrouper(com.hortonworks.streamline.streams.common.event.correlation.CorrelatedEventsGrouper) EventInformation(com.hortonworks.streamline.streams.common.event.EventInformation) GroupedCorrelationEvents(com.hortonworks.streamline.streams.common.event.correlation.GroupedCorrelationEvents) File(java.io.File) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

EventInformation (com.hortonworks.streamline.streams.common.event.EventInformation)2 CorrelatedEventsGrouper (com.hortonworks.streamline.streams.common.event.correlation.CorrelatedEventsGrouper)2 File (java.io.File)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 GroupedCorrelationEvents (com.hortonworks.streamline.streams.common.event.correlation.GroupedCorrelationEvents)1 QueryParam (javax.ws.rs.QueryParam)1