Search in sources :

Example 1 with DiagnosticsCollection

use of com.sequenceiq.common.api.diagnostics.DiagnosticsCollection in project cloudbreak by hortonworks.

the class FlowLogsToListDiagnosticsCollectionResponseConverter method convert.

public ListDiagnosticsCollectionResponse convert(List<FlowLog> flowLogs) {
    ListDiagnosticsCollectionResponse response = new ListDiagnosticsCollectionResponse();
    if (!flowLogs.isEmpty()) {
        List<DiagnosticsCollection> collections = flowLogs.stream().map(flowLog -> {
            DiagnosticsCollection collection = new DiagnosticsCollection();
            collection.setFlowId(flowLog.getFlowId());
            collection.setCreated(flowLog.getCreated());
            collection.setProperties(flowPayloadToDiagnosticDetailsConverter.convert(flowLog.getPayload()));
            collection.setStatus(calculateStatus(flowLog));
            collection.setCurrentFlowStatus(flowLog.getCurrentState());
            collection.setProgressPercentage(calculateProgressPercentage(flowLog));
            return collection;
        }).collect(Collectors.toList());
        response.setCollections(collections);
    }
    return response;
}
Also used : FlowLog(com.sequenceiq.flow.domain.FlowLog) DiagnosticsCollectionStatus(com.sequenceiq.common.api.diagnostics.DiagnosticsCollectionStatus) DIAGNOSTICS_COLLECTION_FINISHED_STATE(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FINISHED_STATE) DiagnosticsCollectionFlowConfig(com.sequenceiq.cloudbreak.core.flow2.diagnostics.config.DiagnosticsCollectionFlowConfig) Collectors(java.util.stream.Collectors) FlowPayloadToDiagnosticDetailsConverter(com.sequenceiq.cloudbreak.telemetry.converter.FlowPayloadToDiagnosticDetailsConverter) Inject(javax.inject.Inject) ListDiagnosticsCollectionResponse(com.sequenceiq.common.api.diagnostics.ListDiagnosticsCollectionResponse) HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT(com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionStateSelectors.HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT) List(java.util.List) Component(org.springframework.stereotype.Component) FlowProgressHolder(com.sequenceiq.flow.core.config.FlowProgressHolder) DIAGNOSTICS_COLLECTION_FAILED_STATE(com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FAILED_STATE) DiagnosticsCollection(com.sequenceiq.common.api.diagnostics.DiagnosticsCollection) StateStatus(com.sequenceiq.flow.domain.StateStatus) ListDiagnosticsCollectionResponse(com.sequenceiq.common.api.diagnostics.ListDiagnosticsCollectionResponse) DiagnosticsCollection(com.sequenceiq.common.api.diagnostics.DiagnosticsCollection)

Example 2 with DiagnosticsCollection

use of com.sequenceiq.common.api.diagnostics.DiagnosticsCollection in project cloudbreak by hortonworks.

the class FlowLogsToListDiagnosticsCollectionResponseConverter method convert.

public ListDiagnosticsCollectionResponse convert(List<FlowLog> flowLogs) {
    ListDiagnosticsCollectionResponse response = new ListDiagnosticsCollectionResponse();
    if (!flowLogs.isEmpty()) {
        List<DiagnosticsCollection> collections = flowLogs.stream().map(flowLog -> {
            DiagnosticsCollection collection = new DiagnosticsCollection();
            collection.setFlowId(flowLog.getFlowId());
            collection.setCreated(flowLog.getCreated());
            collection.setProperties(flowPayloadToDiagnosticDetailsConverter.convert(flowLog.getPayload()));
            collection.setStatus(calculateStatus(flowLog));
            collection.setCurrentFlowStatus(flowLog.getCurrentState());
            collection.setProgressPercentage(calculateProgressPercentage(flowLog));
            return collection;
        }).collect(Collectors.toList());
        response.setCollections(collections);
    }
    return response;
}
Also used : FlowLog(com.sequenceiq.flow.domain.FlowLog) DiagnosticsCollectionFlowConfig(com.sequenceiq.freeipa.flow.freeipa.diagnostics.config.DiagnosticsCollectionFlowConfig) HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT(com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionStateSelectors.HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT) DiagnosticsCollectionStatus(com.sequenceiq.common.api.diagnostics.DiagnosticsCollectionStatus) DIAGNOSTICS_COLLECTION_FINISHED_STATE(com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FINISHED_STATE) Collectors(java.util.stream.Collectors) FlowPayloadToDiagnosticDetailsConverter(com.sequenceiq.cloudbreak.telemetry.converter.FlowPayloadToDiagnosticDetailsConverter) Inject(javax.inject.Inject) ListDiagnosticsCollectionResponse(com.sequenceiq.common.api.diagnostics.ListDiagnosticsCollectionResponse) DIAGNOSTICS_COLLECTION_FAILED_STATE(com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FAILED_STATE) List(java.util.List) Component(org.springframework.stereotype.Component) FlowProgressHolder(com.sequenceiq.flow.core.config.FlowProgressHolder) DiagnosticsCollection(com.sequenceiq.common.api.diagnostics.DiagnosticsCollection) StateStatus(com.sequenceiq.flow.domain.StateStatus) ListDiagnosticsCollectionResponse(com.sequenceiq.common.api.diagnostics.ListDiagnosticsCollectionResponse) DiagnosticsCollection(com.sequenceiq.common.api.diagnostics.DiagnosticsCollection)

Aggregations

FlowPayloadToDiagnosticDetailsConverter (com.sequenceiq.cloudbreak.telemetry.converter.FlowPayloadToDiagnosticDetailsConverter)2 DiagnosticsCollection (com.sequenceiq.common.api.diagnostics.DiagnosticsCollection)2 DiagnosticsCollectionStatus (com.sequenceiq.common.api.diagnostics.DiagnosticsCollectionStatus)2 ListDiagnosticsCollectionResponse (com.sequenceiq.common.api.diagnostics.ListDiagnosticsCollectionResponse)2 FlowProgressHolder (com.sequenceiq.flow.core.config.FlowProgressHolder)2 FlowLog (com.sequenceiq.flow.domain.FlowLog)2 StateStatus (com.sequenceiq.flow.domain.StateStatus)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Inject (javax.inject.Inject)2 Component (org.springframework.stereotype.Component)2 DIAGNOSTICS_COLLECTION_FAILED_STATE (com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FAILED_STATE)1 DIAGNOSTICS_COLLECTION_FINISHED_STATE (com.sequenceiq.cloudbreak.core.flow2.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FINISHED_STATE)1 DiagnosticsCollectionFlowConfig (com.sequenceiq.cloudbreak.core.flow2.diagnostics.config.DiagnosticsCollectionFlowConfig)1 HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT (com.sequenceiq.cloudbreak.core.flow2.diagnostics.event.DiagnosticsCollectionStateSelectors.HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT)1 DIAGNOSTICS_COLLECTION_FAILED_STATE (com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FAILED_STATE)1 DIAGNOSTICS_COLLECTION_FINISHED_STATE (com.sequenceiq.freeipa.flow.freeipa.diagnostics.DiagnosticsCollectionsState.DIAGNOSTICS_COLLECTION_FINISHED_STATE)1 DiagnosticsCollectionFlowConfig (com.sequenceiq.freeipa.flow.freeipa.diagnostics.config.DiagnosticsCollectionFlowConfig)1 HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT (com.sequenceiq.freeipa.flow.freeipa.diagnostics.event.DiagnosticsCollectionStateSelectors.HANDLED_FAILED_DIAGNOSTICS_COLLECTION_EVENT)1