use of com.sequenceiq.common.model.diagnostics.CmDiagnosticsParameters in project cloudbreak by hortonworks.
the class CmDiagnosticsUploadHandler method accept.
@Override
public void accept(Event<CmDiagnosticsCollectionEvent> event) {
CmDiagnosticsCollectionEvent data = event.getData();
Long resourceId = data.getResourceId();
String resourceCrn = data.getResourceCrn();
CmDiagnosticsParameters parameters = data.getParameters();
Map<String, Object> parameterMap = parameters.toMap();
try {
LOGGER.debug("CM based diagnostics upload started. resourceCrn: '{}', parameters: '{}'", resourceCrn, parameterMap);
if (DiagnosticsDestination.SUPPORT.equals(parameters.getDestination())) {
LOGGER.debug("CM based diagnostics uses SUPPORT destination, no support specific upload step yet.");
} else {
cmDiagnosticsFlowService.upload(resourceId, parameterMap, new HashSet<>());
}
CmDiagnosticsCollectionEvent diagnosticsCollectionEvent = CmDiagnosticsCollectionEvent.builder().withResourceCrn(resourceCrn).withResourceId(resourceId).withSelector(START_CM_DIAGNOSTICS_CLEANUP_EVENT.selector()).withParameters(parameters).build();
eventSender().sendEvent(diagnosticsCollectionEvent, event.getHeaders());
} catch (Exception e) {
LOGGER.debug("CM based diagnostics upload failed. resourceCrn: '{}', parameters: '{}'.", resourceCrn, parameterMap, e);
CmDiagnosticsCollectionFailureEvent failureEvent = new CmDiagnosticsCollectionFailureEvent(resourceId, e, resourceCrn, parameters);
eventBus.notify(failureEvent.selector(), new Event<>(event.getHeaders(), failureEvent));
}
}
use of com.sequenceiq.common.model.diagnostics.CmDiagnosticsParameters 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));
}
Aggregations