Search in sources :

Example 11 with FeaturesRequest

use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.

the class TelemetryApiConverterTest method testConvertWithMonitoringFeatureWithoutCdpSaas.

@Test
public void testConvertWithMonitoringFeatureWithoutCdpSaas() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(false);
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addMonitoring(true);
    telemetryRequest.setFeatures(featuresRequest);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    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) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 12 with FeaturesRequest

use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.

the class TelemetryApiConverterTest method testConvertWithWAFeature.

@Test
public void testConvertWithWAFeature() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    FeaturesRequest fr = new FeaturesRequest();
    fr.addWorkloadAnalytics(true);
    telemetryRequest.setFeatures(fr);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
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) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Example 13 with FeaturesRequest

use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.

the class StackRequestManifester method prepareTelemetryForStack.

private void prepareTelemetryForStack(StackV4Request stackV4Request, DetailedEnvironmentResponse environment, SdxCluster sdxCluster) {
    TelemetryResponse envTelemetry = environment.getTelemetry();
    if (envTelemetry != null && envTelemetry.getLogging() != null) {
        TelemetryRequest telemetryRequest = new TelemetryRequest();
        LoggingRequest loggingRequest = new LoggingRequest();
        LoggingResponse envLogging = envTelemetry.getLogging();
        loggingRequest.setS3(envLogging.getS3());
        loggingRequest.setAdlsGen2(envLogging.getAdlsGen2());
        loggingRequest.setGcs(envLogging.getGcs());
        loggingRequest.setCloudwatch(envLogging.getCloudwatch());
        loggingRequest.setStorageLocation(envLogging.getStorageLocation());
        telemetryRequest.setLogging(loggingRequest);
        MonitoringRequest monitoringRequest = new MonitoringRequest();
        MonitoringResponse envMonitoring = envTelemetry.getMonitoring();
        if (envMonitoring != null) {
            monitoringRequest.setRemoteWriteUrl(envMonitoring.getRemoteWriteUrl());
        }
        telemetryRequest.setMonitoring(monitoringRequest);
        if (envTelemetry.getFeatures() != null) {
            FeaturesRequest featuresRequest = new FeaturesRequest();
            featuresRequest.setClusterLogsCollection(envTelemetry.getFeatures().getClusterLogsCollection());
            featuresRequest.setMonitoring(envTelemetry.getFeatures().getMonitoring());
            if (envTelemetry.getFeatures().getCloudStorageLogging() != null) {
                featuresRequest.setCloudStorageLogging(envTelemetry.getFeatures().getCloudStorageLogging());
            } else {
                featuresRequest.addCloudStorageLogging(true);
            }
            telemetryRequest.setFeatures(featuresRequest);
        }
        if (envTelemetry.getFluentAttributes() != null) {
            Map<String, Object> fluentAttributes = envTelemetry.getFluentAttributes();
            if (!fluentAttributes.containsKey(TelemetryClusterDetails.CLUSTER_CRN_KEY)) {
                fluentAttributes.put(TelemetryClusterDetails.CLUSTER_CRN_KEY, sdxCluster.getCrn());
            }
            addAzureIdbrokerMsiToTelemetry(fluentAttributes, stackV4Request);
            telemetryRequest.setFluentAttributes(fluentAttributes);
        }
        stackV4Request.setTelemetry(telemetryRequest);
    }
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 14 with FeaturesRequest

use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.

the class TelemetryConverter method convert.

public TelemetryRequest convert(TelemetryResponse response, SdxClusterResponse sdxClusterResponse) {
    LOGGER.debug("Creating telemetry request based on datalake and environment responses.");
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    FeaturesRequest featuresRequest = new FeaturesRequest();
    if (response != null) {
        LoggingRequest loggingRequest = createLoggingRequestFromResponse(response);
        telemetryRequest.setLogging(loggingRequest);
        MonitoringRequest monitoringRequest = createMonitoringRequestFromResponse(response);
        telemetryRequest.setMonitoring(monitoringRequest);
        FeaturesResponse featuresResponse = response.getFeatures();
        if (featuresResponse != null) {
            LOGGER.debug("Setting cluster logs collection request (telemetry) based on environment response.");
            featuresRequest.setClusterLogsCollection(featuresResponse.getClusterLogsCollection());
            LOGGER.debug("Setting cluster monitoring request (telemetry) based on environment response.");
            featuresRequest.setMonitoring(featuresResponse.getMonitoring());
            LOGGER.debug("Setting cloud storage logging request (telemetry) based on environment response.");
            if (featuresResponse.getCloudStorageLogging() != null) {
                featuresRequest.setCloudStorageLogging(featuresResponse.getCloudStorageLogging());
            } else {
                featuresRequest.addCloudStorageLogging(true);
            }
        }
        telemetryRequest.setFluentAttributes(response.getFluentAttributes());
    }
    telemetryRequest.setWorkloadAnalytics(createWorkloadAnalyticsRequest(response, sdxClusterResponse));
    Optional<FeatureSetting> waFeature = createWorkloadAnalyticsFeature(telemetryRequest.getWorkloadAnalytics());
    featuresRequest.setWorkloadAnalytics(waFeature.orElse(null));
    telemetryRequest.setFeatures(featuresRequest);
    return telemetryRequest;
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Example 15 with FeaturesRequest

use of com.sequenceiq.common.api.telemetry.request.FeaturesRequest in project cloudbreak by hortonworks.

the class TelemetryConverter method convertToRequest.

public TelemetryRequest convertToRequest(Telemetry telemetry) {
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    if (telemetry != null) {
        LoggingRequest loggingRequest = createLoggingRequestFromSource(telemetry);
        MonitoringRequest monitoringRequest = createMonitoringRequestFromSource(telemetry);
        WorkloadAnalyticsRequest waRequest = createWorkloadAnalyticsRequestFromSource(telemetry);
        FeaturesRequest featuresRequest = createFeaturesRequestFromSource(telemetry);
        telemetryRequest.setWorkloadAnalytics(waRequest);
        telemetryRequest.setLogging(loggingRequest);
        telemetryRequest.setMonitoring(monitoringRequest);
        telemetryRequest.setFluentAttributes(telemetry.getFluentAttributes());
        telemetryRequest.setFeatures(featuresRequest);
    }
    return telemetryRequest;
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) MonitoringRequest(com.sequenceiq.common.api.telemetry.request.MonitoringRequest) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest)

Aggregations

FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)18 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)13 Test (org.junit.jupiter.api.Test)8 Features (com.sequenceiq.common.api.telemetry.model.Features)7 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)7 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)6 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)6 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)4 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)4 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)3 WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)3 Test (org.junit.Test)2 GcsCloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters)1 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)1 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)1 MonitoringResponse (com.sequenceiq.common.api.telemetry.response.MonitoringResponse)1 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)1 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)1 HashMap (java.util.HashMap)1