Search in sources :

Example 1 with WorkloadAnalyticsRequest

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

the class TelemetryConverter method createWorkloadAnalyticsRequest.

public WorkloadAnalyticsRequest createWorkloadAnalyticsRequest(TelemetryResponse response, SdxClusterResponse sdxClusterResponse) {
    WorkloadAnalyticsRequest workloadAnalyticsRequest = null;
    if (telemetryPublisherEnabled) {
        Map<String, Object> waDefaultAttributes = createWAAttributesFromEnvironmentResponse(response);
        workloadAnalyticsRequest = fillWARequestFromEnvironmentResponse(response, sdxClusterResponse, waDefaultAttributes);
    } else {
        LOGGER.debug("Workload analytics feature is disabled (globally).");
    }
    return workloadAnalyticsRequest;
}
Also used : WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)

Example 2 with WorkloadAnalyticsRequest

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

the class TelemetryConverter method createWorkloadAnalyticsFromRequest.

private WorkloadAnalytics createWorkloadAnalyticsFromRequest(TelemetryRequest request) {
    WorkloadAnalytics workloadAnalytics = null;
    if (request.getWorkloadAnalytics() != null) {
        LOGGER.debug("Create workload analytics telemetry settings from workload analytics request.");
        WorkloadAnalyticsRequest workloadAnalyticsRequest = request.getWorkloadAnalytics();
        workloadAnalytics = new WorkloadAnalytics();
        workloadAnalytics.setAttributes(workloadAnalyticsRequest.getAttributes());
        workloadAnalytics.setDatabusEndpoint(databusEndpoint);
    }
    return workloadAnalytics;
}
Also used : WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)

Example 3 with WorkloadAnalyticsRequest

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

the class TelemetryConverter method createWorkloadAnalyticsRequestFromSource.

private WorkloadAnalyticsRequest createWorkloadAnalyticsRequestFromSource(Telemetry telemetry) {
    WorkloadAnalyticsRequest waRequest = null;
    WorkloadAnalytics workloadAnalytics = telemetry.getWorkloadAnalytics();
    if (workloadAnalytics != null) {
        waRequest = new WorkloadAnalyticsRequest();
        waRequest.setAttributes(workloadAnalytics.getAttributes());
    }
    return waRequest;
}
Also used : WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) WorkloadAnalytics(com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)

Example 4 with WorkloadAnalyticsRequest

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

the class TelemetryConverterTest method testConvertFromRequest.

@Test
public void testConvertFromRequest() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    LoggingRequest logging = new LoggingRequest();
    logging.setS3(new S3CloudStorageV1Parameters());
    WorkloadAnalyticsRequest workloadAnalyticsRequest = new WorkloadAnalyticsRequest();
    FeaturesRequest featuresRequest = new FeaturesRequest();
    featuresRequest.addClusterLogsCollection(false);
    featuresRequest.addMonitoring(true);
    featuresRequest.addCloudStorageLogging(false);
    telemetryRequest.setLogging(logging);
    telemetryRequest.setFeatures(featuresRequest);
    telemetryRequest.setWorkloadAnalytics(workloadAnalyticsRequest);
    // WHEN
    Telemetry result = underTest.convert(telemetryRequest, StackType.WORKLOAD);
    // THEN
    assertNotNull(result.getFeatures().getWorkloadAnalytics());
    assertFalse(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertFalse(result.getFeatures().getCloudStorageLogging().isEnabled());
    assertTrue(result.getFeatures().getMetering().isEnabled());
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
    assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
    assertEquals(DATABUS_ENDPOINT, result.getDatabusEndpoint());
    assertEquals(DATABUS_ENDPOINT, result.getWorkloadAnalytics().getDatabusEndpoint());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.Test)

Example 5 with WorkloadAnalyticsRequest

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

the class TelemetryApiConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    TelemetryRequest telemetryRequest = new TelemetryRequest();
    LoggingRequest loggingRequest = new LoggingRequest();
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
    loggingRequest.setS3(s3Params);
    telemetryRequest.setLogging(loggingRequest);
    telemetryRequest.setWorkloadAnalytics(new WorkloadAnalyticsRequest());
    FeaturesRequest fr = new FeaturesRequest();
    fr.addClusterLogsCollection(true);
    fr.addWorkloadAnalytics(true);
    fr.addMonitoring(true);
    telemetryRequest.setFeatures(fr);
    given(entitlementService.isCdpSaasEnabled(anyString())).willReturn(true);
    // WHEN
    EnvironmentTelemetry result = underTest.convert(telemetryRequest, new Features(), ACCOUNT_ID);
    // THEN
    assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
    assertEquals("http://myaddress/api/v1/receive", result.getMonitoring().getRemoteWriteUrl());
    assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
    assertTrue(result.getFeatures().getWorkloadAnalytics().isEnabled());
    assertTrue(result.getFeatures().getUseSharedAltusCredential().isEnabled());
    assertTrue(result.getFeatures().getMonitoring().isEnabled());
    assertTrue(result.getFeatures().getCloudStorageLogging().isEnabled());
}
Also used : TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) EnvironmentTelemetry(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Features(com.sequenceiq.common.api.telemetry.model.Features) EnvironmentFeatures(com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures) WorkloadAnalyticsRequest(com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest) LoggingRequest(com.sequenceiq.common.api.telemetry.request.LoggingRequest) FeaturesRequest(com.sequenceiq.common.api.telemetry.request.FeaturesRequest) Test(org.junit.jupiter.api.Test)

Aggregations

WorkloadAnalyticsRequest (com.sequenceiq.common.api.telemetry.request.WorkloadAnalyticsRequest)8 FeaturesRequest (com.sequenceiq.common.api.telemetry.request.FeaturesRequest)3 LoggingRequest (com.sequenceiq.common.api.telemetry.request.LoggingRequest)3 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)3 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)2 WorkloadAnalytics (com.sequenceiq.common.api.telemetry.model.WorkloadAnalytics)2 Features (com.sequenceiq.common.api.telemetry.model.Features)1 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)1 MonitoringRequest (com.sequenceiq.common.api.telemetry.request.MonitoringRequest)1 EnvironmentFeatures (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentFeatures)1 EnvironmentTelemetry (com.sequenceiq.environment.environment.dto.telemetry.EnvironmentTelemetry)1 Test (org.junit.Test)1 Test (org.junit.jupiter.api.Test)1