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