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;
}
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;
}
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;
}
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());
}
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());
}
Aggregations