Search in sources :

Example 1 with Features

use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.

the class TelemetryConverter method createFeaturesRequestFromSource.

private FeaturesRequest createFeaturesRequestFromSource(Telemetry telemetry) {
    FeaturesRequest featuresRequest = null;
    Features features = telemetry.getFeatures();
    if (features != null) {
        featuresRequest = new FeaturesRequest();
        featuresRequest.setWorkloadAnalytics(features.getWorkloadAnalytics());
        featuresRequest.setClusterLogsCollection(features.getClusterLogsCollection());
        featuresRequest.setMonitoring(features.getMonitoring());
        setCloudStorageLoggingOnFeaturesModel(features, featuresRequest);
    }
    return featuresRequest;
}
Also used : Features(com.sequenceiq.common.api.telemetry.model.Features) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 2 with Features

use of com.sequenceiq.common.api.telemetry.model.Features 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 3 with Features

use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.

the class TelemetryConverter method createFeaturesFromRequest.

private Features createFeaturesFromRequest(FeaturesRequest featuresRequest) {
    Features features = new Features();
    if (clusterLogsCollection) {
        if (featuresRequest != null && featuresRequest.getClusterLogsCollection() != null) {
            features.setClusterLogsCollection(featuresRequest.getClusterLogsCollection());
            LOGGER.debug("Fill report deployment log settings from feature request");
        } else {
            LOGGER.debug("Auto-fill report deployment logs settings with defaults. (disabled)");
            features.addClusterLogsCollection(false);
        }
    }
    if (useSharedAltusCredential) {
        features.addUseSharedAltusCredential(true);
    }
    if (featuresRequest != null && featuresRequest.getCloudStorageLogging() != null) {
        features.setCloudStorageLogging(featuresRequest.getCloudStorageLogging());
    } else {
        features.addCloudStorageLogging(true);
    }
    if (featuresRequest != null && featuresRequest.getMonitoring() != null) {
        features.setMonitoring(featuresRequest.getMonitoring());
    } else {
        features.addMonitoring(true);
    }
    return features;
}
Also used : Features(com.sequenceiq.common.api.telemetry.model.Features)

Example 4 with Features

use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.

the class EnvironmentApiConverterTest method testAzureSingleRgEnabledAndEmptyAzureRequest.

@Test
void testAzureSingleRgEnabledAndEmptyAzureRequest() {
    EnvironmentRequest request = createEnvironmentRequest(AZURE);
    request.setAzure(null);
    FreeIpaCreationDto freeIpaCreationDto = mock(FreeIpaCreationDto.class);
    EnvironmentTelemetry environmentTelemetry = mock(EnvironmentTelemetry.class);
    AccountTelemetry accountTelemetry = mock(AccountTelemetry.class);
    Features features = mock(Features.class);
    NetworkDto networkDto = mock(NetworkDto.class);
    when(credentialService.getCloudPlatformByCredential(anyString(), anyString(), any())).thenReturn(AZURE.name());
    when(freeIpaConverter.convert(request.getFreeIpa(), "id", CloudConstants.AWS)).thenReturn(freeIpaCreationDto);
    when(accountTelemetry.getFeatures()).thenReturn(features);
    when(accountTelemetryService.getOrDefault(any())).thenReturn(accountTelemetry);
    when(telemetryApiConverter.convert(eq(request.getTelemetry()), any(), anyString())).thenReturn(environmentTelemetry);
    when(tunnelConverter.convert(request.getTunnel())).thenReturn(request.getTunnel());
    when(networkRequestToDtoConverter.convert(request.getNetwork())).thenReturn(networkDto);
    EnvironmentCreationDto actual = testInitCreationDto(request);
    assertEquals(ResourceGroupUsagePattern.USE_MULTIPLE, actual.getParameters().getAzureParametersDto().getAzureResourceGroupDto().getResourceGroupUsagePattern());
}
Also used : NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) FreeIpaCreationDto(com.sequenceiq.environment.environment.dto.FreeIpaCreationDto) AccountTelemetry(com.sequenceiq.environment.telemetry.domain.AccountTelemetry) EnvironmentRequest(com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest) Features(com.sequenceiq.common.api.telemetry.model.Features) ExperimentalFeatures(com.sequenceiq.environment.environment.domain.ExperimentalFeatures) EnvironmentCreationDto(com.sequenceiq.environment.environment.dto.EnvironmentCreationDto) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with Features

use of com.sequenceiq.common.api.telemetry.model.Features in project cloudbreak by hortonworks.

the class TelemetryApiConverterTest method testConvertWithDefaultMonitoringFeatureWithoutCdpSaas.

@Test
public void testConvertWithDefaultMonitoringFeatureWithoutCdpSaas() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(false);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertNull(result.getFeatures());
    assertNull(result.getMonitoring().getRemoteWriteUrl());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) Features(com.sequenceiq.common.api.telemetry.model.Features) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) Test(org.junit.jupiter.api.Test)

Aggregations

Features (com.sequenceiq.common.api.telemetry.model.Features)33 Test (org.junit.jupiter.api.Test)19 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)16 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)10 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)10 AccountTelemetry (com.sequenceiq.environment.telemetry.domain.AccountTelemetry)10 ExperimentalFeatures (com.sequenceiq.environment.environment.domain.ExperimentalFeatures)8 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)8 NetworkDto (com.sequenceiq.environment.network.dto.NetworkDto)8 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)7 EnvironmentRequest (com.sequenceiq.environment.api.v1.environment.model.request.EnvironmentRequest)7 EnvironmentCreationDto (com.sequenceiq.environment.environment.dto.EnvironmentCreationDto)7 FreeIpaCreationDto (com.sequenceiq.environment.environment.dto.FreeIpaCreationDto)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)4 Logging (com.sequenceiq.common.api.telemetry.model.Logging)4 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)4 EnvironmentBackup (com.sequenceiq.environment.environment.dto.EnvironmentBackup)4 BaseDiagnosticsCollectionRequest (com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest)3 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)3