Search in sources :

Example 11 with CmDiagnosticsCollectionEvent

use of com.sequenceiq.cloudbreak.core.flow2.cmdiagnostics.event.CmDiagnosticsCollectionEvent in project cloudbreak by hortonworks.

the class DiagnosticsService method startCmDiagnostics.

public FlowIdentifier startCmDiagnostics(BaseCmDiagnosticsCollectionRequest request, String stackCrn, String userCrn) {
    Stack stack = stackService.getByCrn(stackCrn);
    MDCBuilder.buildMdcContext(stack);
    LOGGER.debug("Starting CM based diagnostics collection for Stack. Crn: '{}'", stack.getResourceCrn());
    Telemetry telemetry = componentConfigProviderService.getTelemetry(stack.getId());
    diagnosticsCollectionValidator.validate(request, stack, telemetry);
    CmDiagnosticsParameters parameters = cmDiagnosticsDataToParameterConverter.convert(request, telemetry, stack.getName(), stack.getRegion());
    CmDiagnosticsCollectionEvent diagnosticsCollectionEvent = CmDiagnosticsCollectionEvent.builder().withAccepted(new Promise<>()).withResourceId(stack.getId()).withResourceCrn(stack.getResourceCrn()).withSelector(CmDiagnosticsCollectionStateSelectors.START_CM_DIAGNOSTICS_INIT_EVENT.selector()).withParameters(parameters).build();
    return reactorNotifier.notify(diagnosticsCollectionEvent, getFlowHeaders(userCrn));
}
Also used : Promise(reactor.rx.Promise) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) CmDiagnosticsParameters(com.sequenceiq.common.model.diagnostics.CmDiagnosticsParameters) CmDiagnosticsCollectionEvent(com.sequenceiq.cloudbreak.core.flow2.cmdiagnostics.event.CmDiagnosticsCollectionEvent) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

CmDiagnosticsCollectionEvent (com.sequenceiq.cloudbreak.core.flow2.cmdiagnostics.event.CmDiagnosticsCollectionEvent)11 CmDiagnosticsParameters (com.sequenceiq.common.model.diagnostics.CmDiagnosticsParameters)6 CommonContext (com.sequenceiq.flow.core.CommonContext)6 Map (java.util.Map)6 Bean (org.springframework.context.annotation.Bean)6 CmDiagnosticsCollectionFailureEvent (com.sequenceiq.cloudbreak.core.flow2.cmdiagnostics.event.CmDiagnosticsCollectionFailureEvent)5 Event (reactor.bus.Event)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)1 Promise (reactor.rx.Promise)1