Search in sources :

Example 1 with Telemetry

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);
}
Also used : TelemetryCommonConfigView(com.sequenceiq.cloudbreak.telemetry.common.TelemetryCommonConfigView) NodeStatusConfigView(com.sequenceiq.cloudbreak.telemetry.nodestatus.NodeStatusConfigView) HashMap(java.util.HashMap) TelemetryClusterDetails(com.sequenceiq.cloudbreak.telemetry.TelemetryClusterDetails) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) DatabusConfigView(com.sequenceiq.cloudbreak.telemetry.databus.DatabusConfigView) MeteringConfigView(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfigView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) MonitoringConfigView(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfigView) Test(org.junit.Test)

Example 2 with Telemetry

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);
    }
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry)

Example 3 with Telemetry

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;
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) Features(com.sequenceiq.common.api.telemetry.model.Features) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Monitoring(com.sequenceiq.common.api.telemetry.model.Monitoring) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)

Example 4 with 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);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) DataBusCredential(com.sequenceiq.common.api.telemetry.model.DataBusCredential) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 5 with Telemetry

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;
}
Also used : Backup(com.sequenceiq.freeipa.api.model.Backup) CloudFileSystemView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry)

Aggregations

Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)109 Test (org.junit.Test)55 Test (org.junit.jupiter.api.Test)31 Logging (com.sequenceiq.common.api.telemetry.model.Logging)30 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)20 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)16 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)15 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)13 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)12 Backup (com.sequenceiq.freeipa.api.model.Backup)12 HashMap (java.util.HashMap)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)11 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)10 Features (com.sequenceiq.common.api.telemetry.model.Features)10 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)8 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)8 ApiClient (com.cloudera.api.swagger.client.ApiClient)7 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)7 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)6 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)6