use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponseWithEnabledClusterLogsCollectionFeatures.
@Test
public void testConvertToResponseWithEnabledClusterLogsCollectionFeatures() {
// GIVEN
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
Features features = new Features();
features.setWorkloadAnalytics(null);
features.addClusterLogsCollection(true);
telemetry.setFeatures(features);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertNull(result.getFeatures().getWorkloadAnalytics());
assertNull(result.getFeatures().getMetering());
}
use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponse.
@Test
public void testConvertToResponse() {
// GIVEN
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
use of com.sequenceiq.common.api.telemetry.model.Logging 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());
}
use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.
the class FluentConfigService method determineAndSetLogging.
private boolean determineAndSetLogging(FluentConfigView.Builder builder, Telemetry telemetry, boolean databusEnabled, boolean meteringEnabled) {
boolean cloudStorageLoggingEnabled = false;
boolean cloudLogServiceLoggingEnabled = false;
if (telemetry.getLogging() != null) {
Logging logging = telemetry.getLogging();
if (logging.getS3() != null) {
fillS3Configs(builder, logging.getStorageLocation());
LOGGER.debug("Fluent will be configured to use S3 output.");
cloudStorageLoggingEnabled = true;
} else if (logging.getAdlsGen2() != null) {
fillAdlsGen2Configs(builder, logging.getStorageLocation(), logging.getAdlsGen2());
LOGGER.debug("Fluent will be configured to use ADLS Gen2 output.");
cloudStorageLoggingEnabled = true;
} else if (logging.getGcs() != null) {
fillGcsConfigs(builder, logging.getStorageLocation(), logging.getGcs());
LOGGER.debug("Fluent will be configured to use GCS output");
cloudStorageLoggingEnabled = true;
} else if (logging.getCloudwatch() != null) {
fillCloudwatchConfigs(builder, logging.getStorageLocation(), logging.getCloudwatch());
LOGGER.debug("Fluent will be configured to use Cloudwatch output.");
cloudLogServiceLoggingEnabled = true;
}
}
if (!telemetry.isCloudStorageLoggingEnabled()) {
LOGGER.debug("Disable (override) cloud storage logging as feature setting is disabled.");
cloudStorageLoggingEnabled = false;
}
builder.withCloudStorageLoggingEnabled(cloudStorageLoggingEnabled).withCloudLoggingServiceEnabled(cloudLogServiceLoggingEnabled);
boolean databusLogEnabled = fillDiagnosticsConfigs(telemetry, databusEnabled, meteringEnabled, builder);
return cloudStorageLoggingEnabled || databusLogEnabled || cloudLogServiceLoggingEnabled;
}
use of com.sequenceiq.common.api.telemetry.model.Logging in project cloudbreak by hortonworks.
the class TelemetryConverter method createLoggingResponseFromSource.
private LoggingResponse createLoggingResponseFromSource(Telemetry telemetry) {
LoggingResponse loggingResponse = null;
if (telemetry.getLogging() != null) {
LOGGER.debug("Setting logging telemetry settings (response).");
Logging logging = telemetry.getLogging();
loggingResponse = new LoggingResponse();
loggingResponse.setStorageLocation(logging.getStorageLocation());
loggingResponse.setS3(logging.getS3());
loggingResponse.setAdlsGen2(logging.getAdlsGen2());
loggingResponse.setGcs(logging.getGcs());
loggingResponse.setCloudwatch(CloudwatchParams.copy(logging.getCloudwatch()));
}
return loggingResponse;
}
Aggregations