use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryDecoratorTest method testDecorateWithMonitoring.
@Test
public void testDecorateWithMonitoring() {
// GIVEN
Map<String, SaltPillarProperties> servicePillar = new HashMap<>();
TelemetryClusterDetails clusterDetails = TelemetryClusterDetails.Builder.builder().withCrn("myClusterCrn").withType("datahub").withVersion("1.0.0").build();
MonitoringConfigView monitoringConfigView = new MonitoringConfigView.Builder().withEnabled(true).withClusterDetails(clusterDetails).build();
NodeStatusConfigView nodeStatusConfigView = new NodeStatusConfigView.Builder().withServerUsername("admin").withServerPassword("admin".toCharArray()).build();
DatabusConfigView dataConfigView = new DatabusConfigView.Builder().build();
TelemetryCommonConfigView telemetryCommonConfigView = new TelemetryCommonConfigView.Builder().withClusterDetails(clusterDetails).build();
MeteringConfigView meteringConfigView = new MeteringConfigView.Builder().build();
mockConfigServiceResults(dataConfigView, new FluentConfigView.Builder().build(), meteringConfigView, monitoringConfigView, nodeStatusConfigView, telemetryCommonConfigView);
// WHEN
Map<String, SaltPillarProperties> result = underTest.decoratePillar(servicePillar, createStack(), new Telemetry());
// THEN
Map<String, Object> results = createMapFromFluentPillars(result, "monitoring");
assertEquals(results.get("clusterType"), "datahub");
assertEquals(results.get("clusterVersion"), "1.0.0");
assertEquals(results.get("clusterCrn"), "myClusterCrn");
assertEquals(results.get("enabled"), true);
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class StackToStackV4RequestConverter method prepareTelemetryRequest.
private void prepareTelemetryRequest(Stack source, StackV4Request stackV4Request) {
Telemetry telemetry = componentConfigProviderService.getTelemetry(source.getId());
if (telemetry != null) {
TelemetryRequest telemetryRequest = telemetryConverter.convertToRequest(telemetry);
stackV4Request.setTelemetry(telemetryRequest);
}
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryConverter method convert.
public Telemetry convert(TelemetryRequest request, StackType type) {
Telemetry telemetry = new Telemetry();
Features features = new Features();
LOGGER.debug("Converting telemetry request to telemetry object");
if (request != null) {
Logging logging = createLoggingFromRequest(request);
Monitoring monitoring = createMonitoringFromRequest(request);
WorkloadAnalytics workloadAnalytics = createWorkloadAnalyticsFromRequest(request);
telemetry.setLogging(logging);
telemetry.setMonitoring(monitoring);
telemetry.setWorkloadAnalytics(workloadAnalytics);
setWorkloadAnalyticsFeature(telemetry, features);
setClusterLogsCollection(request, features);
setMonitoring(request, features);
setUseSharedAltusCredential(features);
setCloudStorageLogging(request, features);
telemetry.setFluentAttributes(request.getFluentAttributes());
}
if (monitoringEnabled) {
LOGGER.debug("Cluster level monitoring feature is enabled");
features.addMonitoring(true);
}
setMeteringFeature(type, features);
if (StringUtils.isNotEmpty(databusEndpoint)) {
LOGGER.debug("Setting databus endpoint: {}", databusEndpoint);
telemetry.setDatabusEndpoint(databusEndpoint);
}
telemetry.setFeatures(features);
return telemetry;
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class TelemetryService method createTelemetryConfigs.
@Override
public Map<String, SaltPillarProperties> createTelemetryConfigs(Long stackId, Set<TelemetryComponentType> components) {
Stack stack = stackService.getById(stackId);
Cluster cluster = stack.getCluster();
DataBusCredential dataBusCredential = getDatabusCredential(cluster).orElse(null);
Telemetry telemetry = componentConfigProviderService.getTelemetry(stackId);
LOGGER.debug("Generating telemetry configs for stack '{}'", stack.getResourceCrn());
return telemetryDecorator.decoratePillar(new HashMap<>(), stack, telemetry, dataBusCredential);
}
use of com.sequenceiq.common.api.telemetry.model.Telemetry in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildFileSystemView.
public Optional<CloudFileSystemView> buildFileSystemView(Stack stack) {
Telemetry telemetry = stack.getTelemetry();
Backup backup = stack.getBackup();
Optional<CloudFileSystemView> fileSystemView = Optional.empty();
if (telemetry != null && telemetry.getLogging() != null && backup != null) {
checkLoggingAndBackupFileSystemConflicting(telemetry.getLogging(), backup);
}
if (telemetry != null && telemetry.getLogging() != null) {
fileSystemView = buildFileSystemViewFromTelemetry(telemetry.getLogging());
}
if (fileSystemView.isEmpty() && backup != null) {
fileSystemView = buildFileSystemViewFromBackup(backup);
}
return fileSystemView;
}
Aggregations