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