Search in sources :

Example 36 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabledGlobally.

@Test
public void testConvertFromEnvAndSdxResponseWithWADisabledGlobally() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
    sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
    sdxClusterResponse.setName("sdxName");
    AltusDatabusConfiguration altusDatabusConfiguration = new AltusDatabusConfiguration(DATABUS_ENDPOINT, DATABUS_S3_BUCKET, false, "", null);
    MeteringConfiguration meteringConfiguration = new MeteringConfiguration(true, null, null);
    ClusterLogsCollectionConfiguration logCollectionConfig = new ClusterLogsCollectionConfiguration(true, null, null);
    MonitoringConfiguration monitoringConfig = new MonitoringConfiguration();
    monitoringConfig.setEnabled(true);
    TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration(altusDatabusConfiguration, meteringConfiguration, logCollectionConfig, monitoringConfig, null);
    TelemetryConverter converter = new TelemetryConverter(telemetryConfiguration, false, true);
    // WHEN
    TelemetryRequest result = converter.convert(response, sdxClusterResponse);
    // THEN
    assertNull(result.getWorkloadAnalytics());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) MeteringConfiguration(com.sequenceiq.cloudbreak.telemetry.metering.MeteringConfiguration) TelemetryConfiguration(com.sequenceiq.cloudbreak.telemetry.TelemetryConfiguration) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) AltusDatabusConfiguration(com.sequenceiq.cloudbreak.altus.AltusDatabusConfiguration) MonitoringConfiguration(com.sequenceiq.cloudbreak.telemetry.monitoring.MonitoringConfiguration) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) ClusterLogsCollectionConfiguration(com.sequenceiq.cloudbreak.telemetry.logcollection.ClusterLogsCollectionConfiguration) Test(org.junit.Test)

Example 37 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithMonitoring.

@Test
public void testConvertFromEnvAndSdxResponseWithMonitoring() {
    // GIVEN
    TelemetryResponse response = new TelemetryResponse();
    FeaturesResponse featuresResponse = new FeaturesResponse();
    featuresResponse.addMonitoring(true);
    response.setFeatures(featuresResponse);
    MonitoringResponse monitoringResponse = new MonitoringResponse();
    monitoringResponse.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
    response.setMonitoring(monitoringResponse);
    // WHEN
    TelemetryRequest result = underTest.convert(response, null);
    // THEN
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
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) MonitoringResponse(com.sequenceiq.common.api.telemetry.response.MonitoringResponse) Test(org.junit.Test)

Example 38 with TelemetryRequest

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

the class TelemetryConverterTest method testConvertToRequest.

@Test
public void testConvertToRequest() {
    // GIVEN
    Telemetry telemetry = new Telemetry();
    telemetry.setDatabusEndpoint(DATABUS_ENDPOINT);
    Logging logging = new Logging();
    logging.setS3(new S3CloudStorageV1Parameters());
    telemetry.setLogging(logging);
    Monitoring monitoring = new Monitoring();
    monitoring.setRemoteWriteUrl(MONITORING_REMOTE_WRITE_URL);
    telemetry.setMonitoring(monitoring);
    Features features = new Features();
    features.addClusterLogsCollection(true);
    features.addMonitoring(true);
    telemetry.setFeatures(features);
    WorkloadAnalytics workloadAnalytics = new WorkloadAnalytics();
    Map<String, Object> waAttributes = new HashMap<>();
    waAttributes.put("myWAKey", "myWAValue");
    workloadAnalytics.setAttributes(waAttributes);
    telemetry.setWorkloadAnalytics(workloadAnalytics);
    Map<String, Object> fluentAttributes = new HashMap<>();
    fluentAttributes.put("myKey", "myValue");
    telemetry.setFluentAttributes(fluentAttributes);
    // WHEN
    TelemetryRequest result = underTest.convertToRequest(telemetry);
    // THEN
    assertNotNull(result.getLogging().getS3());
    assertEquals("myValue", result.getFluentAttributes().get("myKey"));
    assertEquals("myWAValue", result.getWorkloadAnalytics().getAttributes().get("myWAKey"));
    assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertEquals(MONITORING_REMOTE_WRITE_URL, result.getMonitoring().getRemoteWriteUrl());
}
Also used : Logging(com.sequenceiq.common.api.telemetry.model.Logging) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) HashMap(java.util.HashMap) 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) Test(org.junit.Test)

Example 39 with TelemetryRequest

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

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

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