use of com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest in project cloudbreak by hortonworks.
the class NodeStatusCheckerJob method processCmMetricsReport.
private void processCmMetricsReport(Optional<RPCResponse<NodeStatusProto.CmMetricsReport>> cmMetricsReport, Stack stack, String accountId, boolean process) {
if (cmMetricsReport.isPresent()) {
LOGGER.debug("CM metrics report: {}", cmMetricsReport.get().getFirstTextMessage());
if (isCmMetricsReportNotEmpty(cmMetricsReport.get())) {
if (process) {
DatabusRequestContext context = createDatabusRequestContext(accountId, stack, CdpNodeStatusType.CM_METRICS_REPORT);
DatabusRequest recordRequest = createDatabusRecordRequest(cmMetricsReport.get().getResult(), context);
metricsDataBusRecordProcessor.processRecord(recordRequest);
}
}
} else {
LOGGER.debug("Node status report does not contain CM metrics report for {}", stack.getName());
}
}
use of com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest in project cloudbreak by hortonworks.
the class NodeStatusCheckerJob method processNodeStatusReport.
private <T extends GeneratedMessageV3> void processNodeStatusReport(Optional<RPCResponse<NodeStatusProto.NodeStatusReport>> nodeStatusReport, Function<NodeStatusProto.NodeStatus, T> nodeStatusDetails, Stack stack, String type, String accountId, boolean processAsMetrics) {
if (nodeStatusReport.isPresent()) {
LOGGER.debug("{} report: {}", type, nodeStatusReport.get().getFirstTextMessage());
if (isStatusReportNotEmpty(nodeStatusReport.get())) {
DatabusRequestContext context = createDatabusRequestContext(accountId, stack, CdpNodeStatusType.SYSTEM_METRICS);
for (NodeStatusProto.NodeStatus nodeStatus : nodeStatusReport.get().getResult().getNodesList()) {
T report = nodeStatusDetails.apply(nodeStatus);
LOGGER.debug("{} details report: \n{}{}", type, report, getStatusDetailsStr(nodeStatus.getStatusDetails()));
if (processAsMetrics) {
DatabusRequest recordRequest = createDatabusRecordRequest(report, context);
metricsDataBusRecordProcessor.processRecord(recordRequest);
}
}
}
} else {
LOGGER.debug("Node status report does not contain {} report for {}", type, stack.getName());
}
}
use of com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest in project cloudbreak by hortonworks.
the class FreeipaChecker method processSystemMetrics.
private void processSystemMetrics(RPCResponse<NodeStatusProto.NodeStatusReport> systemMetricsResponse, Stack stack) {
if (entitlementService.datalakeMetricsDatabusProcessing(stack.getAccountId())) {
DatabusRequestContext context = createDatabusRequestContext(stack);
if (isSuccessfulRequest(systemMetricsResponse) && systemMetricsResponse.getResult() != null && CollectionUtils.isNotEmpty(systemMetricsResponse.getResult().getNodesList())) {
for (NodeStatusProto.NodeStatus nodeStatus : systemMetricsResponse.getResult().getNodesList()) {
DatabusRequest recordRequest = createDatabusRecordRequest(nodeStatus.getSystemMetrics(), context);
metricsDatabusRecordProcessor.processRecord(recordRequest);
}
}
} else {
LOGGER.debug("Skip databus metrics processing as databus record processing is disabled for {}", stack.getAccountId());
}
}
use of com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest in project cloudbreak by hortonworks.
the class DatabusRequestConverterTest method testConvertWithoutAccountId.
@Test
public void testConvertWithoutAccountId() {
// GIVEN
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "CdpVmMetrics", "CdpVmMetrics");
DatabusRequest input = DatabusRequest.Builder.newBuilder().withRawBody("{}").withContext(DatabusRequestContext.Builder.newBuilder().addAdditionalDatabusHeader("third-header", "app-name").build()).build();
// WHEN
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> DatabusRequestConverter.convert(input, meteringConfiguration));
// THEN
assertTrue(exception.getMessage().contains("At least accountId needs to be filled"));
}
use of com.sequenceiq.cloudbreak.sigmadbus.model.DatabusRequest in project cloudbreak by hortonworks.
the class DatabusRequestConverterTest method testConvertWithoutPayload.
@Test
public void testConvertWithoutPayload() {
// GIVEN
MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, "CdpVmMetrics", "CdpVmMetrics");
DatabusRequest input = DatabusRequest.Builder.newBuilder().withContext(DatabusRequestContext.Builder.newBuilder().withAccountId("cloudera").build()).build();
// WHEN
IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> DatabusRequestConverter.convert(input, meteringConfiguration));
// THEN
assertTrue(exception.getMessage().contains("At least raw body message needs to be filled"));
}
Aggregations