Search in sources :

Example 31 with TelemetryRequest

use of com.sequenceiq.common.api.telemetry.request.TelemetryRequest 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 32 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertWhenClusterLogCollectionIsDisabledThenItShouldBeFalseInTheResult.

@Test
public void testConvertWhenClusterLogCollectionIsDisabledThenItShouldBeFalseInTheResult() {
    ReflectionTestUtils.setField(underTest, "clusterLogsCollection", false);
    TelemetryRequest input = new TelemetryRequest();
    Telemetry result = underTest.convert(input, StackType.WORKLOAD);
    assertNotNull(result);
    assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 33 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabled.

@Test
public void testConvertFromEnvAndSdxResponseWithWADisabled() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
    sdxClusterResponse.setName("sdxName");
    FeaturesResponse featuresResponse = new FeaturesResponse();
    featuresResponse.addWorkloadAnalytics(false);
    response.setFeatures(featuresResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
    // THEN
    assertNull(result.getWorkloadAnalytics());
    assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Test(org.junit.Test)

Example 34 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertToRequestWithEmptyTelemetry.

@Test
public void testConvertToRequestWithEmptyTelemetry() {
    // GIVEN
    Telemetry telemetry = new Telemetry();
    // WHEN
    TelemetryRequest result = underTest.convertToRequest(telemetry);
    // THEN
    assertNotNull(result);
    assertNull(result.getLogging());
    assertNull(result.getMonitoring());
    assertNull(result.getWorkloadAnalytics());
    assertNull(result.getFeatures());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) Test(org.junit.Test)

Example 35 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertWithCloudStorageLoggingNotEnabled.

@Test
public void testConvertWithCloudStorageLoggingNotEnabled() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    FeaturesResponse featuresResponse = new FeaturesResponse();
    FeatureSetting fs = new FeatureSetting();
    fs.setEnabled(false);
    featuresResponse.setCloudStorageLogging(fs);
    response.setFeatures(featuresResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, null);
    // THEN
    assertFalse(result.getFeatures().getCloudStorageLogging().isEnabled());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) FeaturesResponse(com.sequenceiq.common.api.telemetry.response.FeaturesResponse) FeatureSetting(com.sequenceiq.common.api.type.FeatureSetting) Test(org.junit.Test)

Aggregations

TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)47 Test (org.junit.Test)19 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)15 Test (org.junit.jupiter.api.Test)15 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)13 Features (com.sequenceiq.common.api.telemetry.model.Features)10 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)10 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)9 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)9 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)9 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)7 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)6 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)6 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)4 WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)3 FeatureSetting (com.sequenceiq.common.api.type.FeatureSetting)3 AltusDatabusConfiguration (com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration)2 ObjectStorageValidateRequest (com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateRequest)2 ObjectStorageValidateResponse (com.sequenceiq.cloudbreak.cloud.model.objectstorage.ObjectStorageValidateResponse)2 Json (com.sequenceiq.cloudbreak.common.json.Json)2